Skip to content

Commit

Permalink
v1.4.0 release, Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
ied206 committed Oct 20, 2019
2 parents 3e2cec7 + 7ba4a8c commit 002be1a
Show file tree
Hide file tree
Showing 18 changed files with 180 additions and 149 deletions.
9 changes: 5 additions & 4 deletions ManagedWimLib.Tests/TestSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ public class TestSetup
[AssemblyInitialize]
public static void Init(TestContext context)
{
BaseDir = Path.GetFullPath(Path.Combine(TestHelper.GetProgramAbsolutePath(), "..", "..", ".."));
string absPath = TestHelper.GetProgramAbsolutePath();
BaseDir = Path.GetFullPath(Path.Combine(absPath, "..", "..", ".."));
SampleDir = Path.Combine(BaseDir, "Samples");

string arch = null;
Expand All @@ -61,11 +62,11 @@ public static void Init(TestContext context)

string libPath = null;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
libPath = Path.Combine(arch, "libwim-15.dll");
libPath = Path.Combine(absPath, arch, "libwim-15.dll");
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
libPath = Path.Combine(arch, "libwim.so");
libPath = Path.Combine(absPath, arch, "libwim.so");
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
libPath = Path.Combine(arch, "libwim.dylib");
libPath = Path.Combine(absPath, arch, "libwim.dylib");

if (libPath == null || !File.Exists(libPath))
throw new PlatformNotSupportedException();
Expand Down
34 changes: 23 additions & 11 deletions ManagedWimLib/ManagedWimLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,37 @@
<PropertyGroup>
<TargetFrameworks>net451;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard2.0</TargetFrameworks>
<PackageId>ManagedWimLib</PackageId>
<Title>ManagedWimLib</Title>
<LangVersion>latest</LangVersion>
<Version>1.3.0</Version>
<Version>1.4.0</Version>
<Authors>Eric Biggers, Hajin Jang</Authors>
<Description>C# wrapper library for native wimlib.
Supports Windows and Linux.</Description>
<Copyright>Copyright (c) 2018-2019 Hajin Jang</Copyright>
<Company>Joveler</Company>
<PackageReleaseNotes>- Update included wimlib to 1.13.1
- Support dll with additional dependency
- Drop .Net Standard 1.3 support</PackageReleaseNotes>
<PackageLicenseUrl>https://github.com/ied206/ManagedWimLib/blob/master/LICENSE</PackageLicenseUrl>
<Description>Native wimlib wrapper library for .Net.
Provides every capabilities of wimlib.
Supports Windows, Linux and macOS.</Description>
<Copyright>Copyright (c) 2018-2019 Hajin Jang</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://github.com/ied206/ManagedWimLib</PackageProjectUrl>
<RepositoryUrl></RepositoryUrl>
<PackageTags>wim wimlib imagex pinvoke interop</PackageTags>
<PackageIconUrl>https://raw.githubusercontent.com/ied206/ManagedWimLib/master/Image/Logo.png</PackageIconUrl>
<PackageIcon>images\Logo.png</PackageIcon>
<RepositoryUrl>https://github.com/ied206/ManagedWimLib</RepositoryUrl>
<PackageReleaseNotes>- Support macOS platform
- Apply improved native library loader (Joveler.DynLoader)</PackageReleaseNotes>
<PackageTags>wim wimlib dism imagex archive native pinvoke interop</PackageTags>
</PropertyGroup>
<Import Project="$(MSBuildProjectDirectory)\ManagedWimLib.targets" />
<ItemGroup>
<PackageReference Include="Joveler.DynLoader" Version="1.2.0" />
<None Include="..\Image\Logo.png" Pack="true" PackagePath="images\" />
<!-- .Net Framework 4.5.1 -->
<None Include="ManagedWimLib.targets" Pack="true" PackagePath="build\net451\ManagedWimLib.targets" />
<None Include="Precompiled\x86\*.dll" Pack="true" PackagePath="build\net451\Precompiled\x86" />
<None Include="Precompiled\x64\*.dll" Pack="true" PackagePath="build\net451\Precompiled\x64" />
<!-- .Net Standard 2.0 -->
<None Include="ManagedWimLib.targets" Pack="true" PackagePath="build\netstandard2.0\ManagedWimLib.targets" />
<None Include="Precompiled\x86\*" Pack="true" PackagePath="build\netstandard2.0\Precompiled\x86" />
<None Include="Precompiled\x64\*" Pack="true" PackagePath="build\netstandard2.0\Precompiled\x64" />
<None Include="Precompiled\armhf\*" Pack="true" PackagePath="build\netstandard2.0\Precompiled\armhf" />
<None Include="Precompiled\arm64\*" Pack="true" PackagePath="build\netstandard2.0\Precompiled\arm64" />
</ItemGroup>
</Project>
42 changes: 0 additions & 42 deletions ManagedWimLib/ManagedWimLib.nuspec

This file was deleted.

4 changes: 2 additions & 2 deletions ManagedWimLib/NugetPack.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ SETLOCAL ENABLEEXTENSIONS

REM %~dp0 => absolute path of directory where batch file exists
cd %~dp0
SET NUGET="%cd%\..\res\nuget.exe"
SET BASE=%~dp0

dotnet clean -c Release
dotnet build -c Release
%NUGET% pack ManagedWimLib.nuspec
dotnet pack -c Release -o %BASE%

ENDLOCAL
Binary file modified ManagedWimLib/Precompiled/arm64/libwim.so
100644 → 100755
Binary file not shown.
Binary file modified ManagedWimLib/Precompiled/armhf/libwim.so
100644 → 100755
Binary file not shown.
Binary file added ManagedWimLib/Precompiled/x64/libwim.dylib
Binary file not shown.
Binary file modified ManagedWimLib/Precompiled/x64/libwim.so
Binary file not shown.
21 changes: 6 additions & 15 deletions ManagedWimLib/WimLibLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ public WimLibLoader() : base() { }
public WimLibLoader(string libPath) : base(libPath) { }
#endregion

#region LP64 and LLP64
internal enum LongBits
{
Long64 = 0, // Windows, Linux 32bit (LLP64)
Long32 = 1, // Linux 64bit (LP64)
}
internal LongBits LongBitType;
#endregion

#region UTF-8 and UTF-16
internal Utf8d Utf8 = new Utf8d();
internal Utf16d Utf16 = new Utf16d();
Expand Down Expand Up @@ -1294,9 +1285,9 @@ internal ErrorCode AddImageMultiSource(IntPtr wim, CaptureSource[] sources, UInt
switch (UnicodeConvention)
{
case UnicodeConvention.Utf16:
switch (LongBitType)
switch (PlatformLongSize)
{
case LongBits.Long32:
case PlatformLongSize.Long32:
Utf16d.CaptureSourceBaseL32[] capSrcsL32 = new Utf16d.CaptureSourceBaseL32[sources.Length];
for (int i = 0; i < sources.Length; i++)
{
Expand All @@ -1308,7 +1299,7 @@ internal ErrorCode AddImageMultiSource(IntPtr wim, CaptureSource[] sources, UInt
};
}
return Utf16.AddImageMultiSourceL32(wim, capSrcsL32, numSources, name, configFile, addFlags);
case LongBits.Long64:
case PlatformLongSize.Long64:
Utf16d.CaptureSourceBaseL64[] capSrcsL64 = new Utf16d.CaptureSourceBaseL64[sources.Length];
for (int i = 0; i < sources.Length; i++)
{
Expand All @@ -1324,9 +1315,9 @@ internal ErrorCode AddImageMultiSource(IntPtr wim, CaptureSource[] sources, UInt
throw new PlatformNotSupportedException();
case UnicodeConvention.Utf8:
default:
switch (LongBitType)
switch (PlatformLongSize)
{
case LongBits.Long32:
case PlatformLongSize.Long32:
Utf8d.CaptureSourceBaseL32[] capSrcsL32 = new Utf8d.CaptureSourceBaseL32[sources.Length];
for (int i = 0; i < sources.Length; i++)
{
Expand All @@ -1338,7 +1329,7 @@ internal ErrorCode AddImageMultiSource(IntPtr wim, CaptureSource[] sources, UInt
};
}
return Utf8.AddImageMultiSourceL32(wim, capSrcsL32, numSources, name, configFile, addFlags);
case LongBits.Long64:
case PlatformLongSize.Long64:
Utf8d.CaptureSourceBaseL64[] capSrcsL64 = new Utf8d.CaptureSourceBaseL64[sources.Length];
for (int i = 0; i < sources.Length; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ fi
make -j12
cp .libs/*.so $BASE_DIR
strip $BASE_DIR/*.so
make clean
popd
26 changes: 26 additions & 0 deletions Scripts/build_linux/static_libfuse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# Adapted from https://wimlib.net/git/?p=wimlib;a=tree;f=tools/windeps/Makefile;

# Absolute path to this script, e.g. /home/user/bin/foo.sh
BASE_ABS_PATH=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
BASE_DIR=$(dirname "${BASE_ABS_PATH}")
CORES=$(grep -c ^processor /proc/cpuinfo)

# libxml2 source directory must be parameter
pushd "${PWD}"
LIB_PREFIX="${HOME}/wimlib-build"
mkdir "${LIB_PREFIX}"
cd "$1"
rm -rf build
mkdir build
CFLAGS="-Os -fPIC" meson . build \
--strip --default-library static \
--prefix "${LIB_PREFIX}" \
--buildtype release \
-Dutils=false -Dexamples=false -Duseroot=false -Ddisable-mtab=false
cd build
ninja -j "${CORES}"
ninja install
popd
22 changes: 22 additions & 0 deletions Scripts/build_linux/static_libxml.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

# Adapted from https://wimlib.net/git/?p=wimlib;a=tree;f=tools/windeps/Makefile;

# Absolute path to this script, e.g. /home/user/bin/foo.sh
BASE_ABS_PATH=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
BASE_DIR=$(dirname "${BASE_ABS_PATH}")
CORES=$(grep -c ^processor /proc/cpuinfo)

# libxml2 source directory must be parameter
pushd "${PWD}"
LIB_PREFIX="${HOME}/wimlib-build"
mkdir "${LIB_PREFIX}"
cd "$1"
make clean
./configure --enable-static --disable-shared \
--prefix="${LIB_PREFIX}" CFLAGS="-Os -fPIC" \
--with-minimum --without-lzma --with-tree --with-writer
make "-j${CORES}"
make install
popd
28 changes: 28 additions & 0 deletions Scripts/build_linux/static_wimlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# Adapted from https://wimlib.net/git/?p=wimlib;a=tree;f=tools/make-windows-release;
# Run after running build_linux_static_libxml.sh

# Absolute path to this script, e.g. /home/user/bin/foo.sh
BASE_ABS_PATH=$(readlink -f "$0")
# Absolute path this script is in, thus /home/user/bin
BASE_DIR=$(dirname "${BASE_ABS_PATH}")
CORES=$(grep -c ^processor /proc/cpuinfo)
ARCH=$(uname -m)

# sudo apt install libfuse-dev
pushd "${PWD}"
LIB_PREFIX="${HOME}/wimlib-build"
cd $1
if [ "${ARCH}" = "x86_64" ]; then
EXTRA_ARGS="--enable-ssse3-sha1"
fi
make clean
./configure --enable-dynamic --disable-static \
LIBXML2_CFLAGS="-I${LIB_PREFIX}/include/libxml2" \
LIBXML2_LIBS="-L${LIB_PREFIX}/lib -lxml2" \
--without-libcrypto --without-ntfs-3g "${EXTRA_ARGS}"
make "-j${CORES}"
cp ".libs/libwim.so" "${BASE_DIR}"
strip "${BASE_DIR}/libwim.so"
popd
20 changes: 0 additions & 20 deletions Scripts/build_linux_static_libxml.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ BASE_DIR=$(dirname "$BASE_ABS_PATH")

# libxml2 source directory must be parameter
pushd $PWD
LIB_PREFIX=$(readlink -f "$HOME/wimlib-build")
LIBXML2_SRC_DIR=$(readlink -f "$1")
LIB_PREFIX=$HOME/wimlib-build
LIBXML2_SRC_DIR=$1
mkdir $LIB_PREFIX
cd $LIBXML2_SRC_DIR
./configure --enable-static --disable-shared --prefix=$LIB_PREFIX CFLAGS=-Os --with-minimum --without-lzma --with-tree --with-writer
./configure --enable-static --disable-shared \
--prefix=$LIB_PREFIX CFLAGS=-Os \
--with-minimum --without-lzma --with-tree --with-writer
make install
# rm -f $LIB_PREFIX/lib/libxml2.la;
make clean
popd
23 changes: 23 additions & 0 deletions Scripts/build_mac/static_wimlib.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# Adapted from https://wimlib.net/git/?p=wimlib;a=tree;f=tools/make-windows-release;
# Run after running build_linux_static_libxml.sh

# wimlib source directory must be parameter
# Ex)./build_posix_wimlib.sh

# This build requires nasm
# $ brew install nasm
pushd $PWD
LIB_PREFIX=$HOME/wimlib-build
WIMLIB_SRC_DIR=$1
cd $WIMLIB_SRC_DIR
./configure --enable-dynamic --disable-static \
LIBXML2_CFLAGS="-I$LIB_PREFIX/include/libxml2" \
LIBXML2_LIBS="-L$LIB_PREFIX/lib" \
PKG_CONFIG_PATH="$LIB_PREFIX/lib/pkgconfig" \
--without-libcrypto --without-ntfs-3g --without-fuse --enable-ssse3-sha1
make -j4
cp .libs/*.dylib .
strip ./*.dylib
popd
Loading

0 comments on commit 002be1a

Please sign in to comment.