author | jenda |
Tue, 18 Jan 2011 21:04:30 +0100 | |
changeset 57 | 5365e53bc663 |
parent 56 | bdc1cfd1948c |
child 63 | c3844fcbdc56 |
permissions | -rwxr-xr-x |
17 | 1 |
#!/bin/bash |
2 |
||
3 |
# Build IM pkgs |
|
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
4 |
usage="$(basename $0) [-d <topdir>] [-p] [-b] [-n] [spec files...]" |
17 | 5 |
usage="$usage\nDefault build type is 'build-only'" |
6 |
usage="$usage\n -d <topdir>: specify another top dir." |
|
7 |
usage="$usage\n -p : source prep only." |
|
8 |
usage="$usage\n -a : uninstall/build/install." |
|
9 |
usage="$usage\n -n : NOT compress/copy to $HOME/packages\n" |
|
10 |
||
11 |
# check /opt/jdsbld |
|
12 |
if [ ! -d /opt/jdsbld ];then |
|
13 |
echo "Need jds build tools in /opt/jdsbld" |
|
14 |
exit 1 |
|
15 |
fi |
|
16 |
||
50 | 17 |
date |
18 |
||
19 |
IPS_VENDORVER=0.${L10N_BUILDNUM:-"155"} |
|
20 |
PUBLISHER=${L10N_PUBLISHER:-"l10n-nightly"} |
|
21 |
||
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
22 |
rm -f /tmp/.build_env.$$ |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
23 |
[ -z "$PKGDEST" ] || echo "export PKGDEST=$PKGDEST" >> /tmp/.build_env.$$ |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
24 |
[ -z "$IPS_VENDORVER" ] || echo "export IPS_VENDORVER=$IPS_VENDORVER" >> /tmp/.build_env.$$ |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
25 |
[ -z "$PUBLISHER" ] || echo "export PUBLISHER=$PUBLISHER" >> /tmp/.build_env.$$ |
54 | 26 |
[ -z "$DOWNLOADS" ] || echo "export DOWNLOADS=$DOWNLOADS" >> /tmp/.build_env.$$ |
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
27 |
|
17 | 28 |
source /opt/jdsbld/bin/env.sh |
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
29 |
|
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
30 |
. /tmp/.build_env.$$ |
17 | 31 |
|
32 |
while getopts pad:n option |
|
33 |
do |
|
34 |
case $option in |
|
35 |
p) FLAGPREP=1;; |
|
36 |
a) FLAGALL=1;; |
|
37 |
d) TOPDIR="$OPTARG";; |
|
38 |
n) NOTCPFLAG=1;; |
|
39 |
?) printf "$usage" ; exit ;; |
|
40 |
esac |
|
41 |
done |
|
42 |
shift $(expr $OPTIND - 1) |
|
43 |
||
44 |
if [ X$TOPDIR = X ]; then |
|
45 |
if echo $0 | egrep -s '^/'; then |
|
46 |
TOPDIR=$(dirname $0) |
|
47 |
else |
|
48 |
TOPDIR="`pwd`/$(dirname $0)" |
|
49 |
fi |
|
50 |
fi |
|
50 | 51 |
|
52 |
MACH="${MACH:-`uname -p`}" |
|
53 |
BLDDIR="$TOPDIR/build.$MACH" |
|
54 |
mkdir -p $BLDDIR/log |
|
17 | 55 |
|
56 |
# set the http and ftp proxies if you are behind a firewall |
|
57 |
# export http_proxy= |
|
58 |
# export ftp_proxy= |
|
59 |
||
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
60 |
if [ -z $1 ]; then |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
61 |
SPECFILES="cmdassist.spec icu.spec idnkit.spec" |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
62 |
else |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
63 |
SPECFILES=$@ |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
64 |
fi |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
65 |
|
17 | 66 |
if [ X$FLAGPREP = 'X1' ]; then |
67 |
CMD='prep' |
|
68 |
elif [ X$FLAGALL = 'X1' ]; then |
|
69 |
CMD='build' |
|
70 |
else |
|
71 |
CMD='build-only' |
|
72 |
fi |
|
73 |
||
50 | 74 |
# Explicitly specifying location to enable to use pkgtool (pkgbuild) |
75 |
# not yet in jdsbld. |
|
76 |
PKGTOOL="/opt/pkgbuild/bin/pkgtool" |
|
77 |
||
78 |
# IPS repos are created in $PKGDEST if defined in environment, |
|
79 |
# otherwise in $BLDDIR (build.$MACH). |
|
53
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
80 |
IPS_REPODIR="${PKGDEST:-$BLDDIR}/repo.spec" |
7a8315ebf19d
build-g11n-spec.sh: fix $PKGDEST, $IPS_VENDORVER and $PUBLISHER handling - jdsbld/bin/env.sh cleaned them
jenda
parents:
51
diff
changeset
|
81 |
SRC_IPS_REPODIR="${PKGDEST:-$BLDDIR}/repoS.spec" |
50 | 82 |
|
83 |
export PKGBUILD_IPS_SERVER="file://$IPS_REPODIR/" |
|
84 |
export PKGBUILD_SRC_IPS_SERVER="file://$SRC_IPS_REPODIR/" |
|
85 |
||
86 |
rm -rf "$IPS_REPODIR" |
|
87 |
pkgrepo create --version 3 "$PKGBUILD_IPS_SERVER" |
|
88 |
pkgrepo set -s "$PKGBUILD_IPS_SERVER" publisher/prefix=${PUBLISHER} |
|
89 |
rm -rf "$SRC_IPS_REPODIR" |
|
90 |
pkgrepo create --version 3 "$PKGBUILD_SRC_IPS_SERVER" |
|
91 |
pkgrepo set -s "$PKGBUILD_SRC_IPS_SERVER" publisher/prefix=${PUBLISHER} |
|
92 |
||
17 | 93 |
for spec in $SPECFILES |
94 |
do |
|
95 |
case $spec in |
|
96 |
cmdassist.spec ) |
|
51 | 97 |
cd $TOPDIR |
17 | 98 |
cp cmdassist/COPYING cmdassist/cmdassist.copyright |
50 | 99 |
VERSION=`egrep "^Version:" cmdassist/cmdassist.spec | awk '{print $2}'` |
17 | 100 |
mv cmdassist cmdassist-${VERSION} |
101 |
/usr/bin/tar cf - cmdassist-${VERSION} | /usr/bin/gzip > cmdassist-${VERSION}.tar.gz |
|
102 |
mv cmdassist-${VERSION}.tar.gz cmdassist-${VERSION}/ |
|
103 |
dir=cmdassist-${VERSION} |
|
104 |
;; |
|
105 |
icu.spec ) |
|
51 | 106 |
cd $TOPDIR/icu |
17 | 107 |
/usr/bin/tar cf - old_libs | /usr/bin/gzip > old_libs.tar.gz |
108 |
dir=icu |
|
109 |
;; |
|
110 |
idnkit.spec ) |
|
51 | 111 |
cd $TOPDIR/idn |
17 | 112 |
/usr/bin/tar cf - sunothers | /usr/bin/gzip > sunothers.tar.gz |
18 | 113 |
/usr/bin/tar cf - idnconv | /usr/bin/gzip > idnconv.tar.gz |
17 | 114 |
dir=idn |
115 |
;; |
|
116 |
* ) |
|
117 |
dir=${spec%.spec} |
|
118 |
;; |
|
119 |
esac |
|
120 |
||
32
b3cb3388af53
Make the JDS inc files officially part of the repository (so that it can be built standalone)
Pavel Heimlich<pavel.heimlich@oracle.com>
parents:
18
diff
changeset
|
121 |
SPECDIRS=$TOPDIR/$dir:$TOPDIR/include |
17 | 122 |
PATCHDIRS=$TOPDIR/$dir/patches |
50 | 123 |
SRCDIRS=$TOPDIR/$dir |
17 | 124 |
|
38
6b6eddc571c7
add --nonotify option to pkgbuild, broken X connection could make build failure
jenda
parents:
32
diff
changeset
|
125 |
PKGUNINSTALLARGS="uninstall-pkgs --nonotify --specdirs=$SPECDIRS" |
50 | 126 |
PKGBUILDARGS="$CMD --nonotify --download --topdir=$BLDDIR --specdirs=$SPECDIRS " |
17 | 127 |
PKGBUILDARGS="$PKGBUILDARGS --sourcedirs=$SRCDIRS --patchdirs=$PATCHDIRS" |
50 | 128 |
PKGBUILDARGS="$PKGBUILDARGS --logdir=$BLDDIR/log" |
129 |
PKGBUILDARGS="$PKGBUILDARGS --pkgformat=ips" |
|
56
bdc1cfd1948c
add --halt-on-errors to pkgtool arguments - broken/uncomplete builds are useless, build process should fail
jenda
parents:
54
diff
changeset
|
130 |
PKGBUILDARGS="$PKGBUILDARGS --halt-on-errors" |
17 | 131 |
|
54 | 132 |
[[ -z "$DOWNLOADS" ]] || PKGBUILDARGS+=" --tar=$DOWNLOADS" |
133 |
||
17 | 134 |
if [ $CMD = 'build' ]; then |
135 |
echo "pkgtool $PKGUNINSTALLARGS $spec" |
|
50 | 136 |
$PKGTOOL $PKGUNINSTALLARGS $spec |
17 | 137 |
fi |
50 | 138 |
echo "$PKGTOOL $PKGBUILDARGS --define \"ipsvendorver $IPS_VENDORVER\" $spec" |
57
5365e53bc663
build-g11n-spec.sh: return error exit code if the build fails
jenda
parents:
56
diff
changeset
|
139 |
$PKGTOOL $PKGBUILDARGS --define "ipsvendorver $IPS_VENDORVER" $spec || exit 1 |
50 | 140 |
|
141 |
# tentative workaround: should eliminate the previous mv instead, |
|
142 |
# after verifying that directory name does not affect build result |
|
143 |
if [ "$spec" = "cmdassist.spec" ] |
|
144 |
then |
|
145 |
mv "$dir" cmdassist |
|
146 |
fi |
|
17 | 147 |
done |
148 |
||
50 | 149 |
date |