allencch

openoffice-bin AUR

Jul 25th, 2013
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.70 KB | None | 0 0
  1. # Maintainer: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de>
  2. _lang='en-US'
  3.  
  4. # Source directories containing the RPMs to install
  5. _source_dirs=( "${_lang}/RPMS" )
  6.  
  7. # Install path components as found in RPMs
  8. _install_prefix='opt'
  9. _install_name='openoffice.org4'
  10. _install_path=${_install_prefix}/${_install_name}
  11.  
  12. pkgname=openoffice-base-bin
  13. pkgver=4.0.0
  14. pkgrel=1
  15. pkgdesc="OpenOffice - Repackaged from upstream"
  16. arch=('i686' 'x86_64')
  17. url="http://www.openoffice.org/"
  18. license=('Apache') # see below
  19. # Some depends can be found in the README, some with namcap, some with _extract_depends() below
  20. depends=(
  21.     'freetype2'
  22.     'glibc>=2.5'
  23.     'gtk2>=2.10.4'
  24.     'hicolor-icon-theme'
  25.     'desktop-file-utils' 'shared-mime-info' # install script
  26. )
  27. makedepends=(
  28.     'rpmextract'
  29. )
  30. optdepends=(
  31.     'apr-util:           adds apr support'
  32.     'java-environment:   adds java support'
  33.     'gconf:              adds additional gnome support'
  34.     'gstreamer0.10-base: + some gstr-plugins to support multimedia content, e.g. in impress'
  35. #   'libgail-gnome:      GNOME Assistive Technology'
  36.     'mesa:               for the OGLTrans extension of impress'
  37.     'mime-types:         provides /etc/mime.types'
  38.     'nss:                adds support for signed files/macros'
  39.     'openoffice-de-bin:  adds additional language pack (example)'
  40.     'python2:            adds python support'
  41.     'raptor1:            adds rdf support'
  42.     'sqlite:             adds sqlite support'
  43. )
  44. conflicts=( 'openoffice-base-bin-unstable' )
  45. backup=( ${_install_path}/program/sofficerc )
  46. options=(!strip docs)
  47. install=openoffice-bin.install
  48. # AUR is tricky
  49. source=( "http://downloads.sourceforge.net/project/openofficeorg.mirror/${pkgver}/binaries/${_lang}/" )
  50. sha256sums=( '0000000000000000000000000000000000000000' )
  51.  
  52. case "$CARCH"
  53. in i686 )
  54.     source[0]+="http://downloads.sourceforge.net/project/openofficeorg.mirror/${pkgver}/binaries/${_lang}/Apache_OpenOffice_${pkgver}_Linux_x86_install-rpm_${_lang}.tar.gz"
  55.     sha256sums[0]='18668a4a42bc0531f98630f54d07f80cb27341a3e76efde490d60b3b584ee1a9'
  56. ;; x86_64 )
  57.     source[0]+="Apache_OpenOffice_${pkgver}_Linux_x86-64_install-rpm_${_lang}.tar.gz"
  58.     sha256sums[0]='4d519292afee0e9858e4b352d8398348e920d364e990ed9b6586ba9f4eeda54c'
  59. esac
  60.  
  61. _find_rpms() {
  62.     local dir file
  63.     for dir in "${_source_dirs[@]}"; do
  64.         dir=${srcdir:-src}/${dir}
  65.         ( cd "${dir}" ) # check existing
  66.         for file in $( find "${dir}" -type f -name '*.rpm' ); do
  67.             if ! [[ $file == */desktop-integration/* && $file != *-freedesktop-menus-* ]] &&
  68.                ! [[ $file == */jre-* ]]; then
  69.                 echo "${file}"
  70.             elif type -p msg2 >/dev/null; then
  71.                 msg2 "Skipping ${file##*/}" >&2
  72.             else
  73.                 echo "Skipping ${file##*/}" >&2
  74.             fi
  75.         done
  76.     done
  77. }
  78.  
  79. _ln_s_t() {
  80.     local dir=$1 prefix=$2
  81.     shift 2
  82.     mkdir -p "$dir"
  83.     local file
  84.     for file in "${@}"; do
  85.         readlink -v -e "${file}" >/dev/null # check existing
  86.         ln -s -T /"${file}" "${dir}/${prefix}${file##*/}"
  87.     done
  88. }
  89.  
  90. package() {
  91.     cd "${pkgdir}"
  92.     # unpack RPMs
  93.     local file
  94.     for file in $( _find_rpms ); do
  95.         msg2 "Extracting ${file##*/}"
  96.         rpmextract.sh "${file}"
  97.     done
  98.     msg2 "Completing package"
  99.     # remove symlink to avoid conflict with libreoffice-common 3.5.2-1
  100.     # (not used in the desktop files)
  101.     [[ -h usr/bin/soffice ]] && rm -f usr/bin/soffice
  102.     # add licenses (found by find pkg -ipath '*license*')
  103.     ##_ln_s_t usr/share/licenses/${pkgname} '' \
  104.     ##  ${_install_path}/program/LICENSE
  105.     # Fix python shebang calls
  106.     sed -i -re "1s;^#! *(/usr(/local)?)?/bin/(env +)?python(2[^ ]*)?( |$);#!/usr/bin/env python2 ;" $(
  107.         find opt/openoffice4/program/python-core-*/lib -type f -name '*.py'
  108.     )
  109. #   # link mozilla plugin
  110. #   _ln_s_t usr/lib/mozilla/plugins ${_install_name}- ${_install_path}/program/libnpsoplugin.so
  111. #   # link desktop files
  112. #   _ln_s_t usr/share/applications ${_install_name}- ${_install_path}/share/xdg/*.desktop
  113. #   # get desktop files to do something
  114. #   mkdir -p usr/bin
  115. #   install -m 755 -T <( cat <<EOF
  116. ##!/bin/bash
  117. #exec /${_install_path}/program/soffice "$@"
  118. #EOF
  119. #       ) usr/bin/${_install_name}
  120.  
  121.     msg  "Note: For checking the package, you may run: namcap -e elfpaths,emptydir ${pkgname}-${pkgver}-${pkgrel}-${CARCH}.pkg.tar.?z"
  122. }
  123.  
  124. ## Functions for manual usage
  125.  
  126. # makepkg -o && source PKGBUILD && _list_rpm_depends
  127. # Helper for finding external dependencies
  128. _list_rpm_depends() {
  129.     local file
  130.     for file in $( _find_rpms ); do
  131.         r=$( rpmmeta -t requirename "${file}" | sed -re 's;(ooobasis|ooo-dev|ooodev|openoffice|rpmlib)[^ ]*;;g' )
  132.         [[ $r ]] || continue
  133.         echo ${file##*/} $r
  134.     done
  135. }
  136.  
  137. # makepkg -o && source PKGBUILD && _find_license_files
  138. # Helper for finding license files
  139. _find_license_files() {
  140.     find pkg -ipath '*license*' -type f
  141. }
  142.  
  143. # makepkg -o && source PKGBUILD && _make_install_script >${install}.new
  144. # Helper for porting install scripts
  145. _make_install_script() {
  146.     cat <<EOF
  147. #!/bin/bash
  148.  
  149. # Inappropriate parts should be removed:
  150. # - mime.type stuff is already provided by mime-types package
  151. # - /etc/mailcap does not exist on ArchLinux normaly
  152. # - Don't use 'which' because tools are already in depends
  153.  
  154. EOF
  155.  
  156.     for args in 'prein pre_install' 'postin post_install' 'preun pre_remove' 'postun post_remove'; do
  157.         set -- $args
  158.         echo "$2() {"
  159.         echo "  local RPM_INSTALL_PREFIX='${_install_prefix}'"
  160.         echo
  161.         local file code
  162.         for file in $( _find_rpms ); do
  163.             code=$( rpmmeta -t $1 "${file}" )
  164.             [[ $code ]] || continue
  165.             echo "  ( ### ${file##*/} $1"
  166.             echo "$code"
  167.             echo "  )"
  168.             echo
  169.         done
  170.         echo "}"
  171.         echo
  172.     done
  173.  
  174. cat <<EOF
  175. ## arg 1:  the new package version
  176. ## arg 2:  the old package version
  177. pre_upgrade() {
  178.   pre_install "\$1"
  179. }
  180.  
  181. ## arg 1:  the new package version
  182. ## arg 2:  the old package version
  183. post_upgrade() {
  184.   post_install "\$1"
  185. }
  186.  
  187. # vim:set ts=2 sw=2 et:
  188. EOF
  189. }
Advertisement
Add Comment
Please, Sign In to add comment