new build mode for windows mingw cross compilation
This commit is contained in:
		| @@ -16,6 +16,8 @@ packages=() | ||||
| targets="all check distcheck" | ||||
| commands=() | ||||
| arch=$((which dpkg > /dev/null 2> /dev/null && dpkg --print-architecture) || echo amd64) | ||||
| host= | ||||
| flags=() | ||||
| wait=0 | ||||
| if test -e ./build-in-docker.conf; then | ||||
|     # you can preconfigure the variables in file build-in-docker.conf | ||||
| @@ -30,10 +32,12 @@ while test $# -gt 0; do | ||||
|             echo "OPTIONS:" | ||||
|             echo | ||||
|             echo "  -h, --help            show this help" | ||||
|             echo "  -m, --mode <type>     mode: deb, rpm, default: ${mode}" | ||||
|             echo "  -m, --mode <type>     mode: deb, rpm, win, default: ${mode}" | ||||
|             echo "  -i, --image <image>   use given docker image instead of ${img}" | ||||
|             echo "  -a, --arch <arch>     build for given hardware architecture" | ||||
|             echo "  -t, --targets targets specify build targets, default: ${targets}" | ||||
|             echo "  --host <target-arch>  host for cross compiling, e.g. i686-w64-mingw32" | ||||
|             echo "  -f, --flag <flag>     add flag to ./bootstrap.sh or ./configure" | ||||
|             echo "  -r, --repo <url>      add given apt repository" | ||||
|             echo "  -k, --key <url>       add public key from url" | ||||
|             echo "  -e, --env <var>=<val> set environment variable in docker" | ||||
| @@ -44,7 +48,9 @@ while test $# -gt 0; do | ||||
|             echo | ||||
|             echo "  The option -i must be after -m, because mode sets a new default image" | ||||
|             echo "  The option -m must be after -t, because mode may be auto detected from targets" | ||||
|             echo "  The option -m must be after -h, because mode may set a host" | ||||
|             echo "  If target is either deb or rpm, mode is set to the same value" | ||||
|             echo "  If target is win, host is set to i686-w64-mingw32" | ||||
|             echo | ||||
|             echo "  The options -r -k -e -d -p -c can be repeated several times." | ||||
|             echo | ||||
| @@ -79,6 +85,7 @@ while test $# -gt 0; do | ||||
|                 (rpm|zypper) img="opensuse:latest";; | ||||
|                 (yum) img="centos:latest";; | ||||
|                 (dnf) img="fedora:latest";; | ||||
|                 (win) img="ubuntu:latest"; host="${host:---host=i686-w64-mingw32}";; | ||||
|                 (*) | ||||
|                     echo "**** ERROR: unknown mode '$1', try --help" 1>&2 | ||||
|                     exit 1 | ||||
| @@ -91,7 +98,7 @@ while test $# -gt 0; do | ||||
|         (-a|--arch) shift; | ||||
|             arch="$1" | ||||
|             ;; | ||||
|         (-t|--targets) shift | ||||
|         (-t|--targets) shift; | ||||
|             targets="$1" | ||||
|             if test "$1" = "deb" -o "$1" = "rpm"; then | ||||
|                 # set mode to same value | ||||
| @@ -99,6 +106,12 @@ while test $# -gt 0; do | ||||
|                 continue | ||||
|             fi | ||||
|             ;; | ||||
|         (--host) shift; | ||||
|             host="--host=$1" | ||||
|             ;; | ||||
|         (-f|--flag) shift; | ||||
|             flags+=("$1") | ||||
|             ;; | ||||
|         (-r|--repo) shift; | ||||
|             repos+=("$1") | ||||
|             ;; | ||||
| @@ -275,5 +288,14 @@ EOF | ||||
|         done | ||||
|         docker exec ${DOCKER_ID} ./resolve-rpmbuilddeps.sh | ||||
|         ;; | ||||
|     (win) | ||||
|         if [[ "${img}" =~ "ubuntu" ]]; then | ||||
|             docker exec ${DOCKER_ID} locale-gen ${LANG} | ||||
|             docker exec ${DOCKER_ID} update-locale LANG=${LANG} | ||||
|         fi | ||||
|         docker exec ${DOCKER_ID} apt-get update ${OPTIONS} | ||||
|         docker exec ${DOCKER_ID} apt-get install -y mingw-w64 | ||||
|         docker exec ${DOCKER_ID} ./resolve-debbuilddeps.sh | ||||
|         ;; | ||||
| esac | ||||
| docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" | ||||
| docker exec -u $(id -u):$(id -g) ${DOCKER_ID} ./bootstrap.sh -t "${targets}" ${host} ${flags[@]} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user