doc: update copyright line for 2021
[adg.git] / build / build-win
blobfa2f61316096a57aad0977cf486cbecbb383acf9
1 #!/bin/bash
3 # Builds a windows installer on a UNIX system. It depends
4 # on a lot of stuff such as wine, a proper MinGW toolchain
5 # and my GTK2/3 cross-compiled environment found at
6 # http://github.com/ntd/aur-fedora-mingw
8 # It supersedes the old configure scripts still distributed
9 # (build/configure-win32 and build/configure-win64) by
10 # properly cross-compiling the ADG project with
11 # gobject-introspection enabled.
13 # It accepts an optional argument for specifying the target
14 # architecture. Use "win32" (or omit the argument altogether)
15 # for a 32 bit build, use "win64" for a 64 bit build.
17 case "$1" in
19 "win32" | "")
20 arch=i686-w64-mingw32
23 "win64")
24 arch=x86_64-w64-mingw32
28 echo "Invalid argument"
29 echo "Usage: $0 [win32|win64]"
30 exit 1
32 esac
34 # This script only works in the root dir or in a VPATH build
35 # one level under the root dir
36 if [ -x ./configure ]; then
37 tardir=.
38 elif [ -x ../configure ]; then
39 tardir=..
42 # Step 1: cross-build ADG for $arch
43 # Execute the scripts inside a subshell so there will be
44 # no visible environment changes from outside.
46 # The configure scripts provided by the aur-fedora-mingw
47 # found at http://github.com/ntd/aur-fedora-mingw are intended to
48 # be used from makepkg: let us adapt them for external usage
49 CHOST=$($tardir/build/config.guess)
50 srcdir="$TMPDIR"
51 [ -z "$srcdir" ] && srcdir=/tmp
52 srcdir="$srcdir/$(whoami)/adg-wine"
53 mkdir -p "$srcdir"
55 # Source the wrapper so the environment set by the configure script
56 # is retained for the next make call
57 MINGW_EXTRA_CFLAGS='-mwindows'
58 source /usr/bin/$arch-configure "$tardir" \
59 --prefix= \
60 --enable-shared \
61 --enable-static \
62 --enable-pango \
63 --disable-gtk-doc \
64 --with-gtk=gtk3 \
65 --enable-introspection \
66 --disable-test-framework \
67 "$@"
69 make -j
72 # Step 2: create the installer
73 # Force empty flags because the cached ones are intended for to be
74 # consumed by step 1 (cross-build), not by step 2 (straight build).
75 make -j installer CPPFLAGS= CFLAGS= LDFLAGS=