summaryrefslogtreecommitdiff
path: root/development/eagle/eagle.SlackBuild
blob: 1664a7d13feb13b2d61f7d110f69d68bb2966fab (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
115
116
117
118
119
120
121
122
123
124
125
126
#!/bin/bash

# Slackware build script for eagle (binary repackaging)

# Copyright 2008,2015 Kyle Guinn <elyk03@gmail.com>, USA
# Copyright 2010,2013 Niels Horn, Rio de Janeiro, RJ, Brazil
# Copyright 2016 Andrzej Telszewski, Banie
# 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.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=eagle
VERSION=${VERSION:-7.7.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

ARCH=${ARCH:-$(uname -m)}
case $ARCH in
  i?86)   PLATFORM=lin32; ARCH=i686 ;;
  x86_64) PLATFORM=lin64 ;;
  *)      echo "$ARCH is unsupported."; exit 1 ;;
esac

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

# Documentation is distributed for English, German and Chinese.
# Due to the size of the documentation, only include one language.
DOC_LANG=${DOC_LANG:-en} # One of "all", "de", "en", or "zh".

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
sh $CWD/$PRGNAM-$PLATFORM-$VERSION.run $PKG/opt
chown -R root:root $PKG
chmod -R u+w,go-w,a+rX-st $PKG
find $PKG/opt/$PRGNAM-$VERSION/lbr/seeed -type f -exec chmod -x {} +
find $PKG/opt/$PRGNAM-$VERSION/projects/examples/seeed -type f -exec chmod -x {} +

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

mkdir -p $PKG/usr/bin
ln -s /opt/$PRGNAM-$VERSION/bin/$PRGNAM $PKG/usr/bin/eagle

mkdir -p $PKG/usr/share/icons/hicolor/16x16/apps
mkdir -p $PKG/usr/share/icons/hicolor/48x48/apps
ln -s /opt/$PRGNAM-$VERSION/bin/eagleicon16.png $PKG/usr/share/icons/hicolor/16x16/apps/$PRGNAM.png
ln -s /opt/$PRGNAM-$VERSION/bin/eagleicon50.png $PKG/usr/share/icons/hicolor/48x48/apps/$PRGNAM.png

mkdir -p $PKG/usr/share/applications
cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop

# 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 {} +

if [ ${DOC_LANG} != "all" ]; then
  # Move each language-specific file to its own subdir.
  cd $PKG/opt/$PRGNAM-$VERSION/doc
  for lang in de en zh; do mkdir -p ${lang}/ulp; done
  for lang in de en;    do mv README_${lang} ${lang}/README; done
  for lang in de en;    do mv UPDATE_${lang} ${lang}/UPDATE; done
  for lang in de en;    do mv library_${lang}.txt ${lang}/library.txt; done
  for lang in de en zh; do mv manual_${lang}.pdf ${lang}/manual.pdf; done
  for lang in de en zh; do mv tutorial_${lang}.pdf ${lang}/tutorial.pdf; done
  for lang in de en;    do mv ulp/connect-device-split-symbol-${lang}.pdf ${lang}/ulp/connect-device-split-symbol.pdf; done
  for lang in de en;    do mv ulp/generate-3d-idf-data_${lang}.pdf ${lang}/ulp/generate-3d-idf-data.pdf; done
  for lang in de en;    do mv ulp/make-symbol-device-package-bsdl-2011-${lang}.pdf ${lang}/ulp/make-symbol-device-package-bsdl-2011.pdf; done

  # Prefer the English docs as a base set.
  cd $PKG/opt/$PRGNAM-$VERSION/doc/en
  find . -type f -exec mv {} ../{} \;

  # Replace the base set with other languages.
  cd $PKG/opt/$PRGNAM-$VERSION/doc/${DOC_LANG}
  find . -type f -exec mv {} ../{} \;

  # Delete all alternate language files.
  cd $PKG/opt/$PRGNAM-$VERSION/doc
  for lang in de en zh; do rm -rf ${lang}; done
fi

# Move the documentation to the proper location.
mkdir -p $PKG/usr/doc
mv $PKG/opt/$PRGNAM-$VERSION/doc $PKG/usr/doc/$PRGNAM-$VERSION
ln -s /usr/doc/$PRGNAM-$VERSION $PKG/opt/$PRGNAM-$VERSION/doc
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 $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE