source: npl/system/ncurses/ncurses.SlackBuild.orig @ 5fedc40

gcc484perl-5.22
Last change on this file since 5fedc40 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: 6.0 KB
Line 
1#!/bin/sh
2
3# Copyright 2000-2011, 2013, 2014, 2015  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
23PKGNAM=ncurses
24VERSION=${VERSION:-$(echo $PKGNAM-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
25BUILD=${BUILD:-4}
26
27# Automatically determine the architecture we're building on:
28if [ -z "$ARCH" ]; then
29  case "$( uname -m )" in
30    i?86) export ARCH=i486 ;;
31    arm*) export ARCH=arm ;;
32    # Unless $ARCH is already set, use uname -m for all other archs:
33       *) export ARCH=$( uname -m ) ;;
34  esac
35fi
36
37CWD=$(pwd)
38TMP=${TMP:-/tmp}
39PKG=$TMP/package-ncurses
40
41if [ "$ARCH" = "i486" ]; then
42  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
43  LIBDIRSUFFIX=""
44elif [ "$ARCH" = "s390" ]; then
45  SLKCFLAGS="-O2"
46  LIBDIRSUFFIX=""
47elif [ "$ARCH" = "x86_64" ]; then
48  SLKCFLAGS="-O2 -fPIC"
49  X86_64OPTS=" --with-chtype=long --with-mmask-t=long "
50  LIBDIRSUFFIX="64"
51else
52  SLKCFLAGS="-O2"
53  LIBDIRSUFFIX=""
54fi
55
56ncurses_configure() {
57CFLAGS="$SLKCFLAGS" \
58./configure \
59  --prefix=/usr \
60  --libdir=/usr/lib${LIBDIRSUFFIX} \
61  --mandir=/usr/man \
62  --with-gpm \
63  --disable-termcap \
64  --with-shared \
65  --with-cxx-shared \
66  --without-normal \
67  --without-debug \
68  --without-profile \
69  --enable-symlinks \
70  --enable-pc-files \
71  --with-pkg-config-libdir=/usr/lib${LIBDIRSUFFIX}/pkgconfig \
72  --without-ada \
73  $X86_64OPTS \
74  --program-suffix="" \
75  --program-prefix="" \
76  $WIDEC \
77  --build=$ARCH-slackware-linux
78}
79
80rm -rf $PKG
81mkdir -p $TMP $PKG
82
83cd $TMP
84rm -rf ncurses-$VERSION
85tar xvf $CWD/ncurses-$VERSION.tar.?z || exit 1
86cd ncurses-$VERSION || exit 1
87chown -R root:root .
88
89# This allows some other patches to come first by making them bz2...  gz next
90if [ ! -z "$(ls $CWD/patches/ncurses*bz2 2> /dev/null)" ]; then
91  bzcat $CWD/patches/ncurses*bz2 > tmp-patch.sh
92  bash tmp-patch.sh || exit 1
93fi
94# Apply official upstream patches.
95if [ ! -z "$(ls $CWD/patches/ncurses-$VERSION-2*.patch.gz 2> /dev/null)" ]; then
96  for file in $CWD/patches/ncurses-$VERSION-2*.patch.gz ; do
97    zcat $file | patch -p1 --verbose || exit 1
98  done
99fi
100
101# Apply upstream patch collection:
102xzcat $CWD/ncurses-5.9-20141206-patch.sh.xz > ncurses-5.9-20141206-patch.sh
103sh ncurses-5.9-20141206-patch.sh
104
105zcat $CWD/ncurses.mkhashsize.diff.gz | patch -p1 --verbose || exit 1
106
107ncurses_configure
108make -j4 || exit 1
109# Spamming the partition.
110# Sorry, but it's about the only way to get a good 'tic'.
111make install
112# Install the package:
113make install DESTDIR=$PKG
114
115# Build/install again with wide character support:
116make clean
117WIDEC=--enable-widec
118ncurses_configure
119make -j4 || exit 1
120make install
121make install DESTDIR=$PKG
122
123if [ ! -d $PKG/usr/include/ncursesw -a ! -L $PKG/usr/include/ncursesw ]; then
124  ( cd $PKG/usr/include ; ln -sf ncurses ncursesw )
125fi
126
127# Strip stuff:
128find $PKG | xargs file | grep -e "executable" -e "shared object" \
129  | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
130
131# Move the include files from /usr/include into
132# /usr/include/ncurses, then make symlinks back
133# into /usr/include.
134( cd $PKG/usr/include
135  rm -rf ncurses
136  mkdir ncurses
137  mv *.h ncurses
138  for file in ncurses/* ; do
139    ln -sf $file .
140  done
141  # This shouldn't clobber the real one:
142  mv termcap.h termcap-ncurses.h
143)
144
145# Move the ncurses libraries into /lib, since they're important:
146mkdir -p $PKG/lib${LIBDIRSUFFIX}
147( cd $PKG/usr/lib${LIBDIRSUFFIX}
148  chmod 755 *.so
149  #chmod 644 *.a
150  mv libncurses.so.5* $PKG/lib${LIBDIRSUFFIX}
151  mv libncursesw.so.5* $PKG/lib${LIBDIRSUFFIX}
152  rm -f libncurses.so
153  ln -sf /lib${LIBDIRSUFFIX}/libncurses.so.5 libncurses.so
154  rm -f libncursesw.so
155  ln -sf /lib${LIBDIRSUFFIX}/libncursesw.so.5 libncursesw.so
156  # Olde obsolete names, just in case
157  rm -f libcurses.so
158  ln -sf libncurses.so libcurses.so
159  rm -f libcursesw.so
160  ln -sf libncursesw.so libcursesw.so
161)
162
163# Set TERMINFO to point to the package:
164export TERMINFO=$PKG/usr/share/terminfo
165# Fix the xterm, screen, rxvt, and Eterm entries:
166for tfile in $CWD/xterm.terminfo $CWD/screeninfo.src $CWD/rxvt.terminfo $CWD/Eterm.ti ; do
167  if [ -r $tfile ]; then
168    progs/tic -v $tfile
169  fi
170done
171unset TERMINFO
172
173# Then, add /usr/doc/ncurses-xxxxx with appropriate files.
174mkdir -p $PKG/usr/doc/ncurses-$VERSION
175cp -a \
176  ANNOUNCE INSTALL MANIFEST NEWS README* TO-DO \
177  $PKG/usr/doc/ncurses-$VERSION
178mkdir -p $PKG/usr/doc/ncurses-$VERSION/c++
179cp -a \
180  c++/NEWS c++/PROBLEMS c++/README-first \
181  $PKG/usr/doc/ncurses-$VERSION/c++
182if [ -r $PKG/usr/man/man1/tack.1 ]; then
183  gzip -9 --force $PKG/usr/man/man1/tack.1
184fi
185
186# We don't need the log of every change here, but we'll take some.
187# If you need the whole thing probably you already extracted the
188# sources...
189if [ -r NEWS ]; then
190  DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
191  cat NEWS | head -n 1000 > $DOCSDIR/NEWS
192  echo >> $DOCSDIR/NEWS
193  echo "        +++  SNIP  +++  " >> $DOCSDIR/NEWS
194  echo >> $DOCSDIR/NEWS
195  echo "  see source code for full file  " >> $DOCSDIR/NEWS
196  echo >> $DOCSDIR/NEWS
197  touch -r NEWS $DOCSDIR/NEWS
198fi
199
200# desc file:
201mkdir -p $PKG/install
202cat $CWD/slack-desc > $PKG/install/slack-desc
203
204cd $PKG
205/sbin/makepkg -l y -c n $TMP/ncurses-$VERSION-$ARCH-$BUILD.txz
206
Note: See TracBrowser for help on using the repository browser.