/[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.6 - (show annotations) (download) (as text)
Sun Nov 18 12:02:01 2012 UTC (21 months, 4 weeks ago) by ago
Branch: MAIN
Changes since 1.5: +59 -26 lines
File MIME type: text/x-sh
new version of the script

(Portage version: 2.1.11.31/cvs/Linux x86_64, unsigned Manifest commit)

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="-q"
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 -binfilter branding cups dbus graphite gstreamer gtk nsplugin python vba webdav xmlsec -aqua -jemalloc -mysql -nlpsolver -odk -opengl -pdfimport -postgres -svg"
48
49 # now for the options
50 IUSES_J="java"
51 IUSES_NJ="-java"
52 IUSES_G="gnome eds"
53 IUSES_NG="-gnome -eds"
54 IUSES_K="kde"
55 IUSES_NK="-kde"
56
57 if [ -f /etc/portage/package.use ] ; then
58 die "Please save your package.use and make it as a directory"
59 fi
60
61 mkdir -p /etc/portage/package.use/
62
63 if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
64 die "Anything goes wrong"
65 fi
66
67 # compile the flavor
68 echo "Base"
69 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
70 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
71 quickpkg libreoffice --include-config=y
72 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed"
73
74 echo "Base - java"
75 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
76 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
77 quickpkg libreoffice --include-config=y
78 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed"
79
80 # kde flavor
81 echo "KDE"
82 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
83 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
84 quickpkg libreoffice --include-config=y
85 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
86
87 echo "KDE - java"
88 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
89 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
90 quickpkg libreoffice --include-config=y
91 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
92
93 # gnome flavor
94 echo "Gnome"
95 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
96 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
97 quickpkg libreoffice --include-config=y
98 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
99
100 echo "Gnome -java"
101 echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
102 CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
103 quickpkg libreoffice --include-config=y
104 mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
105
106
107 for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do
108
109 BN=`basename $name .tbz2`
110
111 rm -rf tmp.lo
112 mkdir -vp tmp.lo/p1 tmp.lo/p2
113 cd tmp.lo/p1
114
115 echo "Unpacking complete archive $BN.tbz2"
116 tar xfvjp ../../$BN.tbz2
117
118 echo "Moving debug info"
119 mkdir -vp ../p2/usr/lib
120 mv -v usr/lib/debug ../p2/usr/lib/
121
122 echo "Re-packing program"
123 tar cfvJ ../../$ARCH-bin-$BN.tar.xz --owner root --group root ./*
124
125 echo "Re-packing debug info"
126 cd ../p2
127 tar cfvJ ../../$ARCH-debug-$BN.tar.xz --owner root --group root ./*
128
129 echo "Removing unpacked files"
130 cd ../..
131 rm -rf tmp.lo
132
133 echo "Done with $BN.tbz2"
134
135 done
136
137 rm -fr ${USEFILE}
138
139 rm -fr libreoffice*${VERSION}*.tbz2

  ViewVC Help
Powered by ViewVC 1.1.20