source: npl/overig/gyp/gyp.SlackBuild.orig

Last change on this file was 2154c77, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

various updates

  • Property mode set to 100755
File size: 3.6 KB
Line 
1#!/bin/bash
2
3# Copyright 2020  Patrick J. Volkerding, Sebeka, Minnesota, USA
4# All rights reserved.
5#
6# Redistribution and use of this script, with or without modification, is
7# permitted provided that the following conditions are met:
8#
9# 1. Redistributions of this script must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11#
12#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
13#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
15#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
18#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
20#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23cd $(dirname $0) ; CWD=$(pwd)
24
25PKGNAM=gyp
26VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-2}
28
29# Automatically determine the architecture we're building on:
30if [ -z "$ARCH" ]; then
31  case "$(uname -m)" in
32    i?86) ARCH=i586 ;;
33    arm*) readelf /usr/bin/file -A | egrep -q "Tag_CPU.*[4,5]" && ARCH=arm || ARCH=armv7hl ;;
34    # Unless $ARCH is already set, use uname -m for all other archs:
35    *) ARCH=$(uname -m) ;;
36  esac
37  export ARCH
38fi
39
40# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
41# the name of the created package would be, and then exit. This information
42# could be useful to other scripts.
43if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
44  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
45  exit 0
46fi
47
48NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
49
50if [ "$ARCH" = "i586" ]; then
51  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
52  LIBDIRSUFFIX=""
53elif [ "$ARCH" = "i686" ]; then
54  SLKCFLAGS="-O2 -march=i686"
55  LIBDIRSUFFIX=""
56elif [ "$ARCH" = "s390" ]; then
57  SLKCFLAGS="-O2"
58  LIBDIRSUFFIX=""
59elif [ "$ARCH" = "x86_64" ]; then
60  SLKCFLAGS="-O2 -fPIC"
61  LIBDIRSUFFIX="64"
62elif [ "$ARCH" = "armv7hl" ]; then
63  SLKCFLAGS="-O3 -march=armv7-a -mfpu=vfpv3-d16"
64  LIBDIRSUFFIX=""
65else
66  SLKCFLAGS="-O2"
67  LIBDIRSUFFIX=""
68fi
69
70TMP=${TMP:-/tmp}
71PKG=$TMP/package-$PKGNAM
72
73rm -rf $PKG
74mkdir -p $TMP $PKG
75
76cd $TMP
77rm -rf $PKGNAM-$VERSION
78tar xvf $CWD/$PKGNAM-$VERSION.tar.?z || exit 1
79cd $PKGNAM-$VERSION || exit 1
80
81chown -R root:root .
82find . \
83  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
84  -exec chmod 755 {} \+ -o \
85  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
86  -exec chmod 644 {} \+
87
88# Patches from Fedora:
89zcat $CWD/gyp-fix-cmake.patch.gz | patch -p1 --verbose || exit 1
90zcat $CWD/gyp-ninja-build.patch.gz | patch -p1 --verbose || exit 1
91zcat $CWD/gyp-python3.patch.gz | patch -p1 --verbose || exit 1
92zcat $CWD/gyp-python38.patch.gz | patch -p1 --verbose || exit 1
93#zcat $CWD/gyp-python39.patch.gz | patch -p1 --verbose || exit 1
94
95python3 setup.py install --root=$PKG || exit 1
96
97# Strip binaries:
98find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
99
100# Add a documentation directory:
101mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
102cp -a \
103  AUTHORS* LICENSE* README* \
104  $PKG/usr/doc/${PKGNAM}-$VERSION
105
106mkdir -p $PKG/install
107cat $CWD/slack-desc > $PKG/install/slack-desc
108
109cd $PKG
110/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.