summaryrefslogtreecommitdiffstats
path: root/office/openoffice-langpack/openoffice-langpack.SlackBuild
blob: d13746b7aad461c0a042100369f711b264807c0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/bin/sh

# Slackware build script for OpenOffice Language Packs
#
# Adapted from Slackware build scripts for LibreOffice Language Packs by
# Niels Horn, Rio de Janeiro, RJ, Brazil (Copyright 2010-2014) and
# Willy Sudiarto Raharjo (Copyright 2014-2017)

# Copyright 2017 Ekin Akoglu, Erdemli, Mersin, Turkey
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the “Software”),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
# IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

PRGNAM=openoffice-langpack
VERSION=${VERSION:-"4.1.6"}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

OOLANG=${OOLANG:-en-GB}
PKG_LANG=${OOLANG//-/_}

# I'll leave this line here, as I always have to change it with every release
SRCVERSION=$VERSION
SRCSHORT=$(echo $VERSION | cut -f1 -d.)

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# Change source package name
if [ "$ARCH" = "x86_64" ]; then
  SRCARCH="x86-64"
  PKGARCH="$ARCH"
  LIBDIRSUFFIX=64
elif [ "$ARCH" = "arm" ]; then
  printf "\n$ARCH is unsupported for Apache OpenOffice...\n\n"
  exit 1
else
  SRCARCH="x86"
  PKGARCH="i586"
  LIBDIRSUFFIX=""
fi

set -e

# Concatenate all parts to get the full name of the tarball
TARBALL="Apache_OpenOffice_${SRCVERSION}_Linux_${SRCARCH}_langpack-rpm_${OOLANG}.tar.gz"
if [ ! -r $TARBALL ]; then
  echo "$TARBALL not found"
  exit 1
fi

# Get "base" directory of tarball
SOURCEDIR=$(tar tzf $CWD/$TARBALL 2>/dev/null | head -n 1 | tr -d \/)

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
rm -rf $TMP/$SOURCEDIR

tar xvf $CWD/$TARBALL -C $TMP

cd $TMP/$SOURCEDIR/RPMS/

for FILE in *.rpm ; do rpm2cpio < $FILE | cpio -imdv ; done
mv opt $PKG
cd $PKG

# Move docs to their expected locations
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cd $PKG/opt/openoffice$SRCSHORT
  mv readmes $PKG/usr/doc/$PRGNAM-$VERSION
cd -
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

# Fix ownership and permissions and make the package
chown -R root:root .
find . -type d -exec chmod 755 {} \;
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;

/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-${VERSION}_${PKG_LANG}-$PKGARCH-$BUILD$TAG.${PKGTYPE:-tgz}