|
#!/bin/bash |
|
|
|
# Maintainer: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de> |
|
|
|
_lang='en-US' |
|
_arch='x86-64' |
|
|
|
# Source directories containing the RPMs to install |
|
_source_dirs=( "${_lang}/RPMS" ) |
|
|
|
# Install path components as found in RPMs |
|
_install_prefix='opt' |
|
_install_name='openoffice4' |
|
_install_path=${_install_prefix}/${_install_name} |
|
|
|
pkgname=openoffice |
|
pkgver=4.0.1 |
|
pkgrel=1 |
|
pkgdesc="OpenOffice - Repackaged from upstream" |
|
arch=('x86_64') |
|
url="http://www.openoffice.org/" |
|
license=('Apache') # see below |
|
# Some depends can be found in the README, some with namcap, some with _extract_depends() below |
|
depends=('freetype2' |
|
'glibc>=2.5' |
|
'gtk2>=2.10.4' |
|
'hicolor-icon-theme' |
|
'desktop-file-utils' 'shared-mime-info' # install script |
|
) |
|
makedepends=('rpmextract') |
|
optdepends=('apr-util: adds apr support' |
|
'java-environment: adds java support' |
|
'gconf: adds additional gnome support' |
|
'gstreamer0.10-base: + some gstr-plugins to support multimedia content, e.g. in impress' |
|
#'libgail-gnome: GNOME Assistive Technology' |
|
'mesa: for the OGLTrans extension of impress' |
|
'mime-types: provides /etc/mime.types' |
|
'nss: adds support for signed files/macros' |
|
'openoffice-de-bin: adds additional language pack (example)' |
|
'python2: adds python support' |
|
'raptor1: adds rdf support' |
|
'sqlite: adds sqlite support') |
|
backup=( extra/opt/openoffice4/program/sofficerc ) |
|
options=(!strip docs) |
|
source=( "http://sourceforge.net/projects/openofficeorg.mirror/files/${pkgver}/binaries/${_lang}/Apache_OpenOffice_${pkgver}_Linux_${_arch}_install-rpm_${_lang}.tar.gz" |
|
'openoffice4' |
|
'openoffice4-printeradmin') |
|
sha256sums=('c7abdb7e436e03c22a80e21df32a1964df5d9f8cc3d90f26801502506214ef83' |
|
'bc39874911bb05dc011f13eb34fd1f678fa25cdf4441a1b7523b8d8e57ecc1ab' |
|
'b3bc2b1d8605fef368b7eff56ddd3827e31f4903918f679e0e68873b7ff92f9d') |
|
install=openoffice.install |
|
|
|
|
|
_find_rpms() { |
|
local dir file |
|
for dir in "${_source_dirs[@]}"; do |
|
dir=${srcdir:-src}/${dir} |
|
( cd "${dir}" ) # check existing |
|
for file in $( find "${dir}" -type f -name '*.rpm' ); do |
|
if ! [[ $file == */desktop-integration/* && $file != *-freedesktop-menus-* ]] \ |
|
&& ! [[ $file == */jre-* ]] \ |
|
&& ! [[ $file == *-gnome-integration-* ]] ; then |
|
echo "${file}" |
|
elif type -p msg2 >/dev/null; then |
|
msg2 "Skipping ${file##*/}" >&2 |
|
else |
|
echo "Skipping ${file##*/}" >&2 |
|
fi |
|
done |
|
done |
|
} |
|
|
|
_ln_s_t() { |
|
local dir=$1 prefix=$2 |
|
shift 2 |
|
mkdir -p "$dir" |
|
local file |
|
for file in "${@}"; do |
|
readlink -v -e "${file}" >/dev/null # check existing |
|
ln -s -T /"${file}" "${dir}/${prefix}${file##*/}" |
|
done |
|
} |
|
|
|
package() { |
|
cd "${pkgdir}" |
|
# unpack RPMs |
|
local file |
|
for file in $( _find_rpms ); do |
|
msg2 "Extracting ${file##*/}" |
|
rpmextract.sh "${file}" |
|
done |
|
msg2 "Completing package" |
|
# remove symlink to avoid conflict with libreoffice-common 3.5.2-1 |
|
# (not used in the desktop files) |
|
[[ -h usr/bin/soffice ]] && rm -f usr/bin/soffice |
|
# add licenses (found by find pkg -ipath '*license*') |
|
_ln_s_t usr/share/licenses/${pkgname} '' \ |
|
${_install_path}/program/LICENSE |
|
# Fix python shebang calls |
|
sed -i -re "1s;^#! *(/usr(/local)?)?/bin/(env +)?python(2[^ ]*)?( |$);#!/usr/bin/env python2 ;" $( |
|
find opt/${_install_name}/program/python-core-2.7.5/lib -type f -name '*.py' |
|
) |
|
# # link mozilla plugin |
|
# _ln_s_t extra/usr/lib/mozilla/plugins ${_install_name}- ${_install_path}/program/libnpsoplugin.so |
|
# # link desktop files |
|
# _ln_s_t usr/share/applications ${_install_name}- ${_install_path}/share/xdg/*.desktop |
|
# # get desktop files to do something |
|
# mkdir -p usr/bin |
|
# install -m 755 -T <( cat <<EOF |
|
msg "Note: For checking the package, you may run: namcap -e elfpaths,emptydir ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.pkg.tar.?z" |
|
#[extra] complement - bad hack |
|
mkdir ${pkgdir}/extra |
|
cp -r ${pkgdir}/{opt,usr} ${pkgdir}/extra/ |
|
rm -rf ${pkgdir}/{opt,usr} |
|
rm ${pkgdir}/extra/usr/bin/* |
|
rm ${pkgdir}/extra/usr/share/applications/* |
|
install -Dm 644 ${pkgdir}/extra/opt/openoffice4/share/xdg/* ${pkgdir}/extra/usr/share/applications/ |
|
rm -rf ${pkgdir}/extra/opt/openoffice4/share/xdg/ |
|
install -Dm 755 ${srcdir}/openoffice4* ${pkgdir}/extra/usr/bin/ |
|
} |
|
|
|
## Functions for manual usage |
|
|
|
# makepkg -o && source PKGBUILD && _list_rpm_depends |
|
# Helper for finding external dependencies |
|
_list_rpm_depends() { |
|
local file |
|
for file in $( _find_rpms ); do |
|
r=$( rpmmeta -t requirename "${file}" | sed -re 's;(ooobasis|ooo-dev|ooodev|openoffice|rpmlib)[^ ]*;;g' ) |
|
[[ $r ]] || continue |
|
echo ${file##*/} $r |
|
done |
|
} |
|
|
|
# makepkg -o && source PKGBUILD && _find_license_files |
|
# Helper for finding license files |
|
_find_license_files() { |
|
find pkg -ipath '*license*' -type f |
|
} |
|
|
|
# makepkg -o && source PKGBUILD && _make_install_script >${install}.new |
|
# Helper for porting install scripts |
|
_make_install_script() { |
|
cat <<EOF |
|
#!/bin/bash |
|
|
|
# Inappropriate parts should be removed: |
|
# - mime.type stuff is already provided by mime-types package |
|
# - /etc/mailcap does not exist on ArchLinux normaly |
|
# - Don't use 'which' because tools are already in depends |
|
|
|
EOF |
|
|
|
for args in 'prein pre_install' 'postin post_install' 'preun pre_remove' 'postun post_remove'; do |
|
set -- $args |
|
echo "$2() {" |
|
echo " local RPM_INSTALL_PREFIX='${_install_prefix}'" |
|
echo |
|
local file code |
|
for file in $( _find_rpms ); do |
|
code=$( rpmmeta -t $1 "${file}" ) |
|
[[ $code ]] || continue |
|
echo " ( ### ${file##*/} $1" |
|
echo "$code" |
|
echo " )" |
|
echo |
|
done |
|
echo "}" |
|
echo |
|
done |
|
|
|
cat <<EOF |
|
## arg 1: the new package version |
|
## arg 2: the old package version |
|
pre_upgrade() { |
|
pre_install "\$1" |
|
} |
|
|
|
## arg 1: the new package version |
|
## arg 2: the old package version |
|
post_upgrade() { |
|
post_install "\$1" |
|
} |
|
|
|
# vim:set ts=2 sw=2 et: |
|
EOF |
|
} |