python/python.spec

changeset 369
3429ba7ff8dc
child 370
6475ac4895a9
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/python/python.spec	Tue Sep 20 15:22:39 2011 +0200
     1.3 @@ -0,0 +1,202 @@
     1.4 +##
     1.5 +##  python.spec -- OpenPKG RPM Package Specification
     1.6 +##  Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
     1.7 +##
     1.8 +##  Permission to use, copy, modify, and distribute this software for
     1.9 +##  any purpose with or without fee is hereby granted, provided that
    1.10 +##  the above copyright notice and this permission notice appear in all
    1.11 +##  copies.
    1.12 +##
    1.13 +##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    1.14 +##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    1.15 +##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.16 +##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
    1.17 +##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.18 +##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.19 +##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
    1.20 +##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    1.21 +##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    1.22 +##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
    1.23 +##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.24 +##  SUCH DAMAGE.
    1.25 +##
    1.26 +
    1.27 +#   package information
    1.28 +Name:         python
    1.29 +Summary:      The Python Programming Language
    1.30 +URL:          http://www.python.org/
    1.31 +Vendor:       Guido van Rossum
    1.32 +Packager:     OpenPKG Foundation e.V.
    1.33 +Distribution: OpenPKG Community
    1.34 +Class:        BASE
    1.35 +Group:        Language
    1.36 +License:      GPL
    1.37 +Version:      2.7.1
    1.38 +Release:      20110212
    1.39 +
    1.40 +#   package options
    1.41 +%option       with_readline      no
    1.42 +%option       with_db            no
    1.43 +%option       with_dbm           no
    1.44 +%option       with_curses        no
    1.45 +%option       with_zlib          no
    1.46 +%option       with_bzip2         no
    1.47 +%option       with_xml           no
    1.48 +%option       with_locale        no
    1.49 +%option       with_ssl           no
    1.50 +
    1.51 +#   list of sources
    1.52 +Source0:      http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2
    1.53 +Patch0:       python.patch
    1.54 +
    1.55 +#   build information
    1.56 +BuildPreReq:  OpenPKG, openpkg >= 20100101, gcc
    1.57 +PreReq:       OpenPKG, openpkg >= 20100101, gcc
    1.58 +BuildPreReq:  zlib
    1.59 +PreReq:       zlib
    1.60 +%if "%{with_readline}" == "yes"
    1.61 +BuildPreReq:  readline
    1.62 +PreReq:       readline
    1.63 +%endif
    1.64 +%if "%{with_db}" == "yes"
    1.65 +BuildPreReq:  db
    1.66 +PreReq:       db
    1.67 +%endif
    1.68 +%if "%{with_dbm}" == "yes"
    1.69 +BuildPreReq:  gdbm::with_ndbm = yes
    1.70 +PreReq:       gdbm::with_ndbm = yes
    1.71 +%endif
    1.72 +%if "%{with_curses}" == "yes"
    1.73 +BuildPreReq:  ncurses
    1.74 +PreReq:       ncurses
    1.75 +%endif
    1.76 +%if "%{with_zlib}" == "yes"
    1.77 +BuildPreReq:  zlib
    1.78 +PreReq:       zlib
    1.79 +%endif
    1.80 +%if "%{with_bzip2}" == "yes"
    1.81 +BuildPreReq:  bzip2
    1.82 +PreReq:       bzip2
    1.83 +%endif
    1.84 +%if "%{with_xml}" == "yes"
    1.85 +BuildPreReq:  expat
    1.86 +PreReq:       expat
    1.87 +%endif
    1.88 +%if "%{with_locale}" == "yes"
    1.89 +BuildPreReq:  gettext, libiconv
    1.90 +PreReq:       gettext, libiconv
    1.91 +%endif
    1.92 +%if "%{with_ssl}" == "yes"
    1.93 +BuildPreReq:  openssl
    1.94 +PreReq:       openssl
    1.95 +%endif
    1.96 +
    1.97 +%description
    1.98 +    Python is an interpreted, interactive, object-oriented programming
    1.99 +    language. Python combines remarkable power with very clear syntax.
   1.100 +    It has modules, classes, exceptions, very high level dynamic data
   1.101 +    types, and dynamic typing. There are interfaces to many system calls
   1.102 +    and libraries, as well as to various windowing systems (X11, Motif,
   1.103 +    Tk, Mac, MFC). New built-in modules are easily written in C or C++.
   1.104 +    Python is also usable as an extension language for applications that
   1.105 +    need a programmable interface.
   1.106 +
   1.107 +%track
   1.108 +    prog python = {
   1.109 +        version   = %{version}
   1.110 +        url       = http://www.python.org/download/
   1.111 +        regex     = Python-(2(\.\d+)+)\.tar\.bz2
   1.112 +    }
   1.113 +
   1.114 +%prep
   1.115 +    %setup -q -n Python-%{version}
   1.116 +    %patch -p0
   1.117 +
   1.118 +%build
   1.119 +    %{l_shtool} subst %{l_value -s -a} \
   1.120 +        setup.py
   1.121 +    %{l_shtool} subst \
   1.122 +        -e 's;altinstall bininstall maninstall;altinstall maninstall;' \
   1.123 +        -e 's;python$(VERSION);python;g' \
   1.124 +        Makefile.pre.in
   1.125 +    %{l_shtool} subst \
   1.126 +        -e 's;\(lib/python"\) *VERSION;\1;g' \
   1.127 +        Modules/getpath.c
   1.128 +    find Lib -name "*.py" -print |\
   1.129 +    xargs %{l_shtool} subst -q \
   1.130 +        -e 's;\+ *sys\.version\[:3\];;g' \
   1.131 +        -e 's;\+ *get_python_version();;g'
   1.132 +    %{l_shtool} subst \
   1.133 +        -e 's;python\$py_version_short;python;g' \
   1.134 +        Lib/distutils/command/install.py
   1.135 +    %{l_shtool} subst \
   1.136 +        -e 's;python{py_version_short};python;g' \
   1.137 +        Lib/sysconfig.py
   1.138 +%if "%{with_readline}" == "yes"
   1.139 +    ( echo "readline readline.c %{l_cppflags} %{l_ldflags} -lreadline -ltermcap"
   1.140 +    ) >>Modules/Setup.local
   1.141 +%endif
   1.142 +%if "%{with_db}" == "yes"
   1.143 +    ( echo "_bsddb  _bsddb.c %{l_cppflags} %{l_ldflags} -ldb"
   1.144 +    ) >>Modules/Setup.local
   1.145 +%endif
   1.146 +%if "%{with_dbm}" == "yes"
   1.147 +    ( echo "dbm  dbmmodule.c  -DHAVE_NDBM_H %{l_cppflags} %{l_ldflags} -lndbm -lgdbm"
   1.148 +      echo "gdbm gdbmmodule.c -DHAVE_GDBM_H %{l_cppflags} %{l_ldflags} -lgdbm"
   1.149 +    ) >>Modules/Setup.local
   1.150 +%endif
   1.151 +%if "%{with_curses}" == "yes"
   1.152 +    ( echo "_curses_panel _curses_panel.c %{l_cppflags} %{l_ldflags} -lpanel -lncurses"
   1.153 +    ) >>Modules/Setup.local
   1.154 +%endif
   1.155 +%if "%{with_zlib}" == "yes"
   1.156 +    ( echo "zlib zlibmodule.c %{l_cppflags} %{l_ldflags} -lz"
   1.157 +    ) >>Modules/Setup.local
   1.158 +%endif
   1.159 +%if "%{with_bzip2}" == "yes"
   1.160 +    ( echo "bz2 bz2module.c %{l_cppflags} %{l_ldflags} -lbz2"
   1.161 +    ) >>Modules/Setup.local
   1.162 +%endif
   1.163 +%if "%{with_xml}" == "yes"
   1.164 +    ( echo "EXPAT_DIR=%{l_prefix}"
   1.165 +      echo "pyexpat pyexpat.c -DHAVE_EXPAT_H %{l_cppflags} %{l_ldflags} -lexpat"
   1.166 +    ) >>Modules/Setup.local
   1.167 +%endif
   1.168 +%if "%{with_locale}" == "yes"
   1.169 +    ( echo "_locale _localemodule.c %{l_cppflags} %{l_ldflags} -lintl -liconv"
   1.170 +    ) >>Modules/Setup.local
   1.171 +%endif
   1.172 +%if "%{with_ssl}" == "yes"
   1.173 +    ( echo "_socket socketmodule.c"
   1.174 +      echo "SSL=%{l_prefix}"
   1.175 +      echo "_ssl _ssl.c -DUSE_SSL %{l_cppflags openssl .} %{l_ldflags} -lssl -lcrypto"
   1.176 +    ) >>Modules/Setup.local
   1.177 +%endif
   1.178 +
   1.179 +    CC="%{l_prefix}/bin/gcc" \
   1.180 +    CXX="%{l_cxx}" \
   1.181 +    CFLAGS="%{l_cflags -O}" \
   1.182 +    OPT="%{l_cflags -O}" \
   1.183 +    CXXFLAGS="%{l_cxxflags -O}" \
   1.184 +    LDFLAGS="%{l_ldflags}" \
   1.185 +    ./configure \
   1.186 +        --prefix=%{l_prefix} \
   1.187 +        --mandir=%{l_prefix}/man \
   1.188 +        --with-dbmliborder=ndbm \
   1.189 +        --with-gcc
   1.190 +    %{l_make} %{l_mflags}
   1.191 +
   1.192 +%install
   1.193 +    %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
   1.194 +    ln $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython*.a \
   1.195 +       $RPM_BUILD_ROOT%{l_prefix}/lib/python/config/libpython.a
   1.196 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/bin/smtpd.py
   1.197 +    rm -f  $RPM_BUILD_ROOT%{l_prefix}/bin/idle
   1.198 +    rm -rf $RPM_BUILD_ROOT%{l_prefix}/lib/python/test
   1.199 +    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   1.200 +    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   1.201 +
   1.202 +%files -f files
   1.203 +
   1.204 +%clean
   1.205 +

mercurial