broffice.org.SlackBuild 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. #!/bin/bash
  2. # Slackware build script for OpenOffice.org
  3. # Copyright 2006,2007,2008,2009,2010 Robby Workman, Northport, Alabama, ASA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=broffice.org
  24. VERSION=${VERSION:-3.2.1}
  25. BUILD=${BUILD:-1}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. # Work just for pt-BR. Other languages must use the OpenOffice.org slackbuild.
  36. OOLANG="pt-BR" # Leave this alone
  37. PKG_LANG=$(echo $OOLANG | sed s/-/_/) # Leave this alone
  38. # Change source package name
  39. if [ "$ARCH" = "x86_64" ]; then
  40. SRCARCH="x86-64"
  41. PKGARCH="$ARCH"
  42. elif [ "$ARCH" = "arm" ]; then
  43. printf "\n$ARCH is unsupported for OOo...\n\n"
  44. exit 1
  45. else
  46. SRCARCH="x86"
  47. PKGARCH="i586"
  48. fi
  49. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  50. # the name of the created package would be, and then exit. This information
  51. # could be useful to other scripts.
  52. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  53. echo "$PRGNAM-${VERSION}_${PKG_LANG}-$PKGARCH-$BUILD$TAG.$PKGTYPE"
  54. exit 0
  55. fi
  56. TMP=${TMP:-/tmp/SBo}
  57. PKG=$TMP/package-$PRGNAM
  58. OUTPUT=${OUTPUT:-/tmp}
  59. # Some localized versions only ship with a bundled JRE, and we'd like this
  60. # script to work on those as well... More importantly, the non-jre tarballs
  61. # don't seem to hang around on the mirrors for the last two releases, so I'm
  62. # just going to use the jre-bundled tarballs.
  63. WJRE=${WJRE:-yes}
  64. # If you want to disable java support by removing executable permissions
  65. # form OOo's java loader (this will not affect other apps), set this
  66. # variable to "YES" Default is "NO"
  67. DISABLE_JAVA=${DISABLE_JAVA:-NO}
  68. # Ignore this - it's just to get the toplevel directory name of the
  69. # extracted tarball archive
  70. if [ $WJRE != no ]; then
  71. SOURCEDIR=$(tar tzf $CWD/BrOOo_${VERSION}_Linux_${SRCARCH}_install-rpm-wJRE_${OOLANG}.tar.gz 2>/dev/null | head -n 1 | tr -d \/)
  72. else
  73. SOURCEDIR=$(tar tzf $CWD/BrOOo_${VERSION}_Linux_${SRCARCH}_install-rpm_${OOLANG}.tar.gz 2>/dev/null | head -n 1 | tr -d \/)
  74. fi
  75. # If the above operation failed for some reason, unset SOURCEDIR so that
  76. # the "set -eu" below will cause us to bail out with an error
  77. [ -z $SOURCEDIR ] && unset SOURCEDIR
  78. set -eu
  79. rm -rf $PKG
  80. mkdir -p $TMP $PKG $OUTPUT
  81. rm -rf $TMP/$SOURCEDIR
  82. # Handle the tarballs that include a bundled JRE
  83. if [ $WJRE != no ]; then
  84. tar xvf $CWD/BrOOo_${VERSION}_Linux_${SRCARCH}_install-rpm-wJRE_${OOLANG}.tar.gz -C $TMP
  85. else
  86. tar xvf $CWD/BrOOo_${VERSION}_Linux_${SRCARCH}_install-rpm_${OOLANG}.tar.gz -C $TMP
  87. fi
  88. # We'll remove this regardless of whether we're using the jre tarball...
  89. rm -rf $TMP/$SOURCEDIR/{JavaSetup.jar,installdata,setup}
  90. rm -rf $TMP/$SOURCEDIR/RPMS/{userland,jre-*-linux-*.rpm}
  91. cd $TMP/$SOURCEDIR/RPMS/
  92. # Yes, I know there is a Slackware integration file in the desktop-integration
  93. # directory, but it's worthless to us. I'd prefer to do things correctly.
  94. mv desktop-integration/*-freedesktop-menus-*.rpm .
  95. # No, I don't want to update our packaged files after the fact
  96. rm -f *onlineupdate*.rpm # We don't want this
  97. for FILE in *.rpm ; do rpm2cpio < $FILE | cpio -imdv ; done
  98. rm -rf desktop-integration *.rpm
  99. mv opt usr $PKG
  100. cd $PKG
  101. # Kill a broken symlink
  102. rm -f $PKG/usr/share/applications/broffice.org3-startcenter.desktop
  103. # Create symlinks in /usr/bin to actual binaries
  104. cd $PKG/usr/bin
  105. for FILE in \
  106. sbase scalc sdraw simpress smath soffice spadmin swriter unopkg ; do
  107. rm -f $FILE
  108. ln -sf ../../opt/broffice.org3/program/$FILE $FILE ;
  109. done
  110. cd -
  111. # Remove DejaVu and Liberation fonts - these are included in other packages
  112. rm -f opt/openoffice.org/basis3.2/share/fonts/truetype/[DL]*.ttf
  113. # Fix Exec commands in the desktop files
  114. # See http://bugzilla.xfce.org/show_bug.cgi?id=2430
  115. cd $PKG/opt/broffice.org3/share/xdg/
  116. for APP in base calc draw impress math writer; do
  117. sed -i 's%Exec=broffice.org3 -%Exec=s%' $APP.desktop ;
  118. done
  119. cd -
  120. # Install extensions
  121. UNOPKG_BIN=$PKG/opt/broffice.org3/program/unopkg
  122. DICT_DIR=$PKG/opt/broffice.org3/share/extension/install
  123. if [ -x "$UNOPKG_BIN" ]; then
  124. UNOPKG_TMP=$TMP/$$$$$$
  125. find $DICT_DIR -type f -name "*.oxt" \
  126. -exec $UNOPKG_BIN add --shared {} \
  127. "-env:UserInstallation=file:///$UNOPKG_TMP" \;
  128. rm -rf $UNOPKG_TMP # Clean up after ourselves
  129. fi
  130. # Move docs to their expected locations
  131. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  132. cd $PKG/opt/broffice.org3
  133. mv README* *LICENSE* readmes licenses $PKG/usr/doc/$PRGNAM-$VERSION
  134. cd -
  135. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  136. # Disable Java support if desired (see above)
  137. if [ "$DISABLE_JAVA" = "YES" ]; then
  138. chmod -x $PKG/opt/openoffice.org/ure/bin/javaldx
  139. fi
  140. mkdir -p $PKG/install
  141. cat $CWD/slack-desc > $PKG/install/slack-desc
  142. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  143. # Fix ownership and permissions and make the package
  144. chown -R root:root .
  145. find . -type d -exec chmod 755 {} \;
  146. find -L . \
  147. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  148. -o -perm 511 \) -exec chmod 755 {} \; -o \
  149. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  150. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  151. /sbin/makepkg -c n -l y $OUTPUT/$PRGNAM-${VERSION}_${PKG_LANG}-$PKGARCH-$BUILD$TAG.$PKGTYPE