aboutsummaryrefslogtreecommitdiff
path: root/development/eagle/eagle.SlackBuild
blob: 8a182ec0d35190ef051f15c2615779c939b137a3 (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
111
112
113
114
#!/bin/sh

# Slackware build script for eagle (binary repackaging)

# Copyright 2008 Kyle Guinn <elyk03@gmail.com>
# Copyright 2010,2013 Niels Horn, Rio de Janeiro, RJ, Brazil
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Revision date: 2013/03/27

PRGNAM="eagle"
VERSION=${VERSION:-"6.4.0"}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

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

if [ ! "$ARCH" = "i486" ]; then
  echo "Sorry, only i486 supported"
  exit 1
fi

# Documentation is distributed for English, German and Chinese.  Due to the size
# of the documentation, only include one language.
LANG=${LANG:-"en"}
if [ "$LANG" = "de" ]; then
  DOCS="README_de UPDATE_de library_de.txt license_de.txt manual_de.pdf tutorial_de.pdf elektro-tutorial.pdf"
elif [ "$LANG" = "zh" ]; then
  DOCS="README_en UPDATE_en library_en.txt license_en.txt manual_zh.pdf tutorial_zh.pdf"
else
  DOCS="README_en UPDATE_en library_en.txt license_en.txt manual_en.pdf tutorial_en.pdf"
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
sh $CWD/$PRGNAM-lin-$VERSION.run $PKG/opt
chown -R root:root $PKG

# Create the license key file.  EAGLE will write to this the first time it is
# run.  After that, you can change the permissions to 0644 if you wish.
touch $PKG/opt/$PRGNAM-$VERSION/bin/$PRGNAM.key
chmod 0666 $PKG/opt/$PRGNAM-$VERSION/bin/$PRGNAM.key

# Some versions of EAGLE have a graphics bug that results in corruption of the
# displayed window, particularly affecting the display of trees and lists.
# This is due to a conflict with compositing.  The quickest fix is to set an
# environment variable (XLIB_SKIP_ARGB_VISUALS) before running EAGLE.  The fix
# may not apply to the latest version of EAGLE, but it doesn't hurt to leave
# it in.  See http://www.cadsoft.de/faq.htm#07041701 for details.
mkdir -p $PKG/usr/bin
cat > $PKG/usr/bin/$PRGNAM << EOF
#!/bin/sh
XLIB_SKIP_ARGB_VISUALS=1
export XLIB_SKIP_ARGB_VISUALS
exec /opt/$PRGNAM-$VERSION/bin/$PRGNAM "\$@"
EOF
chmod +x $PKG/usr/bin/$PRGNAM

# Move any man pages to the proper location
mkdir -p $PKG/usr/man/man1
mv $PKG/opt/$PRGNAM-$VERSION/doc/*.1 $PKG/usr/man/man1

find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

mkdir -p $PKG/usr/share/{applications,pixmaps}
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
cat $CWD/$PRGNAM.png > $PKG/usr/share/pixmaps/$PRGNAM.png

# Move the documentation to the proper location
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cd $PKG/opt/$PRGNAM-$VERSION
for d in $DOCS; do mv doc/$d $PKG/usr/doc/$PRGNAM-$VERSION/; done
  rm -rf doc
  ln -s /usr/doc/$PRGNAM-$VERSION doc
cd -

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 $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}