python30.spec 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. ##
  2. ## python30.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2008 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. ##
  23. # package information
  24. Name: python30
  25. Summary: The Python Programming Language
  26. URL: http://www.python.org/
  27. Vendor: Guido van Rossum
  28. Packager: OpenPKG Foundation e.V.
  29. Distribution: OpenPKG Community
  30. Class: EVAL
  31. Group: Language
  32. License: GPL
  33. Version: 3.0.1
  34. Release: 20090216
  35. # package options
  36. %option with_readline no
  37. %option with_db no
  38. %option with_dbm no
  39. %option with_curses no
  40. %option with_zlib no
  41. %option with_bzip2 no
  42. %option with_xml no
  43. %option with_locale no
  44. %option with_ssl no
  45. # list of sources
  46. Source0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
  47. Patch0: python30.patch
  48. # build information
  49. Prefix: %{l_prefix}
  50. BuildRoot: %{l_buildroot}
  51. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
  52. PreReq: OpenPKG, openpkg >= 20040130, gcc
  53. BuildPreReq: zlib
  54. PreReq: zlib
  55. %if "%{with_readline}" == "yes"
  56. BuildPreReq: readline
  57. PreReq: readline
  58. %endif
  59. %if "%{with_db}" == "yes"
  60. BuildPreReq: db
  61. PreReq: db
  62. %endif
  63. %if "%{with_dbm}" == "yes"
  64. BuildPreReq: gdbm::with_ndbm = yes
  65. PreReq: gdbm::with_ndbm = yes
  66. %endif
  67. %if "%{with_curses}" == "yes"
  68. BuildPreReq: ncurses
  69. PreReq: ncurses
  70. %endif
  71. %if "%{with_zlib}" == "yes"
  72. BuildPreReq: zlib
  73. PreReq: zlib
  74. %endif
  75. %if "%{with_bzip2}" == "yes"
  76. BuildPreReq: bzip2
  77. PreReq: bzip2
  78. %endif
  79. %if "%{with_xml}" == "yes"
  80. BuildPreReq: expat
  81. PreReq: expat
  82. %endif
  83. %if "%{with_locale}" == "yes"
  84. BuildPreReq: gettext, libiconv
  85. PreReq: gettext, libiconv
  86. %endif
  87. %if "%{with_ssl}" == "yes"
  88. BuildPreReq: openssl
  89. PreReq: openssl
  90. %endif
  91. AutoReq: no
  92. AutoReqProv: no
  93. Provides: python = %{version}-%{release}
  94. %description
  95. Python is an interpreted, interactive, object-oriented programming
  96. language. Python combines remarkable power with very clear syntax.
  97. It has modules, classes, exceptions, very high level dynamic data
  98. types, and dynamic typing. There are interfaces to many system calls
  99. and libraries, as well as to various windowing systems (X11, Motif,
  100. Tk, Mac, MFC). New built-in modules are easily written in C or C++.
  101. Python is also usable as an extension language for applications that
  102. need a programmable interface.
  103. %track
  104. prog python30 = {
  105. version = %{version}
  106. url = http://www.python.org/download/
  107. regex = Python-(\d+(\.\d+)+)\.tar\.bz2
  108. }
  109. %prep
  110. %setup -q -n Python-%{version}
  111. %patch -p0
  112. %{l_shtool} subst \
  113. -e 's;altinstall bininstall maninstall;altinstall maninstall;' \
  114. -e 's;python$(VERSION);python;g' \
  115. Makefile.pre.in
  116. %{l_shtool} subst \
  117. -e 's;\(lib/python"\) *VERSION;\1;g' \
  118. Modules/getpath.c
  119. find Lib -name "*.py" -print |\
  120. xargs %{l_shtool} subst -q \
  121. -e 's;\+ *sys\.version\[:3\];;g' \
  122. -e 's;\+ *get_python_version();;g'
  123. %{l_shtool} subst \
  124. -e 's;python\$py_version_short;python;g' \
  125. Lib/distutils/command/install.py
  126. %build
  127. echo "" >config.cache
  128. %if "%{with_readline}" == "yes"
  129. ( echo "readline readline.c %{l_cppflags} %{l_ldflags} -lreadline -ltermcap"
  130. ) >>Modules/Setup.local
  131. %endif
  132. %if "%{with_db}" == "yes"
  133. ( echo "_bsddb _bsddb.c %{l_cppflags} %{l_ldflags} -ldb"
  134. ) >>Modules/Setup.local
  135. %endif
  136. %if "%{with_dbm}" == "yes"
  137. ( echo "_dbm _dbmmodule.c -DHAVE_NDBM_H %{l_cppflags} %{l_ldflags} -lndbm -lgdbm"
  138. echo "_gdbm _gdbmmodule.c -DHAVE_GDBM_H %{l_cppflags} %{l_ldflags} -lgdbm"
  139. ) >>Modules/Setup.local
  140. %endif
  141. %if "%{with_curses}" == "yes"
  142. ( echo "_curses_panel _curses_panel.c %{l_cppflags} %{l_ldflags} -lpanel -lncurses"
  143. ) >>Modules/Setup.local
  144. %endif
  145. %if "%{with_zlib}" == "yes"
  146. ( echo "zlib zlibmodule.c %{l_cppflags} %{l_ldflags} -lz"
  147. ) >>Modules/Setup.local
  148. %endif
  149. %if "%{with_bzip2}" == "yes"
  150. ( echo "bz2 bz2module.c %{l_cppflags} %{l_ldflags} -lbz2"
  151. ) >>Modules/Setup.local
  152. %endif
  153. %if "%{with_xml}" == "yes"
  154. ( echo "EXPAT_DIR=%{l_prefix}"
  155. echo "pyexpat pyexpat.c -DHAVE_EXPAT_H %{l_cppflags} %{l_ldflags} -lexpat"
  156. ) >>Modules/Setup.local
  157. %endif
  158. %if "%{with_locale}" == "yes"
  159. ( echo "_locale _localemodule.c %{l_cppflags} %{l_ldflags} -lintl -liconv"
  160. ) >>Modules/Setup.local
  161. %endif
  162. %if "%{with_ssl}" == "yes"
  163. ( echo "_socket socketmodule.c"
  164. echo "SSL=%{l_prefix}"
  165. echo "_ssl _ssl.c -DUSE_SSL %{l_cppflags openssl .} %{l_ldflags} -lssl -lcrypto"
  166. ) >>Modules/Setup.local
  167. %endif
  168. # getaddrinfo bug
  169. disableipv6=""
  170. case "%{l_platform -t}" in
  171. *-aix* ) disableipv6="--disable-ipv6" ;;
  172. esac
  173. CC="%{l_prefix}/bin/gcc" \
  174. CXX="%{l_cxx}" \
  175. CFLAGS="%{l_cflags -O}" \
  176. CXXFLAGS="%{l_cxxflags -O}" \
  177. LDFLAGS="%{l_ldflags}" \
  178. ./configure \
  179. --cache-file=./config.cache \
  180. --with-gcc \
  181. $disableipv6 \
  182. --prefix=%{l_prefix} \
  183. --mandir=%{l_prefix}/man
  184. %{l_make} %{l_mflags}
  185. %install
  186. rm -rf $RPM_BUILD_ROOT
  187. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  188. ln $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython*.a \
  189. $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython.a
  190. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/smtpd.py
  191. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/idle
  192. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/python/test
  193. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  194. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  195. %files -f files
  196. %clean
  197. rm -rf $RPM_BUILD_ROOT