aboutsummaryrefslogtreecommitdiff
path: root/development/netbeans/netbeans.SlackBuild
blob: d2d3222a51cbf1ed643ef06199ada233141d4787 (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
#!/bin/sh

# Slackware build script for netbeans 
# Written by core (eroc@linuxmail.org)
# Modified by Robby Workman

# This script is just a binary repackaging.
# You can make a localised package with this SlackBuild 
# (default is english). For example:
#
# To get netbeans in Spanish - Español (es) :
# 1).- Go to: http://www.netbeans.info/downloads/all.php?b_id=3095
# 2).- Under "Archive Distributions", download the package:
#      netbeans-5_5_1-es.zip
# 3).- Execute the slackbuild as:
#      NBLANG=es ./netbeans.SlackBuild
#      to finally get in /tmp: netbeans-5.5.1_es-i586-1_SBo.tgz
#
# Other values for NBLANG could be: ja, pt_BR, zh_CN, de and zh_TW
#
# This SlackBuild was tested with "es" and "pt_BR" and with default
# language (English) so if it works for you with the other values,
# it's a good idea to send feedback about it :)

set -e

PRGNAM=netbeans
VERSION=5.5.1
VERSIONALT='5_5_1'
ARCH=i586 # Leave this alone
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION

# If NBLANG has a value:
if [ ! -z $NBLANG ]; then
    NBLANGSRC="-$NBLANG" # For the sourcecode
    NBLANGPKG="_$NBLANG" # For the final package
    NBLANGLOC=$(echo "--locale $NBLANG" | sed 's/_/:/') # To netbeans's locale.
fi

unzip $CWD/$PRGNAM-$VERSIONALT${NBLANGSRC}.zip || exit 1
mv $PRGNAM $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

mkdir $PKG/opt
cp -R $TMP/$PRGNAM-$VERSION $PKG/opt

( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
)

# Add netbeans to KDE/GNOME/XFCE menu
mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# Add an icon for netbeans
mkdir -p $PKG/usr/share/pixmaps
cp $TMP/$PRGNAM-$VERSION/nb5.5/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png

# Add a script to call netbeans from usr/bin.
mkdir -p $PKG/usr/bin
cat <<- EOF > $PKG/usr/bin/$PRGNAM
#!/bin/sh
cd /opt/$PRGNAM-$VERSION/bin
./$PRGNAM $NBLANGLOC
EOF
chmod 0755 $PKG/usr/bin/$PRGNAM

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a build_info CREDITS* DISTRIBUTION.txt LICENSE.txt \
  netbeans.css README* THIRDPARTYLICENSE.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

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

cd $PKG
/sbin/makepkg -l y -c n -p $OUTPUT/$PRGNAM-$VERSION$NBLANGPKG-$ARCH-$BUILD$TAG.tgz