python 2.7 自定义 RPM 编译[备忘]
来源:互联网 发布:request获取ip端口号 编辑:程序博客网 时间:2024/06/04 22:25
要求
把 python 2.7 进行编译
安装目标位置
可执行文件位置 /apps/svr/python27
其他库文件, 头文件, doc 安装位置 /apps/lib/python27
对应源码 python-2.7.5.tar.gz
参见 python-2.7_centOS5.8.spec 文件
%define _topdir %(echo `cd ..; pwd`)%define binsuffix 27%define pybasever 2.7%define version 2.7.5%define name python%define release 20140124vipclound.centOS58############# edit by terry ############%define _prefix /apps%define _exec-prefix /apps%define _bindir /apps/svr/python27%define _sbindir /apps/svr/python27%define _sysconfdir /apps/conf%define _includedir /apps/lib%define _libexecdir /apps/lib%define _infodir /apps/lib%define _oldincludedir /apps/lib%define _libdir /apps/lib%define _defaultdocdir /apps/lib%define config_include_docs no############# edit by terry ############Name: %{name}%{binsuffix}Version: %{version}Release: 20140121.vipclound.el5Summary: An interpreted, interactive, object-oriented programming language.Group: Development/LanguagesSource0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2License: PSFBuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)AutoReq: noProvides: python(abi) = %{pybasever}BuildRequires: autoconfBuildRequires: bzip2BuildRequires: bzip2-develBuildRequires: db4-develBuildRequires: expat-develBuildRequires: findutilsBuildRequires: gcc-c++BuildRequires: glibc-develBuildRequires: makeBuildRequires: openssl-develBuildRequires: pkgconfigBuildRequires: readline-develBuildRequires: sqlite-develBuildRequires: tarBuildRequires: zlib-devel%descriptionPython is an interpreted, interactive, object-oriented programminglanguage. It incorporates modules, exceptions, dynamic typing, very highlevel dynamic data types, and classes. Python combines remarkable powerwith very clear syntax. It has interfaces to many system calls andlibraries, as well as to various window systems, and is extensible in C orC++. It is also usable as an extension language for applications that needa programmable interface. Finally, Python is portable: it runs on manybrands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on theMac.%package develSummary: The libraries and header files needed for Python extension development.Requires: %{name} = %{version}-%{release}Group: Development/Libraries%description develThe Python programming language's interpreter can be extended withdynamically loaded extensions and can be embedded in other programs.This package contains the header files and libraries needed to dothese types of tasks.Install python-devel if you want to develop Python extensions. Thepython package will also need to be installed. You'll probably alsowant to install the python-docs package, which contains Pythondocumentation.%prep%setup -n Python-%{version}%build%configure \ --enable-ipv6 \ --enable-unicode=ucs4 \ --enable-shared \ --with-system-ffi \ --with-system-expat \%{__make} %{?_smp_mflags}%install[ -d $RPM_BUILD_ROOT ] && rm -fr $RPM_BUILD_ROOT%{__make} altinstall DESTDIR=$RPM_BUILD_ROOT%{__rm} -f $RPM_BUILD_ROOT%{_prefix}/bin/python{,2}%{__rm} -f $RPM_BUILD_ROOT%{_prefix}/bin/python{,2}-config%{__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%{_libdir}/pkgconfig/%{__ln_s} %{_libdir}/python2.7/config $RPM_BUILD_ROOT%{_prefix}/lib/python2.7/config%{__ln_s} %{_libdir}/python2.7/lib-dynload $RPM_BUILD_ROOT%{_prefix}/lib/python2.7/lib-dynload# 创建对应 ldconfig 库配置文件mkdir -p $RPM_BUILD_ROOT/apps/conf/python27touch $RPM_BUILD_ROOT/apps/conf/python27/python27.confecho "/apps/lib/" > $RPM_BUILD_ROOT/apps/conf/python27/python27.confecho "/apps/lib/python2.7/" > $RPM_BUILD_ROOT/apps/conf/python27/python27.conf# 手动创建 man file 否则无法创建 RPMgzip -c $RPM_BUILD_ROOT/%{_libdir}/man1/python2.7.1 >> $RPM_BUILD_ROOT/%{_libdir}/man1/python2.7.1.gz####### POST######%post# 移动对应库文件mv /apps/lib/libpython2.7.so.1.0 /apps/lib/python2.7/.ln -s /apps/lib/python2.7/libpython2.7.so.1.0 /apps/lib/python2.7/libpython2.7.so# 删除库文件(已备份) 删除 MAN FILErm -rf %{_libdir}/libpython2.7.so.1.0rm -rf %{_libdir}/libpython2.7.sorm -rf /%{_libdir}/man1mkdir /apps/svr/python -pln -s /apps/svr/python27/python2.7 /apps/svr/python/python%postunrm -rf /apps/lib/python2.7/libpython2.7.so.1.0 /apps/lib/python2.7/libpython2.7.sorm -rf /apps/svr/python/python%post devel# 移动头文件mv /apps/include/python2.7/pyconfig.h /apps/lib/python2.7/.total=`ls /apps/include/ | wc -l`if [ $total -eq 1 ]then rm -rf /apps/includefi%postun develrm -rf /apps/lib/python2.7/pyconfig.h%clean%{__rm} -rf $RPM_BUILD_ROOT%files%defattr(-,root,root,-)%{_prefix}/lib/python2.7/*%{_libdir}/python2.7/lib-dynload/*%{_libdir}/libpython2.7.so*%{_bindir}/python2.7*# %{_mandir}/man1/python2.7.1%{_bindir}/2to3%{_bindir}/idle%{_bindir}/pydoc%{_bindir}/smtpd.py%{_mandir}/man1/python2.7.1%config(noreplace) /apps/conf/python27/python27.conf# /apps/svr/python27/2to3# /apps/svr/python27/idle# /apps/svr/python27/pydoc# /apps/svr/python27/smtpd.py%doc%{_mandir}/man1/python2.7.1.gz%files devel%defattr(-,root,root,-)%{_prefix}/include/python2.7/*%{_libdir}/python2.7/config/*%changelog* Mon Jan 21 2014 Terry Tsang <signmem@hotmail.com> - 2.7.5-1- Initial RPM release
python-2.7_centOS5.8.spec 存放位置 /usr/src/redhat/SPECS/python-2.7.5.tar.gz 存放位置 /usr/src/redhat/SOURCES/
编译方法
rpm -bb python-2.7_centOS5.8.spec
参见 python-2.7_centOS6.5.spec 文件
%define _topdir %(echo `cd ..; pwd`)%define binsuffix 27%define pybasever 2.7%define version 2.7.5%define name python%define release 20140124vipclound.centOS65############# edit by terry ############%define _prefix /apps%define _exec-prefix /apps%define _bindir /apps/svr/python27%define _sbindir /apps/svr/python27%define _sysconfdir /apps/conf%define _includedir /apps/lib%define _libexecdir /apps/lib%define _infodir /apps/lib%define _oldincludedir /apps/lib%define _libdir /apps/lib%define _defaultdocdir /apps/lib#%define _mandir /apps/lib%define config_include_docs no############# edit by terry ############Name: %{name}%{binsuffix}Version: %{version}Release: 20140121.vipclound.el6Summary: An interpreted, interactive, object-oriented programming language.Group: Development/LanguagesSource0: http://www.python.org/ftp/python/%{version}/Python-%{version}.tar.bz2License: PSFBuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)AutoReq: noProvides: python(abi) = %{pybasever}BuildRequires: autoconfBuildRequires: bzip2BuildRequires: bzip2-develBuildRequires: db4-develBuildRequires: expat-develBuildRequires: findutilsBuildRequires: gcc-c++BuildRequires: glibc-devel# BuildRequires: gmp-devel# BuildRequires: libffi-devel# BuildRequires: libGL-devel# BuildRequires: libX11-develBuildRequires: make# BuildRequires: ncurses-develBuildRequires: openssl-develBuildRequires: pkgconfigBuildRequires: readline-develBuildRequires: sqlite-develBuildRequires: tar# BuildRequires: tcl-devel# BuildRequires: tix-devel# BuildRequires: tk-develBuildRequires: zlib-devel%descriptionPython is an interpreted, interactive, object-oriented programminglanguage. It incorporates modules, exceptions, dynamic typing, very highlevel dynamic data types, and classes. Python combines remarkable powerwith very clear syntax. It has interfaces to many system calls andlibraries, as well as to various window systems, and is extensible in C orC++. It is also usable as an extension language for applications that needa programmable interface. Finally, Python is portable: it runs on manybrands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on theMac.%package develSummary: The libraries and header files needed for Python extension development.Requires: %{name} = %{version}-%{release}Group: Development/Libraries%description develThe Python programming language's interpreter can be extended withdynamically loaded extensions and can be embedded in other programs.This package contains the header files and libraries needed to dothese types of tasks.Install python-devel if you want to develop Python extensions. Thepython package will also need to be installed. You'll probably alsowant to install the python-docs package, which contains Pythondocumentation.%prep%setup -n Python-%{version}%build%configure \ --enable-ipv6 \ --enable-unicode=ucs4 \ --enable-shared \ --with-system-ffi \ --with-system-expat \%{__make} %{?_smp_mflags}%install[ -d $RPM_BUILD_ROOT ] && rm -fr $RPM_BUILD_ROOT%{__make} altinstall DESTDIR=$RPM_BUILD_ROOT%{__rm} -f $RPM_BUILD_ROOT%{_prefix}/bin/python{,2}%{__rm} -f $RPM_BUILD_ROOT%{_prefix}/bin/python{,2}-config%{__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%{_libdir}/pkgconfig/%{__ln_s} %{_libdir}/python2.7/config $RPM_BUILD_ROOT%{_prefix}/lib/python2.7/config%{__ln_s} %{_libdir}/python2.7/lib-dynload $RPM_BUILD_ROOT%{_prefix}/lib/python2.7/lib-dynload# 创建对应 ldconfig 库配置文件mkdir -p $RPM_BUILD_ROOT/apps/conf/python27touch $RPM_BUILD_ROOT/apps/conf/python27/python27.confecho "/apps/lib/" > $RPM_BUILD_ROOT/apps/conf/python27/python27.confecho "/apps/lib/python2.7/" > $RPM_BUILD_ROOT/apps/conf/python27/python27.conf# 手动创建 man file 否则无法创建 RPMgzip -c $RPM_BUILD_ROOT/%{_libdir}/man1/python2.7.1 >> $RPM_BUILD_ROOT/%{_libdir}/man1/python2.7.1.gz####### POST######%post# 移动对应库文件mv /apps/lib/libpython2.7.so.1.0 /apps/lib/python2.7/.ln -s /apps/lib/python2.7/libpython2.7.so.1.0 /apps/lib/python2.7/libpython2.7.so# 删除库文件(已备份) 删除 MAN FILErm -rf %{_libdir}/libpython2.7.so.1.0rm -rf %{_libdir}/libpython2.7.sorm -rf /%{_libdir}/man1mkdir /apps/svr/python -pln -s /apps/svr/python27/python2.7 /apps/svr/python/python%postunrm -rf /apps/lib/python2.7/libpython2.7.so.1.0 /apps/lib/python2.7/libpython2.7.sorm -rf /apps/svr/python/python%post devel# 移动头文件mv /apps/include/python2.7/pyconfig.h /apps/lib/python2.7/.total=`ls /apps/include/ | wc -l`if [ $total -eq 1 ]then rm -rf /apps/includefi%postun develrm -rf /apps/lib/python2.7/pyconfig.h%clean%{__rm} -rf $RPM_BUILD_ROOT%files%defattr(-,root,root,-)%{_prefix}/lib/python2.7/*%{_libdir}/python2.7/lib-dynload/*%{_libdir}/libpython2.7.so*%{_bindir}/python2.7*# %{_mandir}/man1/python2.7.1%{_bindir}/2to3%{_bindir}/idle%{_bindir}/pydoc%{_bindir}/smtpd.py%{_mandir}/man1/python2.7.1%{_bindir}/smtpd.pyc%{_bindir}/smtpd.pyo%config(noreplace) /apps/conf/python27/python27.conf# /apps/svr/python27/2to3# /apps/svr/python27/idle# /apps/svr/python27/pydoc# /apps/svr/python27/smtpd.py%doc%{_mandir}/man1/python2.7.1.gz%files devel%defattr(-,root,root,-)%{_prefix}/include/python2.7/*%{_libdir}/python2.7/config/*%changelog* Mon Jan 21 2014 Terry Tsang <signmem@hotmail.com> - 2.7.5-1- Initial RPM release
python-2.7_centOS65.spec 存放位置 /root/rpmbuild/SPECS/python-2.7.5.tar.gz 存放位置 /root/rpmbuild/SOURCES/
编译方法
rpm -bb python-2.7_centOS65.spec
0 0
- python 2.7 自定义 RPM 编译[备忘]
- RPM 编译错误信息备忘
- rpm备忘
- zabbix-2.2.1 打造 server 端 自定义 rpm 方法 [备忘]
- Python脚本自动化编译RPM包
- Python多线程进行rpm包编译
- rpm 打包 关闭python 自动编译为pyc,pyo文件
- [备忘]RPM的查询功能
- python 备忘
- Python备忘
- python 备忘
- python备忘
- python备忘
- python备忘
- python备忘
- Python 备忘
- Python.备忘
- 源码编译RPM包
- 为什么程序设计中从0开始编号
- 山雷頤 (易經大意 韓長庚)
- 操作系统软件安装
- 深入理解Java HelloWorld
- 基于综合兴趣度的协同过滤推荐算法
- python 2.7 自定义 RPM 编译[备忘]
- 山天大畜 (易經大意 韓長庚)
- 【深入Java虚拟机】之七:Javac编译与JIT编译
- List去重复帮助类
- C# object 判断值是否相同
- 在线存储的终极选择:Dropbox
- bind + dhcpd 实现 动态 ddns
- 调和级数 复杂度分析 学习笔记
- C指针原理(82)-内存管理与控制