python/python.spec

Tue, 20 Sep 2011 15:24:08 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 20 Sep 2011 15:24:08 +0200
changeset 370
6475ac4895a9
parent 369
3429ba7ff8dc
child 524
241043c7d657
permissions
-rw-r--r--

Backport RPM boilerplate logic for legacy OpenPKG and update version.

michael@369 1 ##
michael@369 2 ## python.spec -- OpenPKG RPM Package Specification
michael@370 3 ## Copyright (c) 2000-2010 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@369 4 ##
michael@369 5 ## Permission to use, copy, modify, and distribute this software for
michael@369 6 ## any purpose with or without fee is hereby granted, provided that
michael@369 7 ## the above copyright notice and this permission notice appear in all
michael@369 8 ## copies.
michael@369 9 ##
michael@369 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@369 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@369 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@369 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@369 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@369 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@369 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@369 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@369 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@369 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@369 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@369 21 ## SUCH DAMAGE.
michael@369 22 ##
michael@369 23
michael@369 24 # package information
michael@369 25 Name: python
michael@369 26 Summary: The Python Programming Language
michael@369 27 URL: http://www.python.org/
michael@369 28 Vendor: Guido van Rossum
michael@369 29 Packager: OpenPKG Foundation e.V.
michael@369 30 Distribution: OpenPKG Community
michael@369 31 Class: BASE
michael@369 32 Group: Language
michael@369 33 License: GPL
michael@370 34 Version: 2.7.2
michael@370 35 Release: 20110914
michael@369 36
michael@369 37 # package options
michael@369 38 %option with_readline no
michael@369 39 %option with_db no
michael@369 40 %option with_dbm no
michael@369 41 %option with_curses no
michael@369 42 %option with_zlib no
michael@369 43 %option with_bzip2 no
michael@369 44 %option with_xml no
michael@369 45 %option with_locale no
michael@369 46 %option with_ssl no
michael@369 47
michael@369 48 # list of sources
michael@369 49 Source0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
michael@369 50 Patch0: python.patch
michael@369 51
michael@369 52 # build information
michael@370 53 Prefix: %{l_prefix}
michael@370 54 BuildRoot: %{l_buildroot}
michael@370 55 BuildPreReq: OpenPKG, openpkg >= 20060823, gcc
michael@370 56 PreReq: OpenPKG, openpkg >= 20060823, gcc
michael@369 57 BuildPreReq: zlib
michael@369 58 PreReq: zlib
michael@369 59 %if "%{with_readline}" == "yes"
michael@369 60 BuildPreReq: readline
michael@369 61 PreReq: readline
michael@369 62 %endif
michael@369 63 %if "%{with_db}" == "yes"
michael@369 64 BuildPreReq: db
michael@369 65 PreReq: db
michael@369 66 %endif
michael@369 67 %if "%{with_dbm}" == "yes"
michael@369 68 BuildPreReq: gdbm::with_ndbm = yes
michael@369 69 PreReq: gdbm::with_ndbm = yes
michael@369 70 %endif
michael@369 71 %if "%{with_curses}" == "yes"
michael@369 72 BuildPreReq: ncurses
michael@369 73 PreReq: ncurses
michael@369 74 %endif
michael@369 75 %if "%{with_zlib}" == "yes"
michael@369 76 BuildPreReq: zlib
michael@369 77 PreReq: zlib
michael@369 78 %endif
michael@369 79 %if "%{with_bzip2}" == "yes"
michael@369 80 BuildPreReq: bzip2
michael@369 81 PreReq: bzip2
michael@369 82 %endif
michael@369 83 %if "%{with_xml}" == "yes"
michael@369 84 BuildPreReq: expat
michael@369 85 PreReq: expat
michael@369 86 %endif
michael@369 87 %if "%{with_locale}" == "yes"
michael@369 88 BuildPreReq: gettext, libiconv
michael@369 89 PreReq: gettext, libiconv
michael@369 90 %endif
michael@369 91 %if "%{with_ssl}" == "yes"
michael@369 92 BuildPreReq: openssl
michael@369 93 PreReq: openssl
michael@369 94 %endif
michael@370 95 AutoReq: no
michael@370 96 AutoReqProv: no
michael@369 97
michael@369 98 %description
michael@369 99 Python is an interpreted, interactive, object-oriented programming
michael@369 100 language. Python combines remarkable power with very clear syntax.
michael@369 101 It has modules, classes, exceptions, very high level dynamic data
michael@369 102 types, and dynamic typing. There are interfaces to many system calls
michael@369 103 and libraries, as well as to various windowing systems (X11, Motif,
michael@369 104 Tk, Mac, MFC). New built-in modules are easily written in C or C++.
michael@369 105 Python is also usable as an extension language for applications that
michael@369 106 need a programmable interface.
michael@369 107
michael@369 108 %track
michael@369 109 prog python = {
michael@369 110 version = %{version}
michael@369 111 url = http://www.python.org/download/
michael@369 112 regex = Python-(2(\.\d+)+)\.tar\.bz2
michael@369 113 }
michael@369 114
michael@369 115 %prep
michael@369 116 %setup -q -n Python-%{version}
michael@369 117 %patch -p0
michael@370 118 %{l_shtool} subst \
michael@370 119 -e 's;\(LDSHARED=.*\)\$(CC);\1\\$(CC);g' \
michael@370 120 -e 's;\(LDCXXSHARED=.*\)\$(CXX);\1\\$(CXX);g' \
michael@370 121 configure
michael@369 122 %{l_shtool} subst \
michael@369 123 -e 's;altinstall bininstall maninstall;altinstall maninstall;' \
michael@369 124 -e 's;python$(VERSION);python;g' \
michael@369 125 Makefile.pre.in
michael@369 126 %{l_shtool} subst \
michael@369 127 -e 's;\(lib/python"\) *VERSION;\1;g' \
michael@369 128 Modules/getpath.c
michael@369 129 find Lib -name "*.py" -print |\
michael@369 130 xargs %{l_shtool} subst -q \
michael@369 131 -e 's;\+ *sys\.version\[:3\];;g' \
michael@369 132 -e 's;\+ *get_python_version();;g'
michael@369 133 %{l_shtool} subst \
michael@369 134 -e 's;python\$py_version_short;python;g' \
michael@369 135 Lib/distutils/command/install.py
michael@369 136 %{l_shtool} subst \
michael@369 137 -e 's;python{py_version_short};python;g' \
michael@369 138 Lib/sysconfig.py
michael@370 139
michael@370 140 %build
michael@370 141 echo "" >config.cache
michael@369 142 %if "%{with_readline}" == "yes"
michael@369 143 ( echo "readline readline.c %{l_cppflags} %{l_ldflags} -lreadline -ltermcap"
michael@369 144 ) >>Modules/Setup.local
michael@369 145 %endif
michael@369 146 %if "%{with_db}" == "yes"
michael@369 147 ( echo "_bsddb _bsddb.c %{l_cppflags} %{l_ldflags} -ldb"
michael@369 148 ) >>Modules/Setup.local
michael@369 149 %endif
michael@369 150 %if "%{with_dbm}" == "yes"
michael@369 151 ( echo "dbm dbmmodule.c -DHAVE_NDBM_H %{l_cppflags} %{l_ldflags} -lndbm -lgdbm"
michael@369 152 echo "gdbm gdbmmodule.c -DHAVE_GDBM_H %{l_cppflags} %{l_ldflags} -lgdbm"
michael@369 153 ) >>Modules/Setup.local
michael@369 154 %endif
michael@369 155 %if "%{with_curses}" == "yes"
michael@369 156 ( echo "_curses_panel _curses_panel.c %{l_cppflags} %{l_ldflags} -lpanel -lncurses"
michael@369 157 ) >>Modules/Setup.local
michael@369 158 %endif
michael@369 159 %if "%{with_zlib}" == "yes"
michael@369 160 ( echo "zlib zlibmodule.c %{l_cppflags} %{l_ldflags} -lz"
michael@369 161 ) >>Modules/Setup.local
michael@369 162 %endif
michael@369 163 %if "%{with_bzip2}" == "yes"
michael@369 164 ( echo "bz2 bz2module.c %{l_cppflags} %{l_ldflags} -lbz2"
michael@369 165 ) >>Modules/Setup.local
michael@369 166 %endif
michael@369 167 %if "%{with_xml}" == "yes"
michael@369 168 ( echo "EXPAT_DIR=%{l_prefix}"
michael@369 169 echo "pyexpat pyexpat.c -DHAVE_EXPAT_H %{l_cppflags} %{l_ldflags} -lexpat"
michael@369 170 ) >>Modules/Setup.local
michael@369 171 %endif
michael@369 172 %if "%{with_locale}" == "yes"
michael@369 173 ( echo "_locale _localemodule.c %{l_cppflags} %{l_ldflags} -lintl -liconv"
michael@369 174 ) >>Modules/Setup.local
michael@369 175 %endif
michael@369 176 %if "%{with_ssl}" == "yes"
michael@369 177 ( echo "_socket socketmodule.c"
michael@369 178 echo "SSL=%{l_prefix}"
michael@369 179 echo "_ssl _ssl.c -DUSE_SSL %{l_cppflags openssl .} %{l_ldflags} -lssl -lcrypto"
michael@369 180 ) >>Modules/Setup.local
michael@369 181 %endif
michael@369 182
michael@370 183 # getaddrinfo bug
michael@370 184 disableipv6=""
michael@370 185 case "%{l_platform -t}" in
michael@370 186 *-aix* ) disableipv6="--disable-ipv6" ;;
michael@370 187 esac
michael@370 188
michael@369 189 CC="%{l_prefix}/bin/gcc" \
michael@369 190 CXX="%{l_cxx}" \
michael@369 191 CFLAGS="%{l_cflags -O}" \
michael@369 192 OPT="%{l_cflags -O}" \
michael@369 193 CXXFLAGS="%{l_cxxflags -O}" \
michael@369 194 LDFLAGS="%{l_ldflags}" \
michael@369 195 ./configure \
michael@370 196 --cache-file=./config.cache \
michael@370 197 --with-gcc \
michael@370 198 $disableipv6 \
michael@369 199 --prefix=%{l_prefix} \
michael@369 200 --mandir=%{l_prefix}/man \
michael@369 201 --with-dbmliborder=ndbm \
michael@369 202 --with-gcc
michael@370 203 %{l_make} %{l_mflags -O}
michael@369 204
michael@369 205 %install
michael@370 206 rm -rf $RPM_BUILD_ROOT
michael@369 207 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
michael@369 208 ln $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython*.a \
michael@369 209 $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython.a
michael@369 210 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/smtpd.py
michael@369 211 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/idle
michael@369 212 rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/python/test
michael@369 213 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
michael@369 214 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@369 215
michael@369 216 %files -f files
michael@369 217
michael@369 218 %clean
michael@370 219 rm -rf $RPM_BUILD_ROOT
michael@369 220

mercurial