Advertisement
Guest User

OpenOffice-fr PKGBUILD

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