/[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.5 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 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.3.2"
9BINVERSION="3.6.3.2"
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.5.3" 20if [ "$( uname -m )" = "x86_64" ] ; then
14BINVERSION="3.5.5.3" 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
15 45
16# first the default subset of useflags 46# 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" 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
18 59
19# now for the options 60# now for the options
20IUSES_J="java" 61IUSES_J="java libreoffice_extensions_nlpsolver"
21IUSES_NJ="-java" 62IUSES_NJ="-java"
22IUSES_G="gnome eds" 63IUSES_G="gnome eds"
23IUSES_NG="-gnome -eds" 64IUSES_NG="-gnome -eds"
24IUSES_K="kde" 65IUSES_K="kde"
25IUSES_NK="-kde" 66IUSES_NK="-kde"
26 67
27if [ -f /etc/portage/package.use ] ; then 68if [ -f /etc/portage/package.use ] ; then
28 echo "Please save your package.use and make it as a directory" 69 die "Please save your package.use and make it as a directory"
29 exit 1
30fi 70fi
31 71
32mkdir -p /etc/portage/package.use/ 72mkdir -p /etc/portage/package.use/
33 73
34OPTS="-v" 74if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
35 75 die "Anything goes wrong"
36MYPKGDIR="$( emerge --info | grep PKGDIR | sed "s:PKGDIR=::;s:\"::g" )" 76fi
37 77
38# compile the flavor 78# compile the flavor
39echo "Base" 79echo "Base"
40echo "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}
41emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 81CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
42quickpkg libreoffice --include-config=y 82quickpkg libreoffice --include-config=y
43mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed" 83mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed"
44 84
45echo "Base - java" 85echo "Base - java"
46echo "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}
47emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 87CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
48quickpkg libreoffice --include-config=y 88quickpkg libreoffice --include-config=y
49mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed" 89mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed"
50 90
51# kde flavor 91# kde flavor
52echo "KDE" 92echo "KDE"
53echo "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}
54emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 94CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
55quickpkg libreoffice --include-config=y 95quickpkg libreoffice --include-config=y
56mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed" 96mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
57 97
58echo "KDE - java" 98echo "KDE - java"
59echo "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}
60emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 100CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
61quickpkg libreoffice --include-config=y 101quickpkg libreoffice --include-config=y
62mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed" 102mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
63 103
64# gnome flavor 104# gnome flavor
65echo "Gnome" 105echo "Gnome"
66echo "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}
67emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 107CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
68quickpkg libreoffice --include-config=y 108quickpkg libreoffice --include-config=y
69mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed" 109mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
70 110
71echo "Gnome -java" 111echo "Gnome -java"
72echo "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}
73emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 113CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
74quickpkg libreoffice --include-config=y 114quickpkg libreoffice --include-config=y
75mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed" 115mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
76 116
77 117
78for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do 118for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do
89 echo "Moving debug info" 129 echo "Moving debug info"
90 mkdir -vp ../p2/usr/lib 130 mkdir -vp ../p2/usr/lib
91 mv -v usr/lib/debug ../p2/usr/lib/ 131 mv -v usr/lib/debug ../p2/usr/lib/
92 132
93 echo "Re-packing program" 133 echo "Re-packing program"
94 tar cfvJ ../../bin-$BN.tar.xz --owner root --group root ./* 134 tar cfvJ ../../$ARCH-bin-$BN.tar.xz --owner root --group root ./*
95 135
96 echo "Re-packing debug info" 136 echo "Re-packing debug info"
97 cd ../p2 137 cd ../p2
98 tar cfvJ ../../debug-$BN.tar.xz --owner root --group root ./* 138 tar cfvJ ../../$ARCH-debug-$BN.tar.xz --owner root --group root ./*
99 139
100 echo "Removing unpacked files" 140 echo "Removing unpacked files"
101 cd ../.. 141 cd ../..
102 rm -rf tmp.lo 142 rm -rf tmp.lo
103 143
104 echo "Done with $BN.tbz2" 144 echo "Done with $BN.tbz2"
105 145
106done 146done
147
148rm -fr ${USEFILE}
149
150rm -fr libreoffice*${VERSION}*.tbz2

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

  ViewVC Help
Powered by ViewVC 1.1.20