/[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.15 - (show annotations) (download) (as text)
Wed Oct 23 20:10:24 2013 UTC (11 months, 1 week ago) by dilfridge
Branch: MAIN
Changes since 1.14: +3 -3 lines
File MIME type: text/x-sh
Minor updates to build script

(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key EBE6A336BE19039C!)

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

  ViewVC Help
Powered by ViewVC 1.1.20