2010-05-12 23:28:50 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for python3
|
2012-11-20 19:03:52 +01:00
|
|
|
|
2014-03-13 02:31:46 +01:00
|
|
|
# Copyright 2012-2014 Audrius Kažukauskas <audrius@neutrino.lt>
|
2012-11-20 19:03:52 +01:00
|
|
|
# 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.
|
2010-05-12 23:28:50 +02:00
|
|
|
|
|
|
|
PRGNAM=python3
|
2014-03-13 02:31:46 +01:00
|
|
|
VERSION=${VERSION:-3.3.5}
|
2013-04-27 07:19:56 +02:00
|
|
|
BUILD=${BUILD:-1}
|
2010-05-12 23:28:50 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-06-04 07:03:33 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-12 23:28:50 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
2010-05-13 00:25:24 +02:00
|
|
|
# Don't set any SLKCFLAGS here, or OPT="$SLKCFLAGS" before the ./configure.
|
|
|
|
# Python gets the compile options right without any help.
|
2010-05-12 23:28:50 +02:00
|
|
|
if [ "$ARCH" = "i486" ]; then
|
2010-05-13 00:25:24 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:28:50 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
2010-05-13 00:25:24 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 07:03:33 +02:00
|
|
|
else
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-12 23:28:50 +02:00
|
|
|
fi
|
|
|
|
|
2010-05-13 00:25:24 +02:00
|
|
|
set -eu
|
|
|
|
|
|
|
|
# Location for Python site-packages:
|
2012-11-20 19:03:52 +01:00
|
|
|
SITEPK=$PKG/usr/lib${LIBDIRSUFFIX}/python3.3/site-packages
|
2010-05-13 00:25:24 +02:00
|
|
|
# same as above without $PKG
|
2012-11-20 19:03:52 +01:00
|
|
|
TOOLSDIR=/usr/lib${LIBDIRSUFFIX}/python3.3/site-packages
|
2010-05-12 23:28:50 +02:00
|
|
|
|
|
|
|
rm -rf $PKG
|
|
|
|
mkdir -p $TMP $PKG $OUTPUT
|
|
|
|
cd $TMP
|
|
|
|
rm -rf Python-$VERSION
|
2011-07-20 07:44:48 +02:00
|
|
|
tar xvf $CWD/Python-$VERSION.tar.xz
|
2010-05-12 23:28:50 +02:00
|
|
|
cd Python-$VERSION
|
2010-06-12 13:07:37 +02:00
|
|
|
|
2013-12-31 00:47:24 +01:00
|
|
|
patch -p1 -i $CWD/patches/python3.readline.set_pre_input_hook.diff
|
2012-11-20 19:03:52 +01:00
|
|
|
# We don't want a large libpython*.a:
|
2013-12-31 00:47:24 +01:00
|
|
|
patch -p1 -i $CWD/patches/python3.no-static-library.diff
|
2010-06-12 13:07:37 +02:00
|
|
|
|
|
|
|
if [ "$ARCH" = "x86_64" ]; then
|
|
|
|
# Install to lib64 instead of lib:
|
2013-12-31 00:47:24 +01:00
|
|
|
patch -p1 -i $CWD/patches/python3.x86_64.diff
|
2010-06-12 13:07:37 +02:00
|
|
|
fi
|
|
|
|
|
2013-02-11 01:32:01 +01:00
|
|
|
# Fix python3 path in cgi.py.
|
|
|
|
sed -i '1s|^#.*/usr/local/bin/python|#!/usr/bin/python3|' Lib/cgi.py
|
|
|
|
|
2010-05-12 23:28:50 +02:00
|
|
|
chown -R root:root .
|
2013-11-25 12:23:31 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2010-05-12 23:28:50 +02:00
|
|
|
|
|
|
|
./configure \
|
|
|
|
--prefix=/usr \
|
2010-05-13 00:25:24 +02:00
|
|
|
--libdir=/usr/lib${LIBDIRSUFFIX} \
|
2010-05-12 23:28:50 +02:00
|
|
|
--mandir=/usr/man \
|
2010-05-13 00:25:24 +02:00
|
|
|
--docdir=/usr/doc/$PRGNAM-$VERSION \
|
2010-05-12 23:28:50 +02:00
|
|
|
--with-threads \
|
|
|
|
--enable-ipv6 \
|
2010-05-13 00:25:24 +02:00
|
|
|
--enable-shared \
|
2013-02-11 01:32:01 +01:00
|
|
|
--with-system-expat \
|
|
|
|
--with-system-ffi \
|
2010-05-13 00:25:24 +02:00
|
|
|
--build=$ARCH-slackware-linux
|
2010-05-12 23:28:50 +02:00
|
|
|
|
2010-06-12 13:07:37 +02:00
|
|
|
make
|
|
|
|
make altinstall DESTDIR=$PKG
|
2010-05-13 00:25:24 +02:00
|
|
|
|
2011-07-20 07:44:48 +02:00
|
|
|
# Create a few useful symlinks.
|
|
|
|
( cd $PKG/usr/bin
|
2012-11-20 19:03:52 +01:00
|
|
|
ln -sf python3.3 python3
|
|
|
|
ln -sf python3.3*-config python3.3-config
|
2014-03-13 02:31:46 +01:00
|
|
|
ln -sf python3.3-config python3-config
|
2012-11-20 19:03:52 +01:00
|
|
|
ln -sf pydoc3.3 pydoc3
|
|
|
|
ln -sf pyvenv-3.3 pyvenv
|
|
|
|
ln -sf idle3.3 idle3
|
2014-03-13 02:31:46 +01:00
|
|
|
cd $PKG/usr/man/man1
|
|
|
|
ln -sf python3.3.1 python3.1
|
2011-07-20 07:44:48 +02:00
|
|
|
)
|
2010-05-12 23:28:50 +02:00
|
|
|
|
|
|
|
# We'll install the python-tools under site-packages:
|
|
|
|
mkdir -p $SITEPK
|
2010-05-13 00:25:24 +02:00
|
|
|
cp -a Tools/* $SITEPK
|
|
|
|
|
2011-07-20 07:44:48 +02:00
|
|
|
# Install docs:
|
2010-12-11 07:29:31 +01:00
|
|
|
mkdir -p $PKG/usr/doc/python3-$VERSION
|
2011-07-20 07:44:48 +02:00
|
|
|
cp -a README LICENSE Misc $PKG/usr/doc/python3-$VERSION
|
2010-12-11 07:29:31 +01:00
|
|
|
mv $SITEPK/README $PKG/usr/doc/python3-$VERSION/README.python-tools
|
|
|
|
( cd $PKG/usr/doc/python3-$VERSION ; ln -sf $TOOLSDIR Tools )
|
2011-07-20 07:44:48 +02:00
|
|
|
tar xf $CWD/python-$VERSION-docs-html.tar.bz2
|
|
|
|
mv python-$VERSION-docs-html $PKG/usr/doc/python3-$VERSION/html
|
|
|
|
chown -R root:root $PKG/usr/doc/python3-$VERSION
|
2010-06-12 13:07:37 +02:00
|
|
|
|
2010-05-19 08:33:58 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-12 23:28:50 +02:00
|
|
|
|
2010-06-12 13:07:37 +02:00
|
|
|
find $PKG/usr/man -type f -exec gzip -9 {} \;
|
|
|
|
for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
|
2010-05-13 00:25:24 +02:00
|
|
|
|
2010-05-12 23:28:50 +02:00
|
|
|
mkdir -p $PKG/install
|
|
|
|
cat $CWD/slack-desc > $PKG/install/slack-desc
|
|
|
|
|
|
|
|
cd $PKG
|
2010-05-13 00:25:24 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|