python.spec 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. ##
  2. ## python.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2006 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ## Copyright (c) 2000-2006 Ralf S. Engelschall <http://engelschall.com/>
  5. ##
  6. ## Permission to use, copy, modify, and distribute this software for
  7. ## any purpose with or without fee is hereby granted, provided that
  8. ## the above copyright notice and this permission notice appear in all
  9. ## copies.
  10. ##
  11. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  12. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  14. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  15. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  18. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  19. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  20. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  21. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. ## SUCH DAMAGE.
  23. ##
  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.5
  35. Release: 20061103
  36. # package options
  37. %option with_readline yes
  38. %option with_db no
  39. %option with_dbm yes
  40. %option with_curses yes
  41. %option with_zlib yes
  42. %option with_bzip2 yes
  43. %option with_xml yes
  44. %option with_locale yes
  45. %option with_ssl yes
  46. # list of sources
  47. Source0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
  48. Patch0: python.patch
  49. # build information
  50. Prefix: %{l_prefix}
  51. BuildRoot: %{l_buildroot}
  52. BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
  53. PreReq: OpenPKG, openpkg >= 20040130, gcc
  54. BuildPreReq: zlib
  55. PreReq: zlib
  56. %if "%{with_readline}" == "yes"
  57. BuildPreReq: readline
  58. PreReq: readline
  59. %endif
  60. %if "%{with_db}" == "yes"
  61. BuildPreReq: db
  62. PreReq: db
  63. %endif
  64. %if "%{with_dbm}" == "yes"
  65. BuildPreReq: gdbm::with_ndbm = yes
  66. PreReq: gdbm::with_ndbm = yes
  67. %endif
  68. %if "%{with_curses}" == "yes"
  69. BuildPreReq: ncurses
  70. PreReq: ncurses
  71. %endif
  72. %if "%{with_zlib}" == "yes"
  73. BuildPreReq: zlib
  74. PreReq: zlib
  75. %endif
  76. %if "%{with_bzip2}" == "yes"
  77. BuildPreReq: bzip2
  78. PreReq: bzip2
  79. %endif
  80. %if "%{with_xml}" == "yes"
  81. BuildPreReq: expat
  82. PreReq: expat
  83. %endif
  84. %if "%{with_locale}" == "yes"
  85. BuildPreReq: gettext, libiconv
  86. PreReq: gettext, libiconv
  87. %endif
  88. %if "%{with_ssl}" == "yes"
  89. BuildPreReq: openssl
  90. PreReq: openssl
  91. %endif
  92. AutoReq: no
  93. AutoReqProv: no
  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 python = {
  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. CC="%{l_cc}" \
  169. CXX="%{l_cxx}" \
  170. CFLAGS="%{l_cflags -O}" \
  171. CXXFLAGS="%{l_cxxflags -O}" \
  172. LDFLAGS="%{l_ldflags}" \
  173. ./configure \
  174. --cache-file=./config.cache \
  175. --prefix=%{l_prefix}
  176. %{l_make} %{l_mflags}
  177. %install
  178. rm -rf $RPM_BUILD_ROOT
  179. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  180. ln $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython*.a \
  181. $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython.a
  182. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/smtpd.py
  183. rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/idle
  184. rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/python/test
  185. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  186. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
  187. %files -f files
  188. %clean
  189. rm -rf $RPM_BUILD_ROOT