source: npl/overig/yasm/yasm.SlackBuild.orig @ cd8630b

gcc484perl-5.22
Last change on this file since cd8630b was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100755
File size: 5.8 KB
Line 
1#!/bin/sh
2# $Id: yasm.SlackBuild,v 1.7 2009/05/12 20:24:31 root Exp root $
3# Copyright (c) 2008 Eric Hameleers <alien@slackware.com>
4# Copyright 2010  Patrick Volkerding, Sebeka, MN, USA
5# All rights reserved.
6#
7#   Permission to use, copy, modify, and distribute this software for
8#   any purpose with or without fee is hereby granted, provided that
9#   the above copyright notice and this permission notice appear in all
10#   copies.
11#
12#   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
13#   WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14#   MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
15#   IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
16#   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19#   USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20#   ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21#   OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
22#   OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23#   SUCH DAMAGE.
24# -----------------------------------------------------------------------------
25#
26# Slackware SlackBuild script
27# ===========================
28# By:         Eric Hameleers <alien@slackware.com>
29# For:        yasm
30# Descr:      complete rewrite of the NASM assembler
31# URL:        http://www.tortall.net/projects/yasm/
32# Needs:
33# Changelog:
34# 0.7.1-1:    16/Jun/2008 by Eric Hameleers <alien@slackware.com>
35#             * Initial build.
36# 0.7.2-1:    08/dec/2008 by Eric Hameleers <alien@slackware.com>
37#             * Update.
38# 0.8.0-1:    12/may/2009 by Eric Hameleers <alien@slackware.com>
39#             * Update.
40# 1.1.0-1:    2010-08-31 by volkerdi@slackware.com
41#             * Update.
42# 1.3.0-1:    2014-11-09 by Heinz Wiesinger <pprkut@slackware.com>
43#             * Update.
44#
45# Run 'sh yasm.SlackBuild' to build a Slackware package.
46# The package (.txz) file is created in /tmp .
47# Install using 'installpkg'.
48#
49# -----------------------------------------------------------------------------
50
51PKGNAM=yasm
52VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
53BUILD=${BUILD:-1}
54
55# Automatically determine the architecture we're building on:
56if [ -z "$ARCH" ]; then
57  case "$( uname -m )" in
58    i?86) export ARCH=i486 ;;
59    arm*) export ARCH=arm ;;
60    # Unless $ARCH is already set, use uname -m for all other archs:
61       *) export ARCH=$( uname -m ) ;;
62  esac
63fi
64
65DOCS="ABOUT-NLS AUTHORS ChangeLog COPYING GNU_* NEWS README *.txt"
66
67# If you want to disable python bindings, set ENABLE_PYTHON to "NO".
68# Building python support requires Cython, which is not shipped with Slackware.
69ENABLE_PYTHON=${ENABLE_PYTHON:-"'NO"}
70
71# Where do we look for sources?
72SRCDIR=$(cd $(dirname $0); pwd)
73
74# Place to build (TMP) package (PKG) and output (OUTPUT) the program:
75TMP=${TMP:-/tmp/build}
76PKG=$TMP/package-$PKGNAM
77OUTPUT=${OUTPUT:-/tmp}
78
79# Exit the script on errors:
80set -e
81trap 'echo "$0 FAILED at line ${LINENO}" | tee $OUTPUT/error-${PKGNAM}.log' ERR
82# Catch unitialized variables:
83set -u
84P1=${1:-1}
85
86case "$ARCH" in
87  i486)      SLKCFLAGS="-O2 -march=i486 -mtune=i686"
88             SLKLDFLAGS=""; LIBDIRSUFFIX=""
89             ;;
90  s390)      SLKCFLAGS="-O2"
91             SLKLDFLAGS=""; LIBDIRSUFFIX=""
92             ;;
93  powerpc)   SLKCFLAGS="-O2"
94             SLKLDFLAGS=""; LIBDIRSUFFIX=""
95             ;;
96  x86_64)    SLKCFLAGS="-O2 -fPIC"
97             SLKLDFLAGS="-L/usr/lib64"; LIBDIRSUFFIX="64"
98             ;;
99  athlon-xp) SLKCFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
100             SLKLDFLAGS=""; LIBDIRSUFFIX=""
101             ;;
102esac
103
104# Create working directories:
105mkdir -p $OUTPUT          # place for the package to be saved
106mkdir -p $TMP/tmp-$PKGNAM # location to build the source
107mkdir -p $PKG             # place for the package to be built
108rm -rf $PKG/*             # always erase old package's contents
109rm -rf $TMP/tmp-$PKGNAM/* # remove the remnants of previous build
110
111# --- PACKAGE BUILDING ---
112
113echo "++"
114echo "|| $PKGNAM-$VERSION"
115echo "++"
116
117cd $TMP/tmp-$PKGNAM
118echo "Extracting the source archive(s) for $PKGNAM..."
119tar xvf $SRCDIR/$PKGNAM-$VERSION.tar.?z*
120cd ${PKGNAM}-${VERSION}
121chown -R root:root .
122chmod -R u+w,go+r-w,a-s .
123
124if [ "$ENABLE_PYTHON" = "YES" ]; then
125  PYTHONSTUFF="--enable-python --enable-python-bindings"
126else
127  PYTHONSTUFF=""
128fi
129
130echo Building ...
131LDFLAGS="$SLKLDFLAGS" \
132CXXFLAGS="$SLKCFLAGS" \
133CFLAGS="$SLKCFLAGS" \
134./configure --prefix=/usr \
135            --libdir=/usr/lib${LIBDIRSUFFIX} \
136            --localstatedir=/var \
137            --sysconfdir=/etc \
138            --mandir=/usr/man \
139            ${PYTHONSTUFF} \
140            --program-prefix= \
141            --program-suffix= \
142            --build=$ARCH-slackware-linux
143
144make
145
146make DESTDIR=$PKG install
147
148# Add documentation:
149mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
150cp -a $DOCS $PKG/usr/doc/$PKGNAM-$VERSION || true
151rm $PKG/usr/doc/$PKGNAM-$VERSION/CMakeLists.txt
152chown -R root:root $PKG/usr/doc/$PKGNAM-$VERSION
153find $PKG/usr/doc -type f -exec chmod 644 {} \;
154
155# Remove empty share directory:
156rmdir $PKG/usr/share || true
157
158# Compress the man page(s):
159if [ -d $PKG/usr/man ]; then
160  find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
161  for i in $(find $PKG/usr/man -type l -name "*.?") ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
162fi
163
164# Strip binaries:
165find $PKG | xargs file | grep -e "executable" -e "shared object" \
166  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
167
168# Add a package description:
169mkdir -p $PKG/install
170cat $SRCDIR/slack-desc > $PKG/install/slack-desc
171
172# Build the package:
173cd $PKG
174makepkg --linkadd y --chown n $OUTPUT/${PKGNAM}-${VERSION}-${ARCH}-${BUILD}.txz
175
Note: See TracBrowser for help on using the repository browser.