aboutsummaryrefslogtreecommitdiff
path: root/development/python/python.build
diff options
context:
space:
mode:
Diffstat (limited to 'development/python/python.build')
-rwxr-xr-xdevelopment/python/python.build114
1 files changed, 114 insertions, 0 deletions
diff --git a/development/python/python.build b/development/python/python.build
new file mode 100755
index 0000000..4eef21c
--- /dev/null
+++ b/development/python/python.build
@@ -0,0 +1,114 @@
+#!/bin/bash
+#
+# Maintainer: Deposite Pirate <ofni.sknuplatem@etaripd>
+
+source /usr/src/ports/Build/build.sh
+
+NAME=python
+MAJOR=2.7
+VERSION=${MAJOR}.4
+BUILD=1
+OPTDEPENDS=('gdbm >= 1.10-1' 'bzip2 >= 1.0.6-1' 'openssl >= 1.0.1e-1' 'expat >= 2.1.0-1' 'sqlite >= 3.7.16.1-1')
+
+# Description
+
+cat > ${PKG}/install/slack-desc <<EOF
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description. Line
+# up the first '|' above the ':' following the base package name, and the '|'
+# on the right side marks the last column you can put a character in. You must
+# make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':'.
+
+$(padd)|-----handy-ruler------------------------------------------------------|
+${NAME}: python (object-oriented interpreted programming language)
+${NAME}:
+${NAME}: Python is an interpreted, interactive, object-oriented programming
+${NAME}: language that combines remarkable power with very clear syntax.
+${NAME}: Python's basic power can be extended with your own modules written in
+${NAME}: C or C++. Python is also adaptable as an extension language for
+${NAME}: existing applications.
+${NAME}:
+${NAME}: Homepage: http://www.python.org
+${NAME}:
+${NAME}:
+EOF
+
+# Sources
+
+PYTHONLIBDIR=${SYS_DIR[lib]}/python${MAJOR}
+
+SRCNAME[0]=Python
+SRCVERS[0]=${VERSION}
+SRCPACK[0]=http://www.python.org/ftp/python/2.7.4/${SRCNAME[0]}-${SRCVERS[0]}.tar.xz
+
+build0()
+{
+# Fix pkgconfig file location
+sed -i 's|$(LIBDIR)/pkgconfig|$(datarootdir)/pkgconfig|g' Makefile.pre.in
+# http://bugs.python.org/issue10835
+sed -i "/progname =/s/python/python${_pybasever}/" Python/pythonrun.c
+# Enable built-in SQLite module to load extensions
+sed -i "/SQLITE_OMIT_LOAD_EXTENSION/d" setup.py
+# On many systems /usr/local/bin is not in $PATH as passed to CGI scripts
+# and /usr/local/bin is the default directory where Python is installed,
+# so /usr/bin/env would be unable to find python. Granted, binary
+# installations by Linux vendors often install Python in /usr/bin. So let
+# those vendors patch cgi.py to match their choice of installation.
+sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python2|" Lib/cgi.py
+# Fix python2.3
+sed -i "s|python2.3|python2|g" \
+ Lib/distutils/tests/test_{build,install}_scripts.py \
+ Tools/scripts/gprof2html.py
+# Use system versions of these libraries
+rm -rf Modules/expat Modules/zlib Modules/_ctypes/{darwin,libffi}*
+export OPT="${FLAGS}"
+./configure \
+ --build="${ARCH}-slackware-linux" \
+ --enable-shared \
+ --prefix="${SYS_DIR[usr]}" \
+ --mandir="${SYS_DIR[man]}" \
+ --sysconfdir="${SYS_DIR[etc]}" \
+ --libdir="${SYS_DIR[lib]}" \
+ --localstatedir="${SYS_DIR[var]}" \
+ --with-threads \
+ --with-dbmliborder=gdbm:ndbm \
+ --with-system-expat \
+ --with-system-ffi \
+ --enable-ipv6 \
+ --enable-unicode=ucs4
+make ${JOBS}
+make altinstall maninstall DESTDIR="${PKG}"
+license LICENSE
+#FIXME: Add docs, demos and tools when there is subpackage support
+# A few symlinks
+(
+ cd ${PKG}${SYS_DIR[bin]}
+ ln -sf python${MAJOR} python2
+ ln -sf python${MAJOR} python
+ ln -sf python${MAJOR}-config python2-config
+)
+(
+ cd ${PKG}${SYS_DIR[man]}/man1
+ rm -f python.1 python2.1
+ echo ".so man1/python${MAJOR}.1" > python2.1
+ echo ".so man1/python${MAJOR}.1" > python.1
+)
+# Fix conflicts with python 3.x
+(
+ cd ${PKG}${SYS_DIR[bin]}
+ mv idle{,2}
+ mv pydoc{,2}
+ mv 2to3{,-${MAJOR}}
+ ln -sf idle2 idle
+ ln -sf pydoc2 pydoc
+ ln -sf 2to3-${MAJOR} 2to3
+)
+# We don't need smtp.py in /usr/bin
+mv ${PKG}${SYS_DIR[bin]}/smtpd.py ${PKG}${PYTHONLIBDIR}
+# python -> python2
+sed -i "s|#[ ]*![ ]*/usr/bin/env python$|#!/usr/bin/env python2|" \
+ $(find ${PKG}${PYTHONLIBDIR} -name '*.py')
+# More clean up...
+sed -i "s|${PKG}/Python-${SRCVERS[0]}:||g" ${PKG}${PYTHONLIBDIR}/config/Makefile
+}