-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate
executable file
·186 lines (139 loc) · 5.55 KB
/
generate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
#!/bin/bash
# important: you need to use the most general CFLAGS to build the packages:
# * for x86 : CFLAGS="-march=i586 -mtune=generic -O2 -pipe -g"
# * for amd64: CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -g"
# What you can set:
VERSION="24.2.7.2"
BINVERSION="24.2.7.2"
################################################
BASEDIR=/root/lo-bin-build
USEFILE="/etc/portage/package.use/libreo"
MYPKGDIR="$( portageq pkgdir )"
MYTMPDIR=$BASEDIR/tmp
MYDISTDIR=$BASEDIR/distfiles
################################################
OPTS="-v"
# bug 473974
export LC_MESSAGES=C
# make sure we're updated
/root/lo-bin-build/cleanup
die() {
echo "${1}"
exit 1
}
if [ "$( uname -m )" = "x86_64" ] ; then
ARCH="amd64"
elif [ "$( uname -m )" = "i686" ] ; then
ARCH="x86"
else
die "Arch $( uname -m ) not supported"
fi
# first the default subset of useflags
IUSES_BASE="branding cups dbus googledrive gstreamer mariadb odk -accessibility -base -bluetooth -coinmp -debug -firebird -gltf -gtk2 -jemalloc -ldap -pdfimport -postgres"
ENABLE_EXTENSIONS="presenter-console"
DISABLE_EXTENSIONS="nlpsolver scripting-beanshell scripting-javascript wiki-publisher"
for lo_xt in ${ENABLE_EXTENSIONS}; do
IUSES_BASE+=" libreoffice_extensions_${lo_xt}"
done
for lo_xt in ${DISABLE_EXTENSIONS}; do
IUSES_BASE+=" -libreoffice_extensions_${lo_xt}"
done
unset lo_xt
# now for the options
IUSES_J="-base java libreoffice_extensions_nlpsolver"
IUSES_NJ="-java -base"
IUSES_G="eds"
IUSES_NG="-eds"
IUSES_K="kde -gtk"
IUSES_NK="-kde gtk"
if [ -f /etc/portage/package.use ] ; then
die "Please save your package.use and re-create it as a directory"
fi
mkdir -p /etc/portage/package.use/ || die
mkdir -p "${MYPKGDIR}"
if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
die "Anything goes wrong"
fi
# compile the flavor
echo "Base"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-${BINVERSION}.tbz2 || die "Moving package failed"
if [ "$( uname -m )" = "x86_64" ] ; then
echo "Base - java"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-java-${BINVERSION}.tbz2 || die "Moving package failed"
fi
# kde flavor
echo "KDE"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
if [ "$( uname -m )" = "x86_64" ] ; then
echo "KDE - java"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
fi
# gnome flavor
echo "Gnome"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
if [ "$( uname -m )" = "x86_64" ] ; then
echo "Gnome -java"
echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
quickpkg libreoffice --include-config=y
mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ${MYTMPDIR}/libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
fi
cd ${MYTMPDIR}
for name in ./libreoffice*-${BINVERSION}.tbz2 ; do
BN=`basename $name .tbz2`
rm -rf tmp.lo
mkdir -vp tmp.lo/p1 tmp.lo/p2
cd tmp.lo/p1
echo "Unpacking complete archive $BN.tbz2"
tar xfvjp ../../$BN.tbz2
echo "Moving debug info"
mkdir -vp ../p2/usr/lib
mv -v usr/lib/debug ../p2/usr/lib/
echo "Re-packing program"
tar cfv ../../$ARCH-bin-$BN.tar --owner root --group root ./*
echo "Re-packing debug info"
cd ../p2
tar cfv ../../$ARCH-debug-$BN.tar --owner root --group root ./*
echo "Removing unpacked files"
cd ../..
rm -rf tmp.lo
echo "Removing original package file"
rm -f $BN.tbz2
echo "Done with $BN.tbz2"
done
cd ${MYTMPDIR}
for package in bin debug ; do
mysuffixes="kde gnome"
if [ "$( uname -m )" = "x86_64" ] ; then
mysuffixes="${mysuffixes} java kde-java gnome-java"
fi
for suffix in ${mysuffixes} ; do
echo "Generating binary diffs"
xdelta3 -s ${ARCH}-${package}-libreoffice-${BINVERSION}.tar ${ARCH}-${package}-libreoffice-${suffix}-${BINVERSION}.tar $ARCH-${package}-libreoffice-${suffix}-${BINVERSION}.xd3
rm ${ARCH}-${package}-libreoffice-${suffix}-${BINVERSION}.tar
mv -v $ARCH-${package}-libreoffice-${suffix}-${BINVERSION}.xd3 $MYDISTDIR
done
echo "Compressing base package"
xz -9 ${ARCH}-${package}-libreoffice-${BINVERSION}.tar
mv -v ${ARCH}-${package}-libreoffice-${BINVERSION}.tar.xz $MYDISTDIR
done
rm -f ${USEFILE} || die "Removing ${USEFILE} failed"
cd ${MYDISTDIR}
${BASEDIR}/manifest ${ARCH}-* > Manifest-${ARCH}.txt
emerge --info > Info-${ARCH}.txt
equery list '*' >> Info-${ARCH}.txt