--- /dev/null
+# vim: syn=sh ft=sh et sw=2 sts=2 ts=2 tw=0:
+#Packager: Cyrille Pontvieux <jrd~at~salixos~dot~org>
+#Former Maintainer: Dimitris Tzemos <djemos~at~slackel~dot~gr>
+#execute this script with arch=i686 fakeroot slkbuild -X
+#to produce the i686 binary
+#fakeroot slkbuild -X produce the x86_64 package
+
+pkgname=libreoffice
+pkgver=4.4.0.3
+pkgrel=1cp
+arch=${arch:-x86_64}
+source=(
+ SLKBUILD.tpl
+ helps
+ langs
+ languages
+ Makefile
+ generate-SLKBUILD.py
+ "http://download.documentfoundation.org/libreoffice/src/$(echo $pkgver|cut -d. -f1-3)/${pkgname}-${pkgver}.tar.xz"
+ "http://download.documentfoundation.org/libreoffice/src/$(echo $pkgver|cut -d. -f1-3)/${pkgname}-translations-${pkgver}.tar.xz"
+ "http://download.documentfoundation.org/libreoffice/src/$(echo $pkgver|cut -d. -f1-3)/${pkgname}-dictionaries-${pkgver}.tar.xz"
+ "http://download.documentfoundation.org/libreoffice/src/$(echo $pkgver|cut -d. -f1-3)/${pkgname}-help-${pkgver}.tar.xz"
+)
+options=("noextract")
+url=http://www.libreoffice.org/
+multi=(
+__libreoffice_l10n_LANG__
+__libreoffice_help_LANG__
+)
+
+slackdesc=\
+(
+#|-----handy-ruler------------------------------------------------------|
+"$pkgname (free office suite)"
+"LibreOffice is an Open Source, community-developed, office"
+"productivity suite. It includes key desktop applications, such as a"
+"word processor, spreadsheet, presentation manager, formula editor and"
+"drawing program, with a user interface and feature set similar to"
+"other office suites. LibreOffice also works transparently with a"
+"variety of file formats, including Microsoft Office File Formats."
+)
+
+__libreoffice_l10n_LANG_slackdesc__
+
+__libreoffice_help_LANG_slackdesc__
+
+build() {
+ lang_list="__lang_list__"
+ dict_list=$(cat <<EOF
+__dict_list__
+EOF
+)
+ help_list="__help_list__"
+ cd $SRC
+ tar xf ${pkgname}-${pkgver}.tar.xz || return 1
+ mkdir -p ${pkgname}-${pkgver}/external/tarballs
+ (
+ cd ${pkgname}-${pkgver}/external/tarballs
+ ln -s -v ../../../${pkgname}-translations-${pkgver}.tar.xz .
+ ln -s -v ../../../${pkgname}-dictionaries-${pkgver}.tar.xz .
+ ln -s -v ../../../${pkgname}-help-${pkgver}.tar.xz .
+ )
+ cd ${pkgname}-${pkgver}
+ # for external archives (langs, dicts, helps)
+ chmod +x bin/unpack-sources
+ # gnome-vfs is disabled because LO wants GVFS >= 2.6 and only 2.0 is used in Salix 14.1
+ ./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --localstatedir=/var \
+ --sysconfdir=/etc \
+ --disable-ccache \
+ --enable-release-build=yes \
+ --enable-ext-wiki-publisher \
+ --enable-graphite \
+ --enable-orcus \
+ --disable-gconf \
+ --disable-gnome-vfs \
+ --enable-vlc \
+ --enable-eot \
+ --enable-extra-gallery \
+ --enable-extra-template \
+ --enable-extra-sample \
+ --enable-extra-font \
+ --enable-ext-watch-window \
+ --enable-ext-diagram \
+ --enable-ext-validator \
+ --enable-ext-barcode \
+ --enable-ext-ct2n \
+ --enable-ext-numbertext \
+ --enable-ext-hunart \
+ --enable-ext-typo \
+ --enable-ext-google-docs \
+ --enable-ext-nlpsolver \
+ --enable-ext-languagetool \
+ --without-krb5 \
+ --without-gssapi \
+ --without-junit \
+ --with-alloc=system \
+ --with-lang=ALL \
+ --with-help \
+ --with-myspell-dicts \
+ --without-system-dicts \
+ --with-system-boost \
+ --with-system-clucene \
+ --with-system-cairo \
+ --with-system-curl \
+ --with-system-expat \
+ --with-system-harfbuzz \
+ --with-system-icu \
+ --with-system-jpeg \
+ --with-system-lcms2 \
+ --with-system-libpng \
+ --with-system-libxml \
+ --with-system-mesa-headers \
+ --with-system-neon \
+ --with-system-nss \
+ --with-system-openldap \
+ --with-system-openssl \
+ --with-system-poppler \
+ --with-system-redland \
+ --with-system-zlib \
+ --with-vendor="Salix OS" \
+ --with-build-version=$pkgrel \
+ --build=$arch-slackware-linux \
+ || return 1
+ # we don't need to have these file lists
+ sed -i "/distro-install-file-lists/d" Makefile || return 1
+ # make needs a internet connection to download additionnal packages
+ make -j $numjobs build || return 1
+ make distro-pack-install DESTDIR=$PKG || return 1
+ # we don't need the included fonts, we already have packages for
+ # them anyway. We want to keep the opens___.ttf and fc_local.conf files.
+ find $PKG/usr/lib${LIBDIRSUFFIX}/$pkgname/share/fonts/truetype/ ! -name "opens___.ttf" ! -name "fc_local.conf" \
+ -type f \
+ -exec rm {} \;
+ ##############
+ # LANG PACKS #
+ ##############
+ echo "Preparing language packages: langs"
+ for l in $lang_list; do
+ echo ". $l"
+ for m in $PKG/gid_Module_Langpack_*_$l $PKG/gid_Module_Optional_Accessories_*_$l; do
+ [ -f "$m" ] || continue
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -u); do
+ mkdir -p ${PKG}_libreoffice_l10n_${l}${d}
+ done
+ for f in $(grep '^/' $m|sort -u); do
+ mv ${PKG}${f} ${PKG}_libreoffice_l10n_${l}${f}
+ done
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -r -u); do
+ rmdir ${PKG}${d} 2> /dev/null || true
+ done
+ done
+ done
+ echo "Preparing language packages: dicts"
+ for ld in $dict_list; do
+ l=$(echo $ld|cut -d: -f1)
+ # gnu sed necessary
+ dict=$(echo $ld|cut -d: -f2)
+ if [ -n "$dict" ]; then
+ echo ". $dict"
+ # funny names used in the package module filename,
+ # so try to determine it with some heuristics.
+ dict_dir1=$(echo $l|tr A-Z a-z|sed -r 's/^(.)/\U\1/; s/_(.)/_\U\1/;')
+ dict_dir2=$(echo $dict|tr A-Z a-z|sed -r 's/^(.)/\U\1/; s/_(.)/_\U\1/;')
+ dict_dir3=$(echo $dict_dir2|sed 's/_.*//')
+ for dict_dir in $dict_dir1 $dict_dir2 $dict_dir3; do
+ m=$PKG/gid_Module_Root_Extension_Dictionary_$dict_dir
+ [ -f "$m" ] || continue
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -u); do
+ mkdir -p ${PKG}_libreoffice_l10n_${l}${d}
+ done
+ for f in $(grep '^/' $m|sort -u); do
+ cp ${PKG}${f} ${PKG}_libreoffice_l10n_${l}${f}
+ done
+ # do not try another
+ break
+ done
+ fi
+ done
+ echo "Cleaning dictionaries in main package"
+ for m in $PKG/gid_Module_Root_Extension_Dictionary_*; do
+ [ -f "$m" ] || continue
+ for f in $(grep '^/' $m|sort -u); do
+ rm ${PKG}${f} 2>/dev/null || true
+ done
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -r -u); do
+ rmdir ${PKG}${d} 2>/dev/null || true
+ done
+ done
+ ##############
+ # HELP PACKS #
+ ##############
+ echo "Preparing help packages"
+ for h in $help_list; do
+ echo ". $h"
+ for m in $PKG/gid_Module_Helppack_*_$h; do
+ [ -f "$m" ] || continue
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -u); do
+ mkdir -p ${PKG}_libreoffice_help_${h}${d}
+ done
+ for f in $(grep '^/' $m|sort -u); do
+ mv ${PKG}${f} ${PKG}_libreoffice_help_${h}${f}
+ done
+ for d in $(sed -rn '/^%dir/ {s/%dir //;p}' $m|sort -r -u); do
+ rmdir ${PKG}${d} 2>/dev/null || true
+ done
+ done
+ done
+ rm ${PKG}/gid_Module_*
+}
--- /dev/null
+#!/usr/bin/env python
+# coding: utf-8
+# vim: set ai et sw=2 sts=2 ts=2 tw=0:
+
+from __future__ import division, print_function, unicode_literals
+import sys
+
+def gen_lang_list(langs):
+ return ' '.join(sorted(langs.keys()))
+
+def gen_dict_list(langs):
+ s = ''
+ for codel in sorted(langs.keys()):
+ if langs[codel][1]:
+ if s:
+ s += "\n"
+ s += codel + ":" + langs[codel][1]
+ return s
+
+def gen_help_list(helps):
+ return ' '.join(sorted(helps.keys()))
+
+def gen_lang_pkg_list(langs):
+ s = ''
+ for code in sorted(langs.keys()):
+ if s:
+ s += "\n"
+ s += '"libreoffice-l10n-' + code + '"'
+ return s
+
+def gen_help_pkg_list(helps):
+ s = ''
+ for code in sorted(helps.keys()):
+ if s:
+ s += "\n"
+ s += '"libreoffice-help-' + code + '"'
+ return s
+
+def gen_lang_slackdesc_list(langs):
+ s = ''
+ for code in sorted(langs.keys()):
+ if s:
+ s += "\n"
+ s += """libreoffice_l10n_{codeu}_slackdesc=\\
+(
+#|-----handy-ruler------------------------------------------------------|
+"libreoffice-l10n-{code} ({descr})"
+"{descr} language pack for LibreOffice"
+"Use this package if you want to run LibreOffice in"
+"{descr}."
+)
+""".format(code=code, codeu=code.replace('-', '_'), descr=langs[code][0])
+ return s
+
+def gen_help_slackdesc_list(helps):
+ s = ''
+ for code in sorted(helps.keys()):
+ if s:
+ s += "\n"
+ s += """libreoffice_help_{codeu}_slackdesc=\\
+(
+#|-----handy-ruler------------------------------------------------------|
+"libreoffice-help-{code} ({descr})"
+"{descr} help pack for LibreOffice"
+"Use this package if you want to have the help pages locally in"
+"{descr}."
+)
+""".format(code=code, codeu=code.replace('-', '_'), descr=helps[code])
+ return s
+
+def main():
+ languages = {}
+ with open('languages', 'r') as f:
+ for l in f:
+ (code, desc) = l.rstrip('\n').split(':')
+ languages[code] = desc
+ langs = {}
+ with open('langs', 'r') as f:
+ for l in f:
+ (codel, coded) = l.rstrip('\n').split(':')
+ langs[codel] = (languages[codel], coded)
+ helps = {}
+ with open('helps', 'r') as f:
+ for code in f:
+ code = code.rstrip('\n')
+ helps[code] = languages[code]
+ tpl_string = None
+ with open('SLKBUILD.tpl', 'r') as tpl:
+ tpl_string = tpl.read()
+ slk_string = tpl_string \
+ .replace('__lang_list__', gen_lang_list(langs)) \
+ .replace('__dict_list__', gen_dict_list(langs)) \
+ .replace('__help_list__', gen_help_list(helps)) \
+ .replace('__libreoffice_l10n_LANG__', gen_lang_pkg_list(langs)) \
+ .replace('__libreoffice_help_LANG__', gen_help_pkg_list(helps)) \
+ .replace('__libreoffice_l10n_LANG_slackdesc__', gen_lang_slackdesc_list(langs)) \
+ .replace('__libreoffice_help_LANG_slackdesc__', gen_help_slackdesc_list(helps))
+ with open('SLKBUILD', 'w') as slk:
+ slk.write(slk_string)
+main()