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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20