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