author | Pavel Heimlich <pavel.heimlich@oracle.com> |
Mon, 22 Nov 2010 09:54:44 +0100 | |
changeset 44 | e40f7cd559ea |
parent 38 | 6b6eddc571c7 |
child 50 | ca18a6972cfd |
permissions | -rwxr-xr-x |
17 | 1 |
#!/bin/bash |
2 |
||
3 |
# Build IM pkgs |
|
4 |
cmdname=$(basename $0) |
|
5 |
||
6 |
usage="$cmdname [-d <topdir>] [-p] [-b] [-n] [spec files...]" |
|
7 |
usage="$usage\nDefault build type is 'build-only'" |
|
8 |
usage="$usage\n -d <topdir>: specify another top dir." |
|
9 |
usage="$usage\n -p : source prep only." |
|
10 |
usage="$usage\n -a : uninstall/build/install." |
|
11 |
usage="$usage\n -n : NOT compress/copy to $HOME/packages\n" |
|
12 |
||
13 |
# check /opt/jdsbld |
|
14 |
if [ ! -d /opt/jdsbld ];then |
|
15 |
echo "Need jds build tools in /opt/jdsbld" |
|
16 |
exit 1 |
|
17 |
fi |
|
18 |
||
19 |
export PATH=/usr/bin:/usr/sbin |
|
20 |
source /opt/jdsbld/bin/env.sh |
|
21 |
export PYTHON=/usr/bin/python2.6 |
|
22 |
||
23 |
while getopts pad:n option |
|
24 |
do |
|
25 |
case $option in |
|
26 |
p) FLAGPREP=1;; |
|
27 |
a) FLAGALL=1;; |
|
28 |
d) TOPDIR="$OPTARG";; |
|
29 |
n) NOTCPFLAG=1;; |
|
30 |
?) printf "$usage" ; exit ;; |
|
31 |
esac |
|
32 |
done |
|
33 |
shift $(expr $OPTIND - 1) |
|
34 |
||
35 |
if [ X$TOPDIR = X ]; then |
|
36 |
if echo $0 | egrep -s '^/'; then |
|
37 |
TOPDIR=$(dirname $0) |
|
38 |
else |
|
39 |
TOPDIR="`pwd`/$(dirname $0)" |
|
40 |
fi |
|
41 |
fi |
|
42 |
mkdir -p $TOPDIR/log |
|
43 |
||
44 |
# set the http and ftp proxies if you are behind a firewall |
|
45 |
# export http_proxy= |
|
46 |
# export ftp_proxy= |
|
47 |
||
48 |
if [ X$FLAGPREP = 'X1' ]; then |
|
49 |
CMD='prep' |
|
50 |
elif [ X$FLAGALL = 'X1' ]; then |
|
51 |
CMD='build' |
|
52 |
else |
|
53 |
CMD='build-only' |
|
54 |
fi |
|
55 |
||
56 |
if [ -z $1 ]; then |
|
57 |
SPECFILES="cmdassist.spec stardict.spec icu.spec idnkit.spec" |
|
58 |
else |
|
59 |
SPECFILES=$@ |
|
60 |
fi |
|
61 |
||
62 |
G11NDIR=$(dirname $0) |
|
63 |
for spec in $SPECFILES |
|
64 |
do |
|
65 |
case $spec in |
|
66 |
cmdassist.spec ) |
|
67 |
cd $G11NDIR |
|
68 |
cp cmdassist/COPYING cmdassist/cmdassist.copyright |
|
69 |
VERSION=`egrep "Version:" cmdassist/cmdassist.spec | awk '{print $2}'` |
|
70 |
mv cmdassist cmdassist-${VERSION} |
|
71 |
/usr/bin/tar cf - cmdassist-${VERSION} | /usr/bin/gzip > cmdassist-${VERSION}.tar.gz |
|
72 |
mv cmdassist-${VERSION}.tar.gz cmdassist-${VERSION}/ |
|
73 |
dir=cmdassist-${VERSION} |
|
74 |
;; |
|
75 |
icu.spec ) |
|
76 |
cd $G11NDIR/icu |
|
77 |
/usr/bin/tar cf - old_libs | /usr/bin/gzip > old_libs.tar.gz |
|
78 |
dir=icu |
|
79 |
;; |
|
80 |
idnkit.spec ) |
|
81 |
cd $G11NDIR/idn |
|
82 |
/usr/bin/tar cf - sunothers | /usr/bin/gzip > sunothers.tar.gz |
|
18 | 83 |
/usr/bin/tar cf - idnconv | /usr/bin/gzip > idnconv.tar.gz |
17 | 84 |
dir=idn |
85 |
;; |
|
86 |
* ) |
|
87 |
dir=${spec%.spec} |
|
88 |
;; |
|
89 |
esac |
|
90 |
||
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
|
91 |
SPECDIRS=$TOPDIR/$dir:$TOPDIR/include |
17 | 92 |
PATCHDIRS=$TOPDIR/$dir/patches |
93 |
SRCDIRS=$TOPDIR/$dir:$TOPDIR/SOURCES |
|
94 |
||
38
6b6eddc571c7
add --nonotify option to pkgbuild, broken X connection could make build failure
jenda
parents:
32
diff
changeset
|
95 |
PKGUNINSTALLARGS="uninstall-pkgs --nonotify --specdirs=$SPECDIRS" |
6b6eddc571c7
add --nonotify option to pkgbuild, broken X connection could make build failure
jenda
parents:
32
diff
changeset
|
96 |
PKGBUILDARGS="$CMD --nonotify --download --topdir=$TOPDIR --specdirs=$SPECDIRS " |
17 | 97 |
PKGBUILDARGS="$PKGBUILDARGS --sourcedirs=$SRCDIRS --patchdirs=$PATCHDIRS" |
98 |
PKGBUILDARGS="$PKGBUILDARGS --logdir=$TOPDIR/log" |
|
99 |
||
100 |
if [ $CMD = 'build' ]; then |
|
101 |
echo "pkgtool $PKGUNINSTALLARGS $spec" |
|
102 |
pkgtool $PKGUNINSTALLARGS $spec |
|
103 |
fi |
|
104 |
echo "pkgtool $PKGBUILDARGS $spec" |
|
105 |
pkgtool $PKGBUILDARGS $spec |
|
106 |
done |
|
107 |
||
108 |
# This is used for nightly build env |
|
109 |
if [ X$NOTCPFLAG = X ]; then |
|
110 |
( cd $TOPDIR/PKGS |
|
111 |
# rm -f *.bz2 |
|
112 |
for pkg in `find . -type d -name "SUNW*" | cut -c3-`; do |
|
113 |
tar cf - $pkg | bzip2 > $pkg.tar.bz2 |
|
114 |
done |
|
115 |
) |
|
116 |
fi |