/[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.8 - (show annotations) (download) (as text)
Tue Nov 20 21:40:51 2012 UTC (2 years ago) by dilfridge
Branch: MAIN
Changes since 1.7: +1 -1 lines
File MIME type: text/x-sh
Build verbose by default

(Portage version: 2.2.0_alpha142/cvs/Linux x86_64, signed Manifest commit with key B6C5F7DE)

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="3.6.3.2"
9 BINVERSION="3.6.3.2"
10 OPTS="-v"
11 USEFILE="/etc/portage/package.use/libreo"
12 MYPKGDIR="$( portageq pkgdir )"
13 ################################################
14
15 die() {
16 echo "${1}"
17 exit 1
18 }
19
20 if [ "$( uname -m )" = "x86_64" ] ; then
21 MYFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -g"
22 ARCH="amd64"
23 elif [ "$( uname -m )" = "i686" ] ; then
24 MYFLAGS="-march=i586 -mtune=generic -O2 -pipe -g"
25 ARCH="x86"
26 else
27 die "Arch not supported"
28 fi
29
30 for 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"
40 do
41 if [ ! -e "${i}" ] ; then
42 die "Missing something in your system"
43 fi
44 done
45
46 # first the default subset of useflags
47 IUSES_BASE="bash-completion branding cups dbus gstreamer gtk python vba webdav -aqua -binfilter -jemalloc -mysql -odk -opengl -postgres -svg"
48
49 ENABLE_EXTENSIONS="presenter-console presenter-minimizer"
50 DISABLE_EXTENSIONS="nlpsolver pdfimport scripting-beanshell scripting-javascript wiki-publisher"
51
52 for lo_xt in ${ENABLE_EXTENSIONS}; do
53 IUSES_BASE+=" libreoffice_extensions_${lo_xt}"
54 done
55 for lo_xt in ${DISABLE_EXTENSIONS}; do
56 IUSES_BASE+=" -libreoffice_extensions_${lo_xt}"
57 done
58 unset lo_xt
59
60 # now for the options
61 IUSES_J="java"
62 IUSES_NJ="-java"
63 IUSES_G="gnome eds"
64 IUSES_NG="-gnome -eds"
65 IUSES_K="kde"
66 IUSES_NK="-kde"
67
68 if [ -f /etc/portage/package.use ] ; then
69 die "Please save your package.use and make it as a directory"
70 fi
71
72 mkdir -p /etc/portage/package.use/
73
74 if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
75 die "Anything goes wrong"
76 fi
77
78 # compile the flavor
79 echo "Base"
80 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
81 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
82 quickpkg libreoffice --include-config=y
83 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed"
84
85 echo "Base - java"
86 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
87 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
88 quickpkg libreoffice --include-config=y
89 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed"
90
91 # kde flavor
92 echo "KDE"
93 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
94 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
95 quickpkg libreoffice --include-config=y
96 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
97
98 echo "KDE - java"
99 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
100 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
101 quickpkg libreoffice --include-config=y
102 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
103
104 # gnome flavor
105 echo "Gnome"
106 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
107 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
108 quickpkg libreoffice --include-config=y
109 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
110
111 echo "Gnome -java"
112 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
113 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
114 quickpkg libreoffice --include-config=y
115 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
116
117
118 for 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
146 done
147
148 rm -fr ${USEFILE}
149
150 rm -fr libreoffice*${VERSION}*.tbz2

  ViewVC Help
Powered by ViewVC 1.1.20