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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20