diff options
author | Andreas Fankhauser hiddenalpha.ch | 2023-02-19 17:20:30 +0100 |
---|---|---|
committer | Andreas Fankhauser hiddenalpha.ch | 2023-02-19 17:20:30 +0100 |
commit | 4015f6de5c98cab856991a05b27713af90e97e7f (patch) | |
tree | 1464d6b6fefeb7b41e78a46fcdb158c38fad6381 /contrib/build-with-mingw64 | |
parent | 9e4ff1fe33081c1a4a8639fe2e27ffc6f2d4f48a (diff) | |
download | DeflateAndInflate-4015f6de5c98cab856991a05b27713af90e97e7f.zip DeflateAndInflate-4015f6de5c98cab856991a05b27713af90e97e7f.tar.gz |
(build) Simplify build doc
- Include target tripplet into version
- Refactor docker build env by a more flexible script variant
Diffstat (limited to 'contrib/build-with-mingw64')
-rw-r--r-- | contrib/build-with-mingw64/README.md | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/contrib/build-with-mingw64/README.md b/contrib/build-with-mingw64/README.md new file mode 100644 index 0000000..d90dd71 --- /dev/null +++ b/contrib/build-with-mingw64/README.md @@ -0,0 +1,95 @@ + +Guide how to cross build for windoof +==================================== + +## Get Source + +Change into an EMPTY directory and do: + +```sh +git clone --depth=256 https://github.com/hiddenalpha/DeflateAndInflate.git ./. +``` + + +## Choose an alpine system + +Take the alpine system you want to use as build env. A nice way to +achieve this is via docker. + +In the command below, make sure WORK points to the dir where you cloned +the project to. + +```sh +true\ + && WORK="${PWD:?}" \ + && IMG=alpine:3.17.2 \ + && CNTR=DeflateAndInflate-AlpineMingw64 \ + && docker pull "${IMG:?}" \ + && docker create --name "${CNTR:?}" -v "${WORK:?}:/work" -w /work "${IMG:?}" sh -c "while true;do sleep 1||break;done" \ + && docker start "${CNTR:?}" \ + && true +``` + +All snippets here assume this docker setup. But can easily be used +without docker and should work in any POSIX compliant shell. For this +only copy the shell script inside the ticks (') of each command. In +other words just use the part starting with *true* and ending with +another *true*. + + +## Setup dependencies + +```sh +docker exec -ti -u0:0 "${CNTR:?}" sh -c 'true \ + && apk add curl git make mingw-w64-gcc tar \ + && ZLIB_VERSION="1.2.11" \ + && THEOLDPWD="$PWD" \ + && cd /tmp \ + && curl -LsS -o "/tmp/zlib-${ZLIB_VERSION}.tgz" "https://github.com/madler/zlib/archive/refs/tags/v${ZLIB_VERSION:?}.tar.gz" \ + && tar xzf "/tmp/zlib-${ZLIB_VERSION:?}.tgz" \ + && export SRCDIR="/tmp/zlib-${ZLIB_VERSION:?}" \ + && mkdir $SRCDIR/build \ + && cd "${SRCDIR:?}" \ + && export DESTDIR=./build BINARY_PATH=/bin INCLUDE_PATH=/include LIBRARY_PATH=/lib \ + && sed -i "s;^PREFIX =.\*\$;;" win32/Makefile.gcc \ + && make -e -fwin32/Makefile.gcc PREFIX=x86_64-w64-mingw32- \ + && make -e -fwin32/Makefile.gcc install PREFIX=x86_64-w64-mingw32- \ + && unset DESTDIR BINARY_PATH INCLUDE_PATH LIBRARY_PATH \ + && cp README build/. \ + && (cd build && rm -rf lib/pkgconfig) \ + && (cd build && find -type f -not -name MD5SUM -exec md5sum -b {} + > MD5SUM) \ + && (cd build && tar --owner=0 --group=0 -cz *) > /tmp/zlib-1.2.11-windoof.tgz \ + && cd / \ + && rm -rf /tmp/zlib-1.2.11 \ + && mkdir -p /usr/local/x86_64-w64-mingw32 \ + && tar -C /usr/x86_64-w64-mingw32 -f /tmp/zlib-1.2.11-windoof.tgz -x include lib \ + && cd "${THEOLDPWD:?}" \ + && unset THEOLDPWD ZLIB_VERSION \ + && true' +``` + +## configure & make + +Build the project itself. + +```sh +docker exec -ti -u$(id -u):$(id -g) "${CNTR:?}" sh -c 'true\ + && export CC=x86_64-w64-mingw32-gcc \ + && sh ./configure \ + && make -e clean \ + && make -e \ + && true' +``` + +A ready-to-distribute tarball is now available in `./dist/`. If you'd +like to install it somewhere else, all you need is this tarball. If you +want to install on same system where you did build you can continue with +the *install* step below. + + +## install + +There is no trivial *make-install* equivalent for windoof. Therefore +unpack the tarball into an appropriate directory of your choise and make +sure *bin* subdir is in your PATH. + |