/[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.6
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="-q"
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 -binfilter branding cups dbus graphite gstreamer gtk nsplugin python vba webdav xmlsec -aqua -jemalloc -mysql -nlpsolver -odk -opengl -pdfimport -postgres -svg"
18 48
19# now for the options 49# now for the options
20IUSES_J="java" 50IUSES_J="java"
21IUSES_NJ="-java" 51IUSES_NJ="-java"
22IUSES_G="gnome eds" 52IUSES_G="gnome eds"
23IUSES_NG="-gnome -eds" 53IUSES_NG="-gnome -eds"
24IUSES_K="kde" 54IUSES_K="kde"
25IUSES_NK="-kde" 55IUSES_NK="-kde"
26 56
27if [ -f /etc/portage/package.use ] ; then 57if [ -f /etc/portage/package.use ] ; then
28 echo "Please save your package.use and make it as a directory" 58 die "Please save your package.use and make it as a directory"
29 exit 1
30fi 59fi
31 60
32mkdir -p /etc/portage/package.use/ 61mkdir -p /etc/portage/package.use/
33 62
34OPTS="-v" 63if [ -z "${MYPKGDIR}" -o ! -d "${MYPKGDIR}" ] ; then
35 64 die "Anything goes wrong"
36MYPKGDIR="$( emerge --info | grep PKGDIR | sed "s:PKGDIR=::;s:\"::g" )" 65fi
37 66
38# compile the flavor 67# compile the flavor
39echo "Base" 68echo "Base"
40echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > /etc/portage/package.use/libreo 69echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
41emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 70CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
42quickpkg libreoffice --include-config=y 71quickpkg libreoffice --include-config=y
43mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed" 72mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-${BINVERSION}.tbz2 || die "Moving package failed"
44 73
45echo "Base - java" 74echo "Base - java"
46echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > /etc/portage/package.use/libreo 75echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_NK}" > ${USEFILE}
47emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 76CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
48quickpkg libreoffice --include-config=y 77quickpkg libreoffice --include-config=y
49mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed" 78mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-base-java-${BINVERSION}.tbz2 || die "Moving package failed"
50 79
51# kde flavor 80# kde flavor
52echo "KDE" 81echo "KDE"
53echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > /etc/portage/package.use/libreo 82echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
54emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 83CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
55quickpkg libreoffice --include-config=y 84quickpkg libreoffice --include-config=y
56mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed" 85mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-${BINVERSION}.tbz2 || die "Moving package failed"
57 86
58echo "KDE - java" 87echo "KDE - java"
59echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > /etc/portage/package.use/libreo 88echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_NG} ${IUSES_K}" > ${USEFILE}
60emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 89CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
61quickpkg libreoffice --include-config=y 90quickpkg libreoffice --include-config=y
62mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed" 91mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-kde-java-${BINVERSION}.tbz2 || die "Moving package failed"
63 92
64# gnome flavor 93# gnome flavor
65echo "Gnome" 94echo "Gnome"
66echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > /etc/portage/package.use/libreo 95echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_NJ} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
67emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 96CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
68quickpkg libreoffice --include-config=y 97quickpkg libreoffice --include-config=y
69mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed" 98mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-${BINVERSION}.tbz2 || die "Moving package failed"
70 99
71echo "Gnome -java" 100echo "Gnome -java"
72echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > /etc/portage/package.use/libreo 101echo "app-office/libreoffice ${IUSES_BASE} ${IUSES_J} ${IUSES_G} ${IUSES_NK}" > ${USEFILE}
73emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed" 102CFLAGS="${MYFLAGS}" CXXFLAGS="${MYFLAGS}" emerge ${OPTS} =libreoffice-${VERSION} || die "emerge failed"
74quickpkg libreoffice --include-config=y 103quickpkg libreoffice --include-config=y
75mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed" 104mv ${MYPKGDIR}/app-office/libreoffice-${VERSION}.tbz2 ./libreoffice-gnome-java-${BINVERSION}.tbz2 || die "Moving package failed"
76 105
77 106
78for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do 107for name in ./libreoffice-*-${BINVERSION}.tbz2 ; do
89 echo "Moving debug info" 118 echo "Moving debug info"
90 mkdir -vp ../p2/usr/lib 119 mkdir -vp ../p2/usr/lib
91 mv -v usr/lib/debug ../p2/usr/lib/ 120 mv -v usr/lib/debug ../p2/usr/lib/
92 121
93 echo "Re-packing program" 122 echo "Re-packing program"
94 tar cfvJ ../../bin-$BN.tar.xz --owner root --group root ./* 123 tar cfvJ ../../$ARCH-bin-$BN.tar.xz --owner root --group root ./*
95 124
96 echo "Re-packing debug info" 125 echo "Re-packing debug info"
97 cd ../p2 126 cd ../p2
98 tar cfvJ ../../debug-$BN.tar.xz --owner root --group root ./* 127 tar cfvJ ../../$ARCH-debug-$BN.tar.xz --owner root --group root ./*
99 128
100 echo "Removing unpacked files" 129 echo "Removing unpacked files"
101 cd ../.. 130 cd ../..
102 rm -rf tmp.lo 131 rm -rf tmp.lo
103 132
104 echo "Done with $BN.tbz2" 133 echo "Done with $BN.tbz2"
105 134
106done 135done
136
137rm -fr ${USEFILE}
138
139rm -fr libreoffice*${VERSION}*.tbz2

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

  ViewVC Help
Powered by ViewVC 1.1.20