-
Notifications
You must be signed in to change notification settings - Fork 0
/
ubuntu.sh
executable file
·134 lines (120 loc) · 2.97 KB
/
ubuntu.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
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
#!/bin/bash
JOBS=$(expr $(cat /proc/cpuinfo | grep processor | wc -l) + 1)
#JOBS=1
# ubuntu ditributions
#trusty=14.04
#raring=13.04
#quantal=12.10
#precise=12.04
#oneiric=11.10
#lucid=10.04
#hardy=8.04
# debian distributions
#wheezy=7.0
#squeeze=6.0
#lenny=5.0
#etch=4.0
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}
}
function config ()
{
local DIST=$1
shift
eval VERSION_POSTFIX=\$${DIST}-${DIST}
./dist-config.sh \
--build=${DIST} \
--host=${DIST} \
--target=${DIST} \
--version-postfix=${VERSION_POSTFIX} \
-- \
--prefix=opt/extras.ubuntu.com/csjp \
--ldflags=-rdynamic \
--fpic \
--gnu-source \
$@ \
--desktop \
--multicultural \
--system \
|| exit $?
# --cflags=\\\"-fno-candidate-functions\\\" \
exec_in_dir build-for-${DIST} ./configure --debug || exit $?
#exec_in_dir build-for-${DIST} ./configure || exit $?
}
function release ()
{
local DIST=$1
local ARCH=$2
test "x${DIST}" = "x" && DIST=${DISTRIB_CODENAME}
test "x${ARCH}" = "x" && ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH)
test "x${ARCH}" = "x$(dpkg-architecture -qDEB_BUILD_ARCH)" && {
BASE_TGZ=$HOME/pbuilder/${DIST}-base.tgz
} || {
BASE_TGZ=$HOME/pbuilder/${DIST}-${ARCH}-base.tgz
}
test -e ${BASE_TGZ} || { pbuilder-dist ${DIST} ${ARCH} create || exit $? ; }
config ${DIST} || exit $?
exec_in_dir ${DIST} debuild --no-tgz-check -S -us -uc || exit $?
pbuilder-dist ${DIST} ${ARCH} *.dsc --buildresult ${DIST}/ || exit $?
# --othermirror "deb http://ppa.launchpad.net/csjpeter/ppa/ubuntu precise main"
# sudo pbuilder --debuild --distribution ${DIST} --architecture ${ARCH} \
# --basetgz ${BASE_TGZ} --buildresult ${DIST}/ --override-config *.dsc
# --othermirror "deb http://ppa.launchpad.net/csjpeter/ppa/ubuntu precise main"
}
CMD=$1
case "${CMD}" in
(release)
shift
release $1 $2
;;
(src-release)
shift
DIST=$1
config ${DIST} || exit $?
exec_in_dir ${DIST} debuild --no-tgz-check -S || exit $?
;;
(pump)
shift
config ${DISTRIB_CODENAME} || exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} pump make CXX=distcc \
$@ || exit $?
;;
(debian)
shift
config ${DISTRIB_CODENAME} || exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} 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 $?
;;
(check)
shift
config ${DISTRIB_CODENAME} || exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} make -j${JOBS} $@ \
|| exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} make check $@ \
|| exit $?
;;
(code)
shift
config ${DISTRIB_CODENAME} || exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} make -j1 $@ \
|| exit $?
;;
(*)
config ${DISTRIB_CODENAME} || exit $?
exec_in_dir build-for-${DISTRIB_CODENAME} make -j${JOBS} $@ \
|| exit $?
;;
esac