/[gentoo-x86]/app-office/libreoffice/files/generate_libreoffice_package.sh
Gentoo

Contents of /app-office/libreoffice/files/generate_libreoffice_package.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (show annotations) (download) (as text)
Thu Dec 13 15:29:41 2012 UTC (2 years ago) by ago
Branch: MAIN
Changes since 1.10: +6 -6 lines
File MIME type: text/x-sh
Add splitdebug

(Portage version: 2.1.11.31/cvs/Linux i686, unsigned Manifest commit)

1 #!/bin/bash
2
3 # important: you need to use the most general CFLAGS to build the packages:
4 # * for x86 : CFLAGS="-march=i586 -mtune=generic -O2 -pipe -g"
5 # * for amd64: CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -g"
6
7 # What you can set:
8 VERSION="3.6.4.3"
9 BINVERSION="3.6.4.3"
10 OPTS="-v"
11 USEFILE="/etc/portage/package.use/libreo"
12 MYPKGDIR="$( portageq pkgdir )"
13 ################################################
14
15 die() {
16 echo "${1}"
17 exit 1
18 }
19
20 if [ "$( uname -m )" = "x86_64" ] ; then
21 MYFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -g"
22 ARCH="amd64"
23 elif [ "$( uname -m )" = "i686" ] ; then
24 MYFLAGS="-march=i586 -mtune=generic -O2 -pipe -g"
25 ARCH="x86"
26 else
27 die "Arch $( uname -m ) not supported"
28 fi
29
30 for i in \
31 "/bin/echo" \
32 "/bin/mkdir" \
33 "/bin/mv" \
34 "/bin/rm" \
35 "/bin/sed" \
36 "/bin/tar" \
37 "/usr/bin/emerge" \
38 "/usr/bin/portageq" \
39 "/usr/bin/quickpkg"
40 do
41 if [ ! -e "${i}" ] ; then
42 die "Missing some basic utility in your system"
43 fi
44 done
45
46 # first the default subset of useflags
47 IUSES_BASE="bash-completion branding cups dbus gstreamer gtk opengl vba webdav -aqua -binfilter -jemalloc -mysql -odk -postgres"
48
49 ENABLE_EXTENSIONS="presenter-console presenter-minimizer"
50 DISABLE_EXTENSIONS="nlpsolver pdfimport scripting-beanshell scripting-javascript wiki-publisher"
51
52 for lo_xt in ${ENABLE_EXTENSIONS}; do
53 IUSES_BASE+=" libreoffice_extensions_${lo_xt}"
54 done
55 for lo_xt in ${DISABLE_EXTENSIONS}; do
56 IUSES_BASE+=" -libreoffice_extensions_${lo_xt}"
57 done
58 unset lo_xt
59
60 # now for the options
61 IUSES_J="java libreoffice_extensions_nlpsolver"
62 IUSES_NJ="-java"
63 IUSES_G="gnome eds"
64 IUSES_NG="-gnome -eds"
65 IUSES_K="kde"
66 IUSES_NK="-kde"
67
68 if [ -f /etc/portage/package.use ] ; then
69 die "Please save your package.use and re-create it as a directory"
70 fi
71
72 mkdir -p /etc/portage/package.use/ || die
73
74 mkdir -p "${MYPKGDIR}"
75 if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
76 die "Anything goes wrong"
77 fi
78
79 # compile the flavor
80 echo "Base"
81 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
82 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
83 quickpkg libreoffice --include-config=y
84 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed"
85
86 echo "Base - java"
87 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
88 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
89 quickpkg libreoffice --include-config=y
90 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed"
91
92 # kde flavor
93 echo "KDE"
94 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
95 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
96 quickpkg libreoffice --include-config=y
97 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
98
99 echo "KDE - java"
100 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
101 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
102 quickpkg libreoffice --include-config=y
103 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
104
105 # gnome flavor
106 echo "Gnome"
107 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
108 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
109 quickpkg libreoffice --include-config=y
110 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
111
112 echo "Gnome -java"
113 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
114 FEATURES="${FEATURES} splitdebug" CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
115 quickpkg libreoffice --include-config=y
116 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
117
118
119 for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do
120
121 BN=`basename $name .tbz2`
122
123 rm -rf tmp.lo
124 mkdir -vp tmp.lo/p1 tmp.lo/p2
125 cd tmp.lo/p1
126
127 echo "Unpacking complete archive $BN.tbz2"
128 tar xfvjp ../../$BN.tbz2
129
130 echo "Moving debug info"
131 mkdir -vp ../p2/usr/lib
132 mv -v usr/lib/debug ../p2/usr/lib/
133
134 echo "Re-packing program"
135 tar cfvJ ../../$ARCH-bin-$BN.tar.xz --owner root --group root ./*
136
137 echo "Re-packing debug info"
138 cd ../p2
139 tar cfvJ ../../$ARCH-debug-$BN.tar.xz --owner root --group root ./*
140
141 echo "Removing unpacked files"
142 cd ../..
143 rm -rf tmp.lo
144
145 echo "Done with $BN.tbz2"
146
147 done
148
149 rm -f ${USEFILE} || die "Removing ${USEFILE} failed"
150
151 rm -f libreoffice*${VERSION}*.tbz2 || die "Removing un-split package files failed"

  ViewVC Help
Powered by ViewVC 1.1.20