-
Notifications
You must be signed in to change notification settings - Fork 0
/
mxe.sh
executable file
·85 lines (75 loc) · 1.82 KB
/
mxe.sh
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
#!/bin/bash
JOBS=$(expr $(cat /proc/cpuinfo | grep processor | wc -l) + 1)
DISTRIB_CODENAME=$(source /etc/os-release; echo ${ID}"-"${VERSION_ID})
function exec_in_dir ()
{
pushd $1 > /dev/null || exit $?
shift
$@
let RET=$?
popd > /dev/null
return ${RET}
}
#export LDFLAGS="-Wl,-subsystem,console"
#export LIBS="-lpthread"
#export PKG_CONFIG_SYSROOT_DIR=;
#export PKG_CONFIG_LIBDIR=/$(MXE_TC)/lib/pkgconfig;
function config()
{
local DIST=$1
shift
TCROOT=opt/mxe
export PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR}:/${TCROOT}/lib
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/${TCROOT}/lib/pkgconfig
./mxe-crosstools-gen.sh ./${DIST}/crosstools || exit $?
export PATH=${PWD}/${DIST}/crosstools:$PATH
./dist-config.sh \
--target=mxe \
--packaging=windows \
-- \
--target=i686-w64-mingw32.static \
--prefix= \
--tcroot=${TCROOT} \
--host-prefix=opt/extras.ubuntu.com/csjp \
--gnu-source \
--static \
--libs=\\\"-lgnurx -pthread\\\" \
--ldflags="-Wl,-subsystem,console" \
|| exit $?
exec_in_dir build-for-${DIST} ./configure || exit $?
}
CMD=$1
DIST=${DISTRIB_CODENAME}-x-mxe
case "${CMD}" in
(debian)
shift
config ${DIST} || exit $?
exec_in_dir build-for-${DIST} debuild \
--no-tgz-check \
--preserve-envvar MXE_HOME \
--preserve-envvar PATH \
--preserve-envvar PKG_CONFIG_LIBDIR \
--preserve-envvar PKG_CONFIG_PATH \
-B $@ \
--lintian-opts --no-lintian || exit $?
;;
(debian-nc)
shift
config ${DIST} || exit $?
exec_in_dir build-for-${DIST} debuild --no-tgz-check -nc
;;
(debian-src)
shift
config ${DIST} || exit $?
exec_in_dir build-for-${DIST} debuild --no-tgz-check -S
;;
(code)
shift
config ${DIST} || exit $?
exec_in_dir build-for-${DIST} make -j1 $@ || exit $?
;;
(*)
config ${DIST} || exit $?
exec_in_dir build-for-${DIST} make -j${JOBS} $@ || exit $?
;;
esac