| 1 | #!/bin/bash |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | ARCH="$1" |
| 6 | |
| 7 | MULTIARCHPATH=/usr/lib/$(dpkg-architecture -q DEB_BUILD_MULTIARCH) |
| 8 | |
| 9 | if test -f ${MULTIARCHPATH}/wine/wine ; then |
| 10 | # wine >= 10 |
| 11 | WINE=${MULTIARCHPATH}/wine/wine |
| 12 | export WINESERVER=${MULTIARCHPATH}/wine/wineserver |
| 13 | else |
| 14 | if [ "$ARCH" = x86_64 ]; then |
| 15 | WINE=/usr/lib/wine/wine64 |
| 16 | export WINESERVER=/usr/lib/wine/wineserver64 |
| 17 | elif [ "$ARCH" = i686 ]; then |
| 18 | WINE=/usr/lib/wine/wine |
| 19 | export WINESERVER=/usr/lib/wine/wineserver32 |
| 20 | fi |
| 21 | fi |
| 22 | |
| 23 | case $ARCH in |
| 24 | x86_64) |
| 25 | ;; |
| 26 | i686) |
| 27 | ;; |
| 28 | *) |
| 29 | printf >&2 'Unknown Architecture: %s\n' "$ARCH" |
| 30 | exit 1 |
| 31 | ;; |
| 32 | esac |
| 33 | |
| 34 | GCC="${ARCH}-w64-mingw32-gcc" |
| 35 | |
| 36 | WIN_GPG_ERROR=/usr/"${ARCH}"-w64-mingw32/bin/gpg-error.exe |
| 37 | |
| 38 | # get wine initialized, which normally spews logs to stderr |
| 39 | # (autopkgtest doesn't want stderr) |
| 40 | "$WINE" hostname 2>&1 |
| 41 | |
| 42 | # just make sure that gpg-error.exe works |
| 43 | |
| 44 | "$WINE" "$WIN_GPG_ERROR" --version |
| 45 | |
| 46 | # just compare the first 200 error messages (not all of them, because |
| 47 | # some errors have no available strings on windows): |
| 48 | for x in $(seq 0 200); do |
| 49 | diff -u <(gpg-error $x) \ |
| 50 | <("$WINE" "$WIN_GPG_ERROR" $x | sed 's/\r$//' ) |
| 51 | done |
| 52 | |
| 53 | export PKG_CONFIG_PATH="/usr/${ARCH}-w64-mingw32/lib/pkgconfig" |
| 54 | |
| 55 | # see https://dev.gnupg.org/T4623 for why extra_libs is necessary as |
| 56 | # of gpg-error 1.36: |
| 57 | extra_libs=(-lws2_32) |
| 58 | |
| 59 | # build a static windows binary around libgpg-error and run it: |
| 60 | "$GCC" -pedantic -Wall -Werror -static -o test-run.exe debian/tests/simple-build.c $(pkg-config --cflags --static --libs gpg-error) "${extra_libs[@]}" |
| 61 | "$WINE" ./test-run.exe |
| 62 | rm -f ./test-run.exe |