From b2ae9587e7e35bb621f63c6c783b995326117e36 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 26 Jun 2019 16:02:04 +0200 Subject: [PATCH] Install a getopt library on Windows. Yes, getopt is posix and is not present by default on Windows. https://github.com/takamin/win-c seems a pretty functional getopt_long implementation. --- appveyor.yml | 1 + appveyor/install_getopt.cmd | 15 +++++++++++++++ appveyor/install_kiwix-tools.cmd | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 appveyor/install_getopt.cmd diff --git a/appveyor.yml b/appveyor.yml index 7a783d9..1d57eea 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -52,6 +52,7 @@ build_script: - IF "%USE_CACHE%" NEQ "1" appveyor\install_aria2.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_mustache.cmd - IF "%USE_CACHE%" NEQ "1" appveyor\install_libmicrohttpd.cmd + - IF "%USE_CACHE%" NEQ "1" appveyor\install_getopt.cmd - IF "%USE_CACHE%" NEQ "1" %MINGW64_RUN% "cd /c/projects/kiwix-build && appveyor/create_cache.sh" - appveyor\install_libzim.cmd - appveyor\install_kiwix-lib.cmd diff --git a/appveyor/install_getopt.cmd b/appveyor/install_getopt.cmd new file mode 100644 index 0000000..be10d26 --- /dev/null +++ b/appveyor/install_getopt.cmd @@ -0,0 +1,15 @@ +REM ======================================================== +REM Install getopt +curl -fsSL -O https://github.com/takamin/win-c/archive/v1.0.zip || exit /b 1 +7z x v1.0.zip -o. || exit /b 1 +cd win-c-1.0 +mkdir build +cd build +cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%EXTRA_DIR% .. || exit /b 1 +dir +nmake install || exit /b 1 +copy ..\include\getopt.h %EXTRA_DIR%\include +cd ..\.. + +dir %EXTRA_DIR%\include +dir %EXTRA_DIR%\lib diff --git a/appveyor/install_kiwix-tools.cmd b/appveyor/install_kiwix-tools.cmd index b0e6cea..326c57d 100644 --- a/appveyor/install_kiwix-tools.cmd +++ b/appveyor/install_kiwix-tools.cmd @@ -3,7 +3,7 @@ REM Install kiwix-lib git clone https://github.com/kiwix/kiwix-tools.git || exit /b 1 cd kiwix-tools set "CPPFLAGS=-I%EXTRA_DIR%/include" -set "LDFLAGS=-lshlwapi -lwinmm" +set "LDFLAGS=-lshlwapi -lwinmm -llibwinc" meson . build --prefix %EXTRA_DIR% -Dstatic-linkage=true --buildtype release || exit /b 1 cd build ninja || exit /b 1