码迷,mamicode.com
首页 > 其他好文 > 详细

spec打包方法

时间:2015-05-12 19:00:50      阅读:316      评论:0      收藏:0      [点我收藏+]

标签:spec rpm打包方法

一、~/.rpmmacros文件内容


%_prefix      /opt
%_topdir      %(echo $HOME)/rpmbuild
%_smp_mflags  -j3
#%__arch_install_post   /usr/lib/rpm/check-rpaths   /usr/lib/rpm/check-buildroot

#Build root path, where %install installs the package during build.
%buildroot              %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}

#XXX   Note: escaped %% for use in headerSprintf()
#%_build_name_fmt        %%{ARCH}/%{roles}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
%_build_name_fmt        %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm



#%_unpackaged_files_terminate_build 0

##########for system command
%_hostname    %(hostname)

##########for build
%build \
  cd %{_builddir} \
  cd %{name}-%{version} \
  cd %{software}-%{version}
##########for setup00
%setup00 \
  cd %{_builddir} \
  rm -rf %{name}-%{version} \
  mkdir %{name}-%{version} \
  cd %{name}-%{version}

##########for build00
%build00 \
  cd %{_builddir} \
  cd %{name}-%{version} \

#########for ./configure
%_configure ./configure
%configure \
  #CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
  #CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS; \
  #FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS; \
  %_configure --prefix=%{minstalldir}
########for make
%make \
  make %{?_smp_mflags} OPTIMIZE="%{optflags}"

#######for make install
%install \
  %build \
  rm -rf %{buildroot} \
  make install DESTDIR=%{?buildroot}

######for clean
#%clean \
#  [ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%clean00 \
    %clean \
    [ "%{buildroot}" != "/" ] && rm -rf %{buildroot} \
    rm -rf $RPM_BUILD_DIR/%{name}-%{version}


%path \
  source /etc/profile \
  ldconfig
%vendor        "Malong Guo <linuxc2012@163.com>"
%date `date +"%a %b %d %Y"`

二、svn.spec文件


%define     roles       msvn
%define     minstallroot    /
%define     minstalldir %{prefix}/%{roles}
%define     mlocal  %{prefix}/mlocal/nphpmlocal
%define     software    subversion


Name:        m%{software}
Version:    1.6.9
Release:    1%{?dist}
Summary:    A free open-source svn
Group:        Application/software
License:    GPL
SOURCE0:    nethogs-0.8.0.tar.gz
BuildRoot:    %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
Prefix:     %{_prefix}
BuildRequires:  openssl-devel
Requires:  openssl-devel
AutoReqProv:    no


%description
A free open-source subversion


%post
%path


%postun
%path


%prep
#rm -rf %{_builddir}/%{name}-%{version}
rm -rf %{buildroot}
%setup00
tar zxvf %{SOURCE0}
tar zxvf %{SOURCE1}



%build
%configure --with-openssl=/usr/local
%make
%make_install


mkdir -p %{buildroot}/etc/profile.d
echo "export PATH=%{minstalldir}/bin:\$PATH">%{buildroot}/etc/profile.d/%{roles}.sh
echo "export C_INCLUDE_PATH=%{minstalldir}/include:\$C_INCLUDE_PATH" >>%{buildroot}/etc/profile.d/%{roles}.sh
echo "export CPLUS_INCLUDE_PATH=%{minstalldir}/include:\$CPLUS_INCLUDE_PATH" >>%{buildroot}/etc/profile.d/%{roles}.sh
echo "export OBJC_INCLUDE_PATH=%{minstalldir}/include:\$OBJC_INCLUDE_PATH" >>%{buildroot}/etc/profile.d/%{roles}.sh

mkdir -p %{buildroot}/etc/ld.so.conf.d
echo "%{minstalldir}/lib" >%{buildroot}/etc/ld.so.conf.d/%{roles}.conf

%clean
#[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
#rm -rf %{_builddir}/%{name}-%{version}


%files
%defattr(-,root,root,-)
%{minstalldir}
/etc


%changelog
* Mon May 19 2014 Malong Guo <linuxc2012@163.com> -1.6.9-1
- subversion.


spec打包方法

标签:spec rpm打包方法

原文地址:http://linux2010.blog.51cto.com/3086655/1650737

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!