specs/build-im.sh
author mkaz
Sat, 27 Aug 2011 04:34:21 +0900
changeset 706 ca594d31f781
parent 703 404e61d9e7bd
permissions -rwxr-xr-x
SCIM obsolete S11 B174. 7082699 SCIM component packages are needed to obsolete from S11
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
109
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
     1
#!/bin/bash
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
     2
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
     3
# Build IM pkgs
672
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
     4
usage="$(basename $0) [-d <topdir>] [-l <logdir>] [-p] [-b] [-n] [spec files...]"
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
     5
usage="$usage\nDefault build type is 'build-only'"
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
     6
usage="$usage\n    -d <topdir>: specify another top dir."
672
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
     7
usage="$usage\n    -l <logdir>: specify another dir for build logs."
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
     8
usage="$usage\n    -p         : source prep only."
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
     9
usage="$usage\n    -a         : uninstall/build/install."
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    10
usage="$usage\n    -n         : NOT compress/copy to $HOME/packages\n"
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    11
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
    12
date
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
    13
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
    14
IPS_VENDORVER=0.${L10N_BUILDNUM:-"155"}
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
    15
PUBLISHER=${L10N_PUBLISHER:-"l10n-nightly"}
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    16
673
7bf478b90d70 Desktop CBE is no longer needed for compilation
jenda
parents: 672
diff changeset
    17
export LC_ALL=C
678
279d4856c549 $CC and $CXX must be set, otherwise some configure scripts select gcc (if installed) as defatult compiler
jenda
parents: 674
diff changeset
    18
export MAKE=${MAKE:-gmake}
279d4856c549 $CC and $CXX must be set, otherwise some configure scripts select gcc (if installed) as defatult compiler
jenda
parents: 674
diff changeset
    19
export CC=${CC:-/opt/SUNWspro/bin/cc}
279d4856c549 $CC and $CXX must be set, otherwise some configure scripts select gcc (if installed) as defatult compiler
jenda
parents: 674
diff changeset
    20
export CXX=${CXX:-/opt/SUNWspro/bin/CC}
109
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
    21
674
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    22
#
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    23
# libtool swallows -norunpath option in $(CXXLINK) cmd
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    24
# add -norunpath in $CXX env value
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    25
# more details:
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    26
#   http://monaco.sfbay.sun.com/detail.jsf?cr=6497744
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    27
#   http://mail.opensolaris.org/pipermail/jds-notify/2007-April/001799.html
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    28
#
678
279d4856c549 $CC and $CXX must be set, otherwise some configure scripts select gcc (if installed) as defatult compiler
jenda
parents: 674
diff changeset
    29
export CXX="$CXX -norunpath"
674
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    30
50d325a97b6d set CXX in build-im.sh, otherwise export CXX="$CXX -norunpath" line in spec files fails to set correct $CXX
jenda
parents: 673
diff changeset
    31
672
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    32
while getopts pad:l:n option
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    33
do
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    34
    case $option in
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    35
        p)  FLAGPREP=1;;
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    36
        a)  FLAGALL=1;;
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    37
        d)  TOPDIR="$OPTARG";;
672
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    38
        l)  LOGDIR="$OPTARG";;
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    39
        n)  NOTCPFLAG=1;;
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    40
        ?)  printf "$usage" ; exit ;;
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    41
    esac
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    42
done
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    43
shift $(expr $OPTIND - 1)
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    44
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    45
if [ X$TOPDIR = X ]; then
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    46
    if echo $0 | egrep -s '^/'; then
637
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
    47
        TOPDIR=$(dirname $0)
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    48
    else
637
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
    49
        TOPDIR="`pwd`/$(dirname $0)"
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    50
    fi
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    51
fi
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    52
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    53
MACH="${MACH:-`uname -p`}"
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    54
BLDDIR="$TOPDIR/build.$MACH"
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    55
672
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    56
if [ X$LOGDIR = X ]; then
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    57
    LOGDIR="$BLDDIR/log"
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    58
fi
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    59
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    60
mkdir -p "$LOGDIR"
b638b2a52a6f add '-l logdir' to build-g11n-spec.sh - used in jffmake to put logs directly to NFS work dir
jenda
parents: 662
diff changeset
    61
109
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
    62
# set the http and ftp proxies if you are behind a firewall
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
    63
# export http_proxy=
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    64
# export ftp_proxy=
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    65
637
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
    66
SPECDIRS=include
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
    67
PATCHDIRS=patches
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
    68
SRCDIRS=ext-sources
109
32b33798239f Added the build script build-im.sh for the spec files.
yongsun@agc130
parents:
diff changeset
    69
200
fbcf66be94be Refined the build-im.sh, spec files and copyright files.
yongsun@localhost
parents: 146
diff changeset
    70
if [ -z $1 ]; then
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    71
    # spec files. ordering due to dependency.
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    72
    LIBSPECS="libanthy.spec libhangul.spec libchewing.spec libdatrie.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    73
    LIBSPECS="$LIBSPECS libthai.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    74
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    75
    IIIMSPECS="iiim-hangul.spec iiim-thai.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    76
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    77
    M17NSPECS="m17n-lib-core.spec m17n-db.spec m17n-im-config.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    78
    M17NSPECS="$M17NSPECS m17n-contrib.spec" 
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    79
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    80
    IBUSSPECS="gob2.spec ibus.spec ibus-anthy.spec ibus-m17n.spec" 
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    81
    IBUSSPECS="$IBUSSPECS ibus-chewing.spec ibus-pinyin.spec ibus-hangul.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    82
    IBUSSPECS="$IBUSSPECS ibus-sunpinyin.spec ibus-table.spec"
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    83
    IBUSSPECS="$IBUSSPECS ibus-table-extraphrase.spec ibus-table-data.spec"
662
c50b4552c88b Add ibus-sayura.spec
yukie_es
parents: 661
diff changeset
    84
    IBUSSPECS="$IBUSSPECS ibus-xkbc.spec ibus-sayura.spec imf-selector.spec"
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    85
706
ca594d31f781 SCIM obsolete S11 B174. 7082699 SCIM component packages are needed to obsolete from S11
mkaz
parents: 703
diff changeset
    86
    SPECFILES="$LIBSPECS $IIIMSPECS $M17NSPECS $IBUSSPECS"
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    87
200
fbcf66be94be Refined the build-im.sh, spec files and copyright files.
yongsun@localhost
parents: 146
diff changeset
    88
else
fbcf66be94be Refined the build-im.sh, spec files and copyright files.
yongsun@localhost
parents: 146
diff changeset
    89
    SPECFILES=$@
fbcf66be94be Refined the build-im.sh, spec files and copyright files.
yongsun@localhost
parents: 146
diff changeset
    90
fi
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    91
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    92
if [ X$FLAGPREP = 'X1' ]; then
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    93
    CMD='prep'
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    94
elif [ X$FLAGALL = 'X1' ]; then
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
    95
    CMD='build'
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    96
else
470
6499c89e66ac Revise build script to align nightly build environment.
mkaz
parents: 469
diff changeset
    97
    CMD='build-only'
469
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    98
fi
8f135e6cca57 Update for ibus1.2
mkaz
parents: 457
diff changeset
    99
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   100
703
404e61d9e7bd pkgbuild upgrade to 1.3.104 snapshot July 2011
asano
parents: 678
diff changeset
   101
PKGBUILDARGS="-v --halt-on-errors --nonotify --download --topdir=$BLDDIR --spec=$SPECDIRS --src=$SRCDIRS --patchdirs=$PATCHDIRS --log=$LOGDIR --pkgformat=ips --nosourcepkg"
648
92cf0d090fca specs/build-im.sh tries to search sources in $DOWNLOADS dir if set
jenda
parents: 646
diff changeset
   102
652
bdd0d0363f53 fix nightly fail to find iiimf-ko-hangul and iiimf-th-thaile sources
jenda
parents: 651
diff changeset
   103
[[ -z "$DOWNLOADS" ]] || PKGBUILDARGS+=" --tar=$BLDDIR/SOURCES:$DOWNLOADS"
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   104
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   105
# Explicitly specifying location to enable to use pkgtool (pkgbuild)
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   106
# not yet in jdsbld.
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   107
PKGTOOL="/opt/pkgbuild/bin/pkgtool"
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   108
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   109
# IPS repos are created in $PKGDEST if defined in environment,
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   110
# otherwise in $BLDDIR (inputmethod/specs/build.$MACH).
646
531951368dc8 fix $PKGDEST handling in specs/build-im.sh
jenda
parents: 644
diff changeset
   111
IPS_REPODIR="${PKGDEST:-$BLDDIR}/repo.imspec"
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   112
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   113
export PKGBUILD_IPS_SERVER="file://$IPS_REPODIR/"
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   114
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   115
rm -rf "$IPS_REPODIR"
703
404e61d9e7bd pkgbuild upgrade to 1.3.104 snapshot July 2011
asano
parents: 678
diff changeset
   116
pkgrepo create "$PKGBUILD_IPS_SERVER"
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   117
pkgrepo set -s "$PKGBUILD_IPS_SERVER" publisher/prefix=${PUBLISHER}
119
3936e954b635 Added --specfiles in the pkgtool command line.
yongsun
parents: 109
diff changeset
   118
637
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
   119
if [ $CMD = 'build' ]; then
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
   120
	echo "pkgtool uninstall-pkgs $PKGBUILDARGS $SPECFILES"
641
3b018ff662e1 specs/build-im.sh: fix wrong run path of pkgbuild
jenda
parents: 637
diff changeset
   121
	(cd $TOPDIR; pkgtool uninstall-pkgs $PKGBUILDARGS $SPECFILES)
637
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
   122
fi
a5c2fd554d56 allow simultaneous builds - pkgbuild used shared buildroot in /var/tmp/
jenda
parents: 633
diff changeset
   123
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   124
echo "$PKGTOOL $CMD $PKGBUILDARGS --define \"ipsvendorver $IPS_VENDORVER\" --define '_tmppath %{_topdir}/TMP' $SPECFILES"
661
af03228e30b8 specs/build-im.sh returns error exit code if build fails
jenda
parents: 652
diff changeset
   125
af03228e30b8 specs/build-im.sh returns error exit code if build fails
jenda
parents: 652
diff changeset
   126
cd $TOPDIR
af03228e30b8 specs/build-im.sh returns error exit code if build fails
jenda
parents: 652
diff changeset
   127
$PKGTOOL $CMD $PKGBUILDARGS --define "ipsvendorver $IPS_VENDORVER" --define '_tmppath %{_topdir}/TMP' $SPECFILES || exit 1
130
c57d7ac7c476 Archive the packages in ~/packages/PKGS.
yongsun
parents: 128
diff changeset
   128
644
ac20c6f6e2cc IPS transition (inputmethod/specs part)
asano
parents: 641
diff changeset
   129
date