[Rpmbuild] Python 2.7.6

Referenz

https://github.com/pingviini/rhel6-rpmbuild/blob/master/rpmbuild/SPECS/python27.spec

python27.spec


#----------------------------------------------------------
# yum install -y rpmdevtools tar wget
# yum install -y bzip2-devel db4-devel expat-devel openssl-devel readline-devel sqlite-devel zlib-devel
# yum groupinstall "Development Tools"
# useradd rpmbuilder
# su - rpmbuilder
# rpmdev-setuptree || mkdir -p rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
# wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz -O rpmbuild/SOURCES/Python-2.7.6.tgz
# cd rpmbuild/SPECS/
# rpmdev-newspec python27
# vim python27.spec
# rpmbuild -bb --clean python27.spec
#----------------------------------------------------------
#--- GLOBAL-MODIFIABLE CONFIGS ---
#----------------------------------------------------------
%define _topdir             %(echo $HOME)/rpmbuild
%define _smp_mflags         -j3
%define __arch_install_post /usr/lib/rpm/check-buildroot
%define debug_package       %{nil}

#----------------------------------------------------------
#--- USER-MODIFIABLE CONFIGS ---
#----------------------------------------------------------
%define name        Python
%define binsuffix   27
%define version     2.7.6
%define libvers     2.7
%define vendor      mykysyk
%define release     1
%define __prefix    /usr/local

#----------------------------------------------------------
#--- SUMMARY ---
#----------------------------------------------------------
Summary: An interpreted, interactive, object-oriented programming language.
Name: %{name}%{binsuffix}
Version: %{version}
Release: %{release}.%{vendor}.%((grep -q '6\.' /etc/issue && echo el6)||echo el5)
License: PSF
Group: Development/Languages
Source: https://www.python.org/ftp/python/%{version}/Python-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: glibc-devel
BuildRequires: bzip2-devel
BuildRequires: db4-devel
BuildRequires: expat-devel
BuildRequires: openssl-devel
BuildRequires: readline-devel
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
Prefix: %{__prefix}

%description
Python

%changelog
* Sun May 18 2014 mykysyk <mykysyk> [2.7.6-1]
- Initial RPM releas

#----------------------------------------------------------
#--- PREP ---
#----------------------------------------------------------
%prep
%setup -n Python-%{version}

#----------------------------------------------------------
#--- BUILD ---
#----------------------------------------------------------
%build

#--- CONFIGURE
./configure \
    --enable-unicode=ucs4 \
    --enable-shared \
    --enable-ipv6 \
    --with-system-ffi \
    --with-system-expat \
    --prefix=%{__prefix}

#--- MAKE
make %{?_smp_mflags}

#----------------------------------------------------------
#--- INSTALL ---
#----------------------------------------------------------
%install

[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

#--- MAKE INSTALL
make install DESTDIR=$RPM_BUILD_ROOT

rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/python
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/python-*
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/python2
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/python2-*
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/2to3
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/idle
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/pydoc
rm -f  $RPM_BUILD_ROOT%{__prefix}/bin/smtpd.py
rm -rf $RPM_BUILD_ROOT%{__prefix}/lib/pkgconfig
find   $RPM_BUILD_ROOT -type f -print0 |
       xargs -0 grep -l /usr/local/bin/python |
       while read file
       do
          sed -i 's|^#!.*python|#!/usr/bin/env python'"%{libvers}"'|'  $file
       done
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "%{__prefix}/lib" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/python%{binsuffix}.conf

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

#----------------------------------------------------------
#--- FILES ---
#----------------------------------------------------------
%files
%defattr(-,root,root)
%{__prefix}/bin/python*
%{__prefix}/lib/python%{libvers}/*
%{__prefix}/lib/libpython*
%{__prefix}/include/python%{libvers}/*.h
%{__prefix}/share/man/man1/*
%config(noreplace) /etc/ld.so.conf.d/python27.conf

UCS2 and UCS4 Referenz http://docs.python.jp/2/c-api/unicode.html http://dsas.blog.klab.org/archives/51322951.html

shell


python -c 'import sys;print sys.maxunicode'

ucs2


65535

ucs4


1114111

Recommended Posts

[Rpmbuild] Python 3.7.3.
[Rpmbuild] Python 2.7.6
Python
Kafka Python
Python-Grundlagen ⑤
Python-Zusammenfassung
Eingebaute Python
Python-Technik
Python studieren
Python 2.7 Countdown
Python-Memorandum
Python-Tipps
Python-Funktion ①
Python-Grundlagen
Python-Memo
Ufo-> Python (3)
Installieren Sie Python
Python Singleton
Python-Grundlagen ④
Python-Memorandum 2
Python-Memo
Python Jinja2
Python-Inkrement
atCoder 173 Python
[Python] -Funktion
Python-Installation
Python installieren 3.4.3.
Versuchen Sie Python
Python iterativ
Python-Algorithmus
Python2 + word2vec
[Python] -Variablen
Python-Funktionen
Python sys.intern ()
Python-Tutorial
Python-Fraktion
Python Underbar Das ist was
Starten Sie Python
[Python] Sortieren
Hinweis: Python
Python-Protokoll ausgeben
Python-Grundlagen
[Scraping] Python-Scraping
Python-Update (2.6-> 2.7)
Python-Memo
Python-Memorandum
Python #sort
Ufo-> Python
Python nslookup
Prorate Python (1)
Python Memorandum
Laden Sie Python herunter
Python Memorandum
Python-Memo
Python gestartet
Python #JSON
Python-Quiz
Python-Codierung