libreoffice.SlackBuild 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. #!/bin/sh
  2. # Slackware build script for LibreOffice
  3. # Copyright 2015-2020 Hunter Sezen California, USA
  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. PRGNAM=libreoffice
  23. VERSION=${VERSION:-7.0.2.2}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_orb}
  26. if [ -z "$ARCH" ]; then
  27. case "$( uname -m )" in
  28. i?86) ARCH=i586 ;;
  29. arm*) ARCH=arm ;;
  30. *) ARCH=$( uname -m ) ;;
  31. esac
  32. fi
  33. CWD=$(pwd)
  34. TMP=${TMP:-/tmp/SBo}
  35. PKG=$TMP/package-$PRGNAM
  36. OUTPUT=${OUTPUT:-/tmp}
  37. if [ "$ARCH" = "i586" ]; then
  38. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  39. LIBDIRSUFFIX=""
  40. elif [ "$ARCH" = "i686" ]; then
  41. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  42. LIBDIRSUFFIX=""
  43. elif [ "$ARCH" = "x86_64" ]; then
  44. SLKCFLAGS="-O2 -fPIC"
  45. LIBDIRSUFFIX="64"
  46. else
  47. SLKCFLAGS="-O2"
  48. LIBDIRSUFFIX=""
  49. fi
  50. set -eu
  51. exists () {
  52. r=0; cwd="$(pwd)"
  53. while [ $# -gt 0 ]; do
  54. v=1; arg="$1"; shift
  55. case "$arg" in
  56. ''|*/ )
  57. :
  58. ;;
  59. /* )
  60. if [ -f "$arg" ] && [ -x "$arg" ]; then
  61. printf %s\\n "$arg"
  62. v=0
  63. fi
  64. ;;
  65. ./* )
  66. if [ -f "$arg" ] && [ -x "$arg" ]; then
  67. pre="$(cd -- "${arg%%/*}/" && pwd)"
  68. printf %s\\n "${pre%/}/$arg"
  69. v=0
  70. fi
  71. ;;
  72. */* )
  73. if [ -f "$arg" ] && [ -x "$arg" ]; then
  74. printf %s\\n "$(cd -- "${arg%%/*}/.." && pwd)/$arg"
  75. v=0
  76. fi
  77. ;;
  78. * )
  79. if [ -n "${PATH+x}" ]; then
  80. p=":${PATH:-$cwd}"
  81. while [ "$p" != "${p#*:}" ] && [ -n "${p#*:}" ]; do
  82. p="${p#*:}"; x="${p%%:*}"; z="${x:-$cwd}"; d="${z%/}/$arg"
  83. if [ -f "$d" ] && [ -x "$d" ]; then
  84. case "$d" in
  85. /* ) : ;;
  86. ./* ) pre="$(cd -- "${d%/*}/" && pwd)"; d="${pre%/}/$d" ;;
  87. * ) d="$(cd -- "${d%/*}/" && pwd)/$arg" ;;
  88. esac
  89. printf %s\\n "$d"
  90. v=0
  91. break
  92. fi
  93. done
  94. fi
  95. ;;
  96. esac
  97. [ $v = 0 ] || r=1
  98. done
  99. return $r
  100. }
  101. pkg () {
  102. case "$1" in
  103. -b )
  104. if exists "$2" >/dev/null 2>&1; then
  105. lib="${lib} $3"
  106. fi
  107. ;;
  108. -i )
  109. if [ -d "/usr/include/$2" ]; then
  110. lib="${lib} $3"
  111. fi
  112. ;;
  113. -l )
  114. if ldconfig -p | grep -q "$2"; then
  115. lib="${lib} $3"
  116. fi
  117. ;;
  118. -p )
  119. if pkg-config --exists "$2"; then
  120. lib="${lib} $3"
  121. fi
  122. ;;
  123. * )
  124. printf %s\\n "ERROR: option '$1' is unrecognized" >&2
  125. exit 1
  126. ;;
  127. esac
  128. }
  129. use () { case "$1" in "$2") : ;; *) lib="${lib} $3" ;; esac; }
  130. rm -rf $PKG
  131. mkdir -p $TMP $PKG $OUTPUT
  132. cd $TMP
  133. rm -rf $PRGNAM-$VERSION
  134. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  135. cd $PRGNAM-$VERSION
  136. [ ! -f $CWD/$PRGNAM-src-$VERSION.tar.xz ] ||
  137. tar xvf $CWD/$PRGNAM-src-$VERSION.tar.xz
  138. chown -R root:root .
  139. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} + \
  140. -o \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} +
  141. lib=
  142. case "${OPT:-0}" in
  143. 0 ) LO_PREFIX='/usr' ;;
  144. * ) LO_PREFIX="/opt/$PRGNAM" ;;
  145. esac
  146. case "${HELP:-0}" in
  147. 0 ) lib="${lib} --without-help" ;;
  148. html|online ) lib="${lib} --with-help=$HELP" ;;
  149. * ) lib="${lib} --with-help" ;;
  150. esac
  151. case "${LANGUAGES:=en-US}" in
  152. [aA][lL][lL] ) languages='ALL' ;;
  153. *[![:space:]]*|*[[:space:]]* ) languages="$LANGUAGES" ;;
  154. * ) languages= ;;
  155. esac
  156. theme=
  157. [ "${THEME:-}" ] && theme="--with-theme='$THEME'"
  158. case "${PYTHON:-1}" in
  159. no ) lib="${lib} --enable-python=no" ;;
  160. * )
  161. if pkg-config --exists python3; then
  162. lib="${lib} --enable-python=system"
  163. else
  164. lib="${lib} --enable-python=no"
  165. fi
  166. ;;
  167. esac
  168. if pkg-config --exists gstreamer-1.0; then
  169. use "${GSTREAMER1:-1}" 1 --disable-gstreamer-1-0
  170. else
  171. lib="${lib} --disable-gstreamer-1-0"
  172. fi
  173. # build the office development kit (ODK)
  174. if [ "${ODK:-0}" != 0 ]; then
  175. # generate the doxygen ODK C/C++ documentation
  176. DOXY="$(exists doxygen || :)"
  177. if [ "${DOXYGEN:-0}" != 0 ] && [ "${DOXY}" ]; then
  178. lib="${lib} --with-doxygen=$DOXY"
  179. else
  180. lib="${lib} --without-doxygen"
  181. fi
  182. else
  183. lib="${lib} --disable-odk"
  184. fi
  185. if [ "${DEBUG:=0}" != 0 ]; then
  186. SLKCFLAGS="$(printf %s "$SLKCFLAGS" | sed 's/-O2//')"
  187. case "$DEBUG" in
  188. dbg ) lib="${lib} --enable-dbgutil" ;;
  189. symbols ) lib="${lib} --enable-symbols" ;;
  190. * ) lib="${lib} --enable-debug" ;;
  191. esac
  192. fi
  193. case "${PCH:-0}" in
  194. yes|no|system|base|normal|full ) lib="${lib} --enable-pch=$PCH" ;;
  195. esac
  196. if [ "${JAVA_HOME:-}" ] && [ "${JAVA:-1}" = 1 ]; then
  197. lib="${lib} --with-jdk-home=\"\$JAVA_HOME\""
  198. else
  199. lib="${lib} --without-java"
  200. fi
  201. # enable experimental features
  202. use "${CHART:-0}" 0 --enable-chart-tests
  203. use "${ICECREAM:-0}" 0 --enable-icecream
  204. use "${MERGELIB:-0}" 0 --enable-mergelibs
  205. use "${VLC:-0}" 0 --enable-vlc
  206. # disable experimental features
  207. use "${AVMEDIA:-1}" 1 --disable-avmedia
  208. use "${EXTENSION:-1}" 1 --disable-extensions
  209. use "${DATABASE:-1}" 1 --disable-database-connectivity
  210. use "${LOADING:-1}" 1 --disable-dynamic-loading
  211. use "${OPENSSL:-1}" 1 --disable-openssl
  212. use "${SCRIPT:-1}" 1 --disable-scripting
  213. # enable features
  214. use "${AVAHI:-0}" 0 --enable-avahi
  215. use "${BREAKPAD:-0}" 0 --enable-breakpad
  216. use "${COMPILER:-0}" 0 --enable-compiler-plugins
  217. use "${CT2n:-0}" 0 --enable-ext-ct2n
  218. use "${DICT:-0}" 0 --with-myspell-dicts
  219. use "${EOT:-0}" 0 --enable-eot
  220. use "${EPM:-0}" 0 --with-epm
  221. use "${FORMULA:-0}" 0 --enable-formula-logger
  222. use "${FUZZERS-0}" 0 --enable-fuzzers
  223. use "${GTK3KDE5:-0}" 0 --enable-gtk3-kde5
  224. use "${KDE5:-0}" 0 --enable-kf5
  225. use "${LANGTOOL:-0}" 0 --enable-ext-languagetool
  226. use "${LTO:-0}" 0 --enable-lto
  227. use "${MPL:-0}" 0 --enable-mpl-subset
  228. use "${NLPSOLVER:-0}" 0 --enable-ext-nlpsolver
  229. use "${NUMBERTEXT:-0}" 0 --enable-ext-numbertext
  230. use "${QT:-0}" 0 --enable-qt5
  231. use "${SAL:-0}" 0 --enable-sal-log
  232. use "${VALGRIND:-0}" 0 --with-valgrind
  233. use "${WERROR:-0}" 0 --enable-werror
  234. use "${WIKI:-0}" 0 --enable-ext-wiki-publisher
  235. # disable features
  236. use "${CANVAS:-1}" 1 --disable-cairo-canvas
  237. use "${CCACHE:-1}" 1 --disable-ccache
  238. use "${CUPS:-1}" 1 --disable-cups
  239. use "${CVE:-1}" 1 --disable-cve-tests
  240. use "${COINMP:-1}" 1 --disable-coinmp
  241. use "${DCONF:-1}" 1 --disable-dconf
  242. use "${DBUS:-1}" 1 --disable-dbus
  243. use "${FIREBIRD:-1}" 1 --disable-firebird-sdbc
  244. use "${FONT:-1}" 1 --without-fonts
  245. use "${GIO:-1}" 1 --disable-gio
  246. use "${GTK3:-1}" 1 --disable-gtk3
  247. use "${GUI:-1}" 1 --disable-gui
  248. use "${LARGEFILE:-1}" 1 --disable-largefile
  249. use "${LDAP:-1}" 1 --disable-ldap
  250. use "${LIBNUMBER:-1}" 1 --disable-libnumbertext
  251. use "${LOTUSPRO:-1}" 1 --disable-lotuswordpro
  252. use "${LPSOLVE:-1}" 1 --disable-lpsolve
  253. use "${LXML:-1}" 1 --disable-lxml
  254. use "${NEON:-1}" 1 --disable-neon
  255. use "${OOENV:-1}" 1 --disable-ooenv
  256. use "${PDF:-1}" 1 --disable-pdfimport
  257. use "${PDFIUM:-1}" 1 --disable-pdfium
  258. use "${POPPLER:-1}" 1 --disable-poppler
  259. use "${POSTGRESQL:-1}" 1 --disable-postgresql-sdbc
  260. use "${RANDR:-1}" 1 --disable-randr
  261. use "${REPORT:-1}" 1 --disable-report-builder
  262. use "${RUNTIME:-1}" 1 --disable-runtime-optimizations
  263. use "${SDREMOTE:-1}" 1 --disable-sdremote
  264. use "${SKIA:-1}" 1 --disable-skia
  265. [ "${XORG:-1}" = 1 ] && lib="${lib} --with-x"
  266. if [ "${SYSTEM_LIBS:-1}" = 1 ]; then
  267. # dependencies included in slackware
  268. pkg -b bzip2 --with-system-bzip2
  269. pkg -b mysql --with-system-mariadb
  270. pkg -b ldapurl --with-system-openldap
  271. pkg -i boost --with-system-boost
  272. pkg -p apr-1 --with-system-apr
  273. pkg -p bluez --with-system-bluez
  274. pkg -p cairo --with-system-cairo
  275. pkg -p libclucene-core --with-system-clucene
  276. pkg -p libcurl --with-system-curl
  277. pkg -p epoxy --with-system-epoxy
  278. pkg -p expat --with-system-expat
  279. pkg -p graphite2 --with-system-graphite
  280. pkg -p harfbuzz --with-system-harfbuzz
  281. pkg -p hunspell --with-system-hunspell
  282. pkg -p icu-i18n --with-system-icu
  283. pkg -p lcms2 --with-system-lcms2
  284. pkg -p libodfgen-0.1 --with-system-libodfgen
  285. pkg -p libpng16 --with-system-libpng
  286. pkg -p librevenge-0.0 --with-system-librevenge
  287. pkg -p libvisio-0.1 --with-system-libvisio
  288. pkg -p libwpd-0.10 --with-system-libwpd
  289. pkg -p libwpg-0.3 --with-system-libwpg
  290. pkg -p libxml-2.0 --with-system-libxml
  291. pkg -p mozilla-nss --with-system-nss
  292. pkg -p neon --with-system-neon
  293. pkg -p libopenjp2 --with-system-jpeg
  294. pkg -p openssl --with-system-openssl
  295. pkg -p poppler --with-system-poppler
  296. pkg -p redland --with-system-redland
  297. pkg -p sane-backends --with-system-sane
  298. pkg -p zlib --with-system-zlib
  299. if [ "${SBO_LIBS:-1}" = 1 ]; then
  300. # dependencies found at SBo
  301. pkg -b lp_solve --with-system-lpsolve
  302. pkg -i glm --with-system-glm
  303. pkg -l libtommath.so.1 --with-system-libtommath
  304. pkg -p coinmp --with-system-coinmp
  305. pkg -p cppunit --with-system-cppunit
  306. pkg -p libabw-0.1 --with-system-libabw
  307. pkg -p atomic_ops --with-system-libatomic_ops
  308. pkg -p libcdr-0.1 --with-system-libcdr
  309. pkg -p libcmis-0.5 --with-system-libcmis
  310. pkg -p libe-book-0.1 --with-system-libebook
  311. pkg -p libeot --with-system-libeot
  312. pkg -p libepubgen-0.1 --with-system-libepubgen
  313. pkg -p libetonyek-0.1 --with-system-libetonyek
  314. pkg -p libexttextcat --with-system-libexttextcat
  315. pkg -p libfreehand-0.1 --with-system-libfreehand
  316. pkg -p liblangtag --with-system-liblangtag
  317. pkg -p libnumbertext --with-system-libnumbertext
  318. pkg -p libmspub-0.1 --with-system-libmspub
  319. pkg -p libmwaw-0.3 --with-system-libmwaw
  320. pkg -p libpagemaker-0.0 --with-system-libpagemaker
  321. pkg -p libqxp-0.0 --with-system-libqxp
  322. pkg -p libwps-0.4 --with-system-libwps
  323. pkg -p libzmf-0.0 --with-system-libzmf
  324. pkg -p mdds-1.5 --with-system-mdds
  325. pkg -p mythes --with-system-mythes
  326. pkg -p liborcus-0.16 --with-system-orcus
  327. pkg -p libpq --with-system-postgresql
  328. pkg -i qrcodegen --with-system-qrcodegen
  329. pkg -p serf-1 --with-system-serf
  330. pkg -p libstaroffice-0.0 --with-system-libstaroffice
  331. pkg -p libucpp --with-system-ucpp
  332. pkg -p xmlsec1-nss --with-system-xmlsec
  333. fi
  334. fi
  335. # check if $BUNDLE is used
  336. case "$lib" in
  337. *--with-system-mariadb* )
  338. use "${BUNDLE:-0}" 0 --enable-bundle-mariadb
  339. ;;
  340. esac
  341. # check if $CRASHDUMP is used
  342. case "$lib" in
  343. *--enable-breakpad* )
  344. use "${CRASHDUMP:-1}" 1 --disable-crashdump
  345. ;;
  346. esac
  347. case "$lib" in
  348. *--disable-gtk3* )
  349. :
  350. ;;
  351. * )
  352. if pkg-config --exists gtk+-3.0; then
  353. use "${INTROSPECTION:-0}" 0 --enable-introspection
  354. fi
  355. ;;
  356. esac
  357. # check if $SDRBLUETOOTH is used
  358. case "$lib" in
  359. *--disable-dbus*|*--disable-sdremote* )
  360. lib="${lib} --disable-sdremote-bluetooth"
  361. ;;
  362. * )
  363. use "${SDRBLUETOOTH:-1}" 1 --disable-sdremote-bluetooth
  364. ;;
  365. esac
  366. # check if $TLS or $SSL is used
  367. case "$lib" in *--disable-openssl* ) : ;; * )
  368. use "${SSL:-0}" 0 --enable-cipher-openssl-backend
  369. case "${TLS:-0}" in
  370. openssl|nss ) lib="${lib} --with-tls=$TLS" ;;
  371. esac
  372. esac
  373. # check which library to use for webdav
  374. webdav=
  375. if [ "${NEON:-1}" = 1 ]; then
  376. case "${WEB:-0}" in
  377. neon|serf ) webdav='--with-webdav=$WEB' ;;
  378. no ) webdav='--without-webdav' ;;
  379. esac
  380. fi
  381. # disable features if built with $MPL
  382. if [ "${MPL:-0}" != 0 ]; then
  383. lib="${lib} --disable-report-builder \
  384. --disable-postgresql-sdbc \
  385. --disable-lotuswordpro \
  386. --disable-lpsolve"
  387. theme='--with-theme=colibre'
  388. [ "$webdav" = '--without-webdav' ] || webdav='--with-webdav=serf'
  389. case "$lib" in
  390. *--with-system-poppler* ) : ;;
  391. * ) lib="${lib} --disable-pdfimport" ;;
  392. esac
  393. fi
  394. # prevent downloading of tarballs (adapted from lfs)
  395. SRC_DIR="$(pwd)/$PRGNAM-src-$VERSION"
  396. if [ -d "$SRC_DIR" ]; then
  397. ln -sf "$SRC_DIR" external/tarballs
  398. else
  399. mkdir -p external/tarballs
  400. fi
  401. for SRC in dictionaries help translations; do
  402. if [ -f $CWD/$PRGNAM-$SRC-$VERSION.tar.xz ]; then
  403. ln -sf $CWD/$PRGNAM-$SRC-$VERSION.tar.xz external/tarballs/
  404. fi
  405. done
  406. # these environment variables can break building libreoffice
  407. unset DISPLAY
  408. # Don't create the __pycache__ directory.
  409. export PYTHONDONTWRITEBYTECODE=1
  410. # Allow building as root.
  411. sed -i 's/check-if-root //' Makefile.in
  412. # Upgrade liborcus to 0.16.0.
  413. # https://gerrit.libreoffice.org/c/core/+/102502
  414. patch -p1 < $CWD/0001-Upgrade-liborcus-to-0.16.0.patch
  415. # Fix build
  416. sed -i '/libtool.patch.0/d' external/liborcus/UnpackedTarball_liborcus.mk
  417. # Set the configure variables to a portable array
  418. eval "set -- $lib"
  419. CFLAGS="$SLKCFLAGS" \
  420. CXXFLAGS="$SLKCFLAGS" \
  421. ./autogen.sh \
  422. --prefix=$LO_PREFIX \
  423. --bindir=/usr/bin \
  424. --libdir=$LO_PREFIX/lib${LIBDIRSUFFIX} \
  425. --sysconfdir=/etc \
  426. --mandir=/usr/man \
  427. --docdir=/usr/doc/$PRGNAM-$VERSION \
  428. --with-vendor=SlackBuilds \
  429. --with-lang="$(printf %s "$languages" | tr _ -)" \
  430. --enable-release-build \
  431. --without-krb5 \
  432. --without-gssapi \
  433. --without-system-dicts \
  434. --without-junit \
  435. --with-parallelism="${NUMJOBS:-1}" \
  436. --build=$ARCH-slackware-linux \
  437. $theme \
  438. $webdav \
  439. "$@"
  440. make build-nocheck
  441. make DESTDIR=$PKG distro-pack-install
  442. mkdir -p $PKG$LO_PREFIX/share/appdata
  443. cp sysui/desktop/appstream-appdata/*.xml $PKG$LO_PREFIX/share/appdata
  444. # don't need these (from alienbob)
  445. rm -f $PKG/gid_Module*
  446. for i in gnome locolor; do
  447. rm -rf $PKG$LO_PREFIX/share/icons/$i
  448. done
  449. # Replace redundant fonts with symlinks to save space (from alienbob)
  450. case "$lib" in
  451. *--without-fonts* )
  452. :
  453. ;;
  454. * )
  455. (
  456. cd $PKG$LO_PREFIX/lib${LIBDIRSUFFIX}/$PRGNAM/share/fonts/truetype
  457. for FONTS in DejaVu*.ttf Liberation*.ttf; do
  458. rm -f "$FONTS"
  459. ln -sf "/usr/share/fonts/TTF/$FONTS"
  460. done
  461. )
  462. ;;
  463. esac
  464. # Create aliases for locales that have matching languages in LibreOffice
  465. # This enables people with these locales to use the autocorrect function
  466. # Rewritten from Fedora's libreoffice.spec and alienBOB's SlackBuild
  467. ( cd $PKG$LO_PREFIX/lib${LIBDIRSUFFIX}/$PRGNAM/share/autocorr
  468. if [ "$languages" = '--with-lang=en-US' ] || [ -z "$languages" ]; then
  469. # en-ZA exists and has a good autocorrect file with two or three extras
  470. # that make sense for neighbouring english speaking territories
  471. rm -f acor_[a-df-z]*.dat acor_e[su]*.dat
  472. code='en-GB en-US en-ZA'
  473. else
  474. [ -f acor_lt_LT.dat ] && mv acor_lt_LT.dat acor_lt-LT.dat
  475. code='en-GB en-US en-ZA af-ZA de-DE es-ES fr-FR it-IT nl-BE sw-SE'
  476. fi
  477. eval "set -- $code"
  478. for lang do
  479. case "$lang" in
  480. en-GB) alias='AG AU BS BW BZ CA DK GH HK IE IN JM NG NZ SG TT' ;;
  481. en-US) alias=PH ;;
  482. en-ZA) alias='NA ZW' ;;
  483. af-ZA) alias=NA ;;
  484. de-DE) alias='AT BE CH LI LU' ;;
  485. es-ES) alias='AR BO CL CO CR CU DO EC GT HN MX NI PA PE PR PY SV US UY VE' ;;
  486. fr-FR) alias='BE CA CH LU MC' ;;
  487. it-IT) alias=CH ;;
  488. nl-BE) alias=AW ;;
  489. sv-SE) alias=FI ;;
  490. *) alias= ;;
  491. esac
  492. eval "set -- $alias"
  493. for link do
  494. ln -sf "acor_$lang.dat" "acor_${lang%-*}-$link.dat"
  495. done
  496. done )
  497. if [ $DEBUG = 0 ]; then
  498. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" |
  499. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  500. fi
  501. # if installed in /opt or some other location (from lfs)
  502. if [ "$LO_PREFIX" != /usr ]; then
  503. # Icons
  504. mkdir -p $PKG/usr/share/pixmaps
  505. (
  506. cd $PKG/usr/share/pixmaps
  507. for i in ../../..$LO_PREFIX/share/icons/hicolor/32x32/apps/*; do
  508. ln -sf "$i"
  509. done
  510. )
  511. # Desktop menu entries
  512. mkdir -p $PKG/usr/share/applications
  513. (
  514. cd $PKG/usr/share/applications
  515. for i in ../../..$LO_PREFIX/lib${LIBDIRSUFFIX}/$PRGNAM/share/xdg/*; do
  516. ln -sf "$i" "$PRGNAM-$(basename "$i")"
  517. done
  518. )
  519. fi
  520. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  521. cp -a COPYING* ChangeLog README.* $PKG/usr/doc/$PRGNAM-$VERSION
  522. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  523. mkdir -p $PKG/install
  524. cat $CWD/slack-desc > $PKG/install/slack-desc
  525. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  526. cd $PKG
  527. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}