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

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.20