python.spec 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. ##
  2. ## python.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: python
  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: BASE
  31. Group: Language
  32. License: GPL
  33. Version: 2.5.2
  34. Release: 20080225
  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: python.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. %description
  94. Python is an interpreted, interactive, object-oriented programming
  95. language. Python combines remarkable power with very clear syntax.
  96. It has modules, classes, exceptions, very high level dynamic data
  97. types, and dynamic typing. There are interfaces to many system calls
  98. and libraries, as well as to various windowing systems (X11, Motif,
  99. Tk, Mac, MFC). New built-in modules are easily written in C or C++.
  100. Python is also usable as an extension language for applications that
  101. need a programmable interface.
  102. %track
  103. prog python = {
  104. version = %{version}
  105. url = http://www.python.org/download/
  106. regex = Python-(\d+(\.\d+)+)\.tar\.bz2
  107. }
  108. %prep
  109. %setup -q -n Python-%{version}
  110. %patch -p0
  111. %{l_shtool} subst \
  112. -e 's;altinstall bininstall maninstall;altinstall maninstall;' \
  113. -e 's;python$(VERSION);python;g' \
  114. Makefile.pre.in
  115. %{l_shtool} subst \
  116. -e 's;\(lib/python"\) *VERSION;\1;g' \
  117. Modules/getpath.c
  118. find Lib -name "*.py" -print |\
  119. xargs %{l_shtool} subst -q \
  120. -e 's;\+ *sys\.version\[:3\];;g' \
  121. -e 's;\+ *get_python_version();;g'
  122. %{l_shtool} subst \
  123. -e 's;python\$py_version_short;python;g' \
  124. Lib/distutils/command/install.py
  125. %build
  126. echo "" >config.cache
  127. %if "%{with_readline}" == "yes"
  128. ( echo "readline readline.c %{l_cppflags} %{l_ldflags} -lreadline -ltermcap"
  129. ) >>Modules/Setup.local
  130. %endif
  131. %if "%{with_db}" == "yes"
  132. ( echo "_bsddb _bsddb.c %{l_cppflags} %{l_ldflags} -ldb"
  133. ) >>Modules/Setup.local
  134. %endif
  135. %if "%{with_dbm}" == "yes"
  136. ( echo "dbm dbmmodule.c -DHAVE_NDBM_H %{l_cppflags} %{l_ldflags} -lndbm -lgdbm"
  137. echo "gdbm gdbmmodule.c -DHAVE_GDBM_H %{l_cppflags} %{l_ldflags} -lgdbm"
  138. ) >>Modules/Setup.local
  139. %endif
  140. %if "%{with_curses}" == "yes"
  141. ( echo "_curses_panel _curses_panel.c %{l_cppflags} %{l_ldflags} -lpanel -lncurses"
  142. ) >>Modules/Setup.local
  143. %endif
  144. %if "%{with_zlib}" == "yes"
  145. ( echo "zlib zlibmodule.c %{l_cppflags} %{l_ldflags} -lz"
  146. ) >>Modules/Setup.local
  147. %endif
  148. %if "%{with_bzip2}" == "yes"
  149. ( echo "bz2 bz2module.c %{l_cppflags} %{l_ldflags} -lbz2"
  150. ) >>Modules/Setup.local
  151. %endif
  152. %if "%{with_xml}" == "yes"
  153. ( echo "EXPAT_DIR=%{l_prefix}"
  154. echo "pyexpat pyexpat.c -DHAVE_EXPAT_H %{l_cppflags} %{l_ldflags} -lexpat"
  155. ) >>Modules/Setup.local
  156. %endif
  157. %if "%{with_locale}" == "yes"
  158. ( echo "_locale _localemodule.c %{l_cppflags} %{l_ldflags} -lintl -liconv"
  159. ) >>Modules/Setup.local
  160. %endif
  161. %if "%{with_ssl}" == "yes"
  162. ( echo "_socket socketmodule.c"
  163. echo "SSL=%{l_prefix}"
  164. echo "_ssl _ssl.c -DUSE_SSL %{l_cppflags openssl .} %{l_ldflags} -lssl -lcrypto"
  165. ) >>Modules/Setup.local
  166. %endif
  167. # getaddrinfo bug
  168. disableipv6=""
  169. case "%{l_platform -t}" in
  170. *-aix* ) disableipv6="--disable-ipv6" ;;
  171. esac
  172. CC="%{l_prefix}/bin/gcc" \
  173. CXX="%{l_cxx}" \
  174. CFLAGS="%{l_cflags -O}" \
  175. CXXFLAGS="%{l_cxxflags -O}" \
  176. LDFLAGS="%{l_ldflags}" \
  177. ./configure \
  178. --cache-file=./config.cache \
  179. --with-gcc \
  180. $disableipv6 \
  181. --prefix=%{l_prefix}
  182. %{l_make} %{l_mflags}
  183. %install
  184. rm -rf $RPM_BUILD_ROOT
  185. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  186. ln $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython*.a \
  187. $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython.a
  188. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/smtpd.py
  189. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/idle
  190. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/python/test
  191. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  192. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  193. %files -f files
  194. %clean
  195. rm -rf $RPM_BUILD_ROOT