-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·140 lines (124 loc) · 3.9 KB
/
build.sh
File metadata and controls
executable file
·140 lines (124 loc) · 3.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
set -e
MINGW=${MINGW:-${ARCH:-x86_64}-w64-mingw32}
PREFIX=${PREFIX:-usr}
WORKSPACE=${WORKSPACE:-$(pwd)}
TARGET=${TARGET:-${WORKSPACE}}
WINREQ=${WINREQ:-${TARGET}/${PREFIX}}
BUILD_NUMBER=${BUILD_NUMBER:-0}
ARCH=${ARCH:-${MINGW%%-*}}
BINDIR=${BINDIR:-${PREFIX}/exe}
LIBDIR=${LIBDIR:-${PREFIX}/exe}
WININC=${WININC:-${WINREQ}/include}
WINLIB=${WINLIB:-${WINREQ}/exe}
name=
svn=
git=
zip=0
while test $# -gt 0; do
case "$1" in
(-h|--help)
cat<<EOF
$0 [OPTIONS] [CONFIGURE-ARGUMENTS]
OPTIONS:
-h, --help show this help
-z, --zip create zip package
-s, --svn [src] specify subversion source
-g, --git [src] specify git source
-n, --name [name] project name
Specify either --svn or --git, otherwise sources must be in $(pwd)
CONFIGURE-ARGUMENTS:
Arguments that are passed to configure.
VARIABLES:
MINGW mingw parameter (default: $MINGW)
PREFIX relative installation prefix (default: $PREFIX)
WORKSPACE workspace path (default: $WORKSPACE)
WINREQ path to required windows libraries (default: $WINREQ)
TARGET installation target (default: $TARGET)
BUILD_NUMBER build number (default: $BUILD_NUMBER)
ARCH architecture (default: $ARCH)
BINDIR install dir for exe files (default: $BINDIR)
LIBDIR install dir for dll files (default: $LIBDIR)
WININC path to required windows include files (default: $WININC)
WINLIB path to required windows libraries (default: $WINLIB)
Builds Standard Autoconf Projects for Windows
EOF
exit
;;
(-s|--svn)
shift
svn="$1"
if test -z "$name"; then
name=$(sed 's,/\(trunk\|tags/.*\|branches/.*\),,;s,.*/,,' <<<$svn)
fi
;;
(-g|--git)
shift
git="$1"
if test -z "$name"; then
name=$(sed 's,/\.git,,;s,.*/,,' <<<$git)
fi
;;
(-n|--name) shift; name="$1";;
(-z|--zip) zip=1;;
(*) break;;
esac
if ! test $# -gt 0; then
echo "ERROR: missing parameter" 1>&2
exit 1
fi
shift
done
set -x
cd ${WORKSPACE}
if test -n "$git"; then
git clone $git "${name:-.}"
fi
if test -n "$svn"; then
svn co "$svn" "${name:-.}"
fi
if test -n "$name"; then
cd "$name"
fi
if test -x ./bootstrap.sh; then
./bootstrap.sh -c \
--host=${MINGW} \
--prefix="${TARGET}/${PREFIX}" \
--bindir="${TARGET}/$BINDIR" \
--sbindir="${TARGET}/$BINDIR" \
--libdir="${TARGET}/$LIBDIR" \
--libexecdir="${TARGET}/$LIBDIR" \
CPPFLAGS="-I${WININC}" \
LDFLAGS="-L${WINLIB}" \
PKG_CONFIG_PATH="${WINLIB}/pkgconfig" \
$*
elif test -x ./configure; then
./configure --host=${MINGW} \
--prefix="${TARGET}/${PREFIX}" \
--bindir="${TARGET}/$BINDIR" \
--sbindir="${TARGET}/$BINDIR" \
--libdir="${TARGET}/$LIBDIR" \
--libexecdir="${TARGET}/$LIBDIR" \
CPPFLAGS="-I${WININC}" \
LDFLAGS="-L${WINLIB}" \
PKG_CONFIG_PATH="${WINLIB}/pkgconfig" \
$*
fi
if test -z "$name" -o "$name" = "."; then
name=$(sed -n 's,PACKAGE_NAME = ,,p' makefile)
fi
version=$(sed -n 's,PACKAGE_VERSION = ,,p' makefile)
set +x
echo "======================================================"
echo "Version: $version"
echo "Package: $name"
echo "======================================================"
set -x
[ -n "$name" ] && [[ "$version" =~ ^[0-9.]+$ ]]
make
make install
chmod -R u+rw "${TARGET}"
if test $zip -eq 1; then
cd "${TARGET}"
zip -r "${name}-${version}~windows.${BUILD_NUMBER}_${ARCH}.zip" "${PREFIX}"
fi