Lesson 9

Dates: 6/21/2017
Building Linux packages
Linux System Administration


RPM spec file


  • Spec file for RPM packaging of our app.x and the libraries, appx.spec:
    # This is a sample spec file for appx 
    
    %define _topdir         /home/hostadm/rpmbuild  
    %define name            appx 
    %define release         0
    %define version         1.0
    %define buildroot       %{_topdir}/%{name}-%{version}-root
    
    BuildRoot:              %{buildroot}
    Summary:                appx application 
    License:                free    
    Name:                   %{name}
    Version:                %{version}
    Release:                %{release}
    Source:                 %{name}-%{version}.tgz
    Group:                  my_group        
    
    %description
    The appx program computes scalar product of two vectors. 
    
    %prep
    %setup -q
    
    %build
    ./configure
    make all
    
    %install
    rm -rf $RPM_BUILD_ROOT
    mkdir -p $RPM_BUILD_ROOT/usr/local/bin
    mkdir -p $RPM_BUILD_ROOT/usr/local/lib
    mkdir -p $RPM_BUILD_ROOT/usr/local/include
    cd %{_topdir}/BUILD/appx-1.0
    install -m 755 src1/app.x $RPM_BUILD_ROOT/usr/local/bin/app.x
    install -m 644 src1/libScalar_Product.a $RPM_BUILD_ROOT/usr/local/lib/libScalar_Product.a
    install -m 644 include/Scalar_Product.h $RPM_BUILD_ROOT/usr/local/include/Scalar_Product.h
    
    %files
    %defattr(-,root,root)
    /usr/local/bin/app.x
    /usr/local/lib/libScalar_Product.a
    /usr/local/include/Scalar_Product.h
    
    %changelog
    * Wed Jun 29 2016 hostadm 
    - Built a new version
    




  • Take me to the Course Website