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

Last change on this file 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: 4.6 KB
Line 
1#!/bin/sh
2
3# Copyright 2006, 2007, 2008, 2009, 2010, 2012  Patrick J. Volkerding, Sebeka, MN, 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
23
24PKGNAM=nano
25VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z* | cut -d - -f 2 | rev | cut -f 3- -d . | rev)}
26BUILD=${BUILD:-1}
27
28NUMJOBS=${NUMJOBS:-" -j7 "}
29
30# Automatically determine the architecture we're building on:
31if [ -z "$ARCH" ]; then
32  case "$( uname -m )" in
33    i?86) export ARCH=i486 ;;
34    arm*) export ARCH=arm ;;
35    # Unless $ARCH is already set, use uname -m for all other archs:
36       *) export ARCH=$( uname -m ) ;;
37  esac
38fi
39
40if [ "$ARCH" = "i486" ]; then
41  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
42  LIBDIRSUFFIX=""
43  ARCHQUADLET=""
44elif [ "$ARCH" = "s390" ]; then
45  SLKCFLAGS="-O2"
46  LIBDIRSUFFIX=""
47  ARCHQUADLET=""
48elif [ "$ARCH" = "x86_64" ]; then
49  SLKCFLAGS="-O2 -fPIC"
50  LIBDIRSUFFIX="64"
51  ARCHQUADLET=""
52elif [ "$ARCH" = "arm" ]; then
53  SLKCFLAGS="-O2 -march=armv5te"
54  LIBDIRSUFFIX=""
55  ARCHQUADLET="-gnueabi"
56else
57  SLKCFLAGS="-O2"
58  LIBDIRSUFFIX=""
59  ARCHQUADLET=""
60fi
61
62CWD=$(pwd)
63TMP=${TMP:-/tmp}
64PKG=$TMP/package-${PKGNAM}
65rm -rf $PKG
66mkdir -p $TMP $PKG
67
68cd $TMP
69rm -rf ${PKGNAM}-${VERSION}
70tar xvf $CWD/${PKGNAM}-$VERSION.tar.?z* || exit 1
71cd ${PKGNAM}-$VERSION || exit 1
72
73# Make sure ownerships and permissions are sane:
74chown -R root:root .
75find . \
76  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
77  -exec chmod 755 {} \; -o \
78  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
79  -exec chmod 644 {} \;
80
81# Configure:
82CFLAGS="$SLKCFLAGS" \
83./configure \
84  --prefix=/usr \
85  --sysconfdir=/etc \
86  --infodir=/usr/info \
87  --mandir=/usr/man \
88  --program-prefix= \
89  --program-suffix= \
90  --enable-color \
91  --enable-multibuffer \
92  --enable-nanorc \
93  --enable-all \
94  --enable-utf8 \
95  --disable-wrapping-as-root \
96  --build=$ARCH-slackware-linux$ARCHQUADLET || exit 1
97
98# Build and install:
99make $NUMJOBS || make || exit 1
100make install DESTDIR=$PKG || exit 1
101
102# Strip binaries:
103find $PKG | xargs file | grep -e "executable" -e "shared object" \
104  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
105
106# Compress and link manpages, if any:
107if [ -d $PKG/usr/man ]; then
108  ( cd $PKG/usr/man
109    for manpagedir in $(find . -type d -name "man*") ; do
110      ( cd $manpagedir
111        for eachpage in $( find . -type l -maxdepth 1) ; do
112          ln -s $( readlink $eachpage ).gz $eachpage.gz
113          rm $eachpage
114        done
115        gzip -9 *.*
116      )
117    done
118  )
119fi
120
121# Compress info files, if any:
122if [ -d $PKG/usr/info ]; then
123  ( cd $PKG/usr/info
124    rm -f dir
125    gzip -9 *
126  )
127fi
128
129# Install a default /etc/nanorc file.  This is the standard sample
130# file from the doc directory that loads the colour configurations
131# from /usr/share/nano.
132mkdir -vpm755 $PKG/etc
133sed 's?^# include?include?g' doc/nanorc.sample > $PKG/etc/nanorc.new
134chmod 644 $PKG/etc/nanorc.new
135
136# Add a documentation directory:
137mkdir -p $PKG/usr/doc/${PKGNAM}-$VERSION
138cp -a \
139  ABOUT-NLS AUTHORS BUGS COPYING* INSTALL NEWS README* THANKS TODO UPGRADE \
140  doc/faq.html doc/nanorc.sample \
141  $PKG/usr/doc/${PKGNAM}-$VERSION
142
143# If there's a ChangeLog, installing at least part of the recent history
144# is useful, but don't let it get totally out of control:
145if [ -r ChangeLog ]; then
146  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
147  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
148  touch -r ChangeLog $DOCSDIR/ChangeLog
149fi
150
151# Place the package description and installation script:
152mkdir -p $PKG/install
153cat $CWD/slack-desc > $PKG/install/slack-desc
154zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
155
156cd $PKG
157/sbin/makepkg -l y -c n $TMP/${PKGNAM}-$VERSION-$ARCH-$BUILD.txz
158
Note: See TracBrowser for help on using the repository browser.