LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Building Perl 5.16.2 RPM for CentOS 6 (http://www.linuxquestions.org/questions/linux-software-2/building-perl-5-16-2-rpm-for-centos-6-a-4175423673/)

rubanek 08-23-2012 03:11 PM

Building Perl 5.16.2 RPM for CentOS 6
 
I've been a linux sys admin for years and have managed to avoid having to build my own rpms. That all changes today. I'm trying to teach myself rpm building through google, but the documentation is falling short. Extremely short. How is it that documentation for such a fundamental part of the packaging system (being able to build packages) of one of the more popular distros (Redhat) be so difficult to find? Am I not looking in the right places?

Anyway, I've been able to discern what is happening to my spec file when I type rpmbuild -ba perl.spec. A shell script gets built in a tmp directory. Right now that shell script is getting created and then executed and is failing at the ./configure command. And for good reason... Perl's configure command is ./Configure (with a capital C).

Where the hell is the ./configure options being determined? I thought it was apart of the %configure macro so I commented that out. That didn't work. Then I thought it was a part of the %build macro. That didn't work either. What the hell?

The following code block contains the configure options that are somehow getting magically added to my that tmp shell script. I mean, geez, those are a lot of options to assume.

Code:

./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \
        --program-prefix= \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib64 \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --sharedstatedir=/var/lib \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info

I simply want it to be
Code:

./Configure -de
Is that so much to ask?

abrinister 08-23-2012 03:44 PM

Can you post the spec file?

Alex Brinister

rubanek 08-23-2012 03:53 PM

Here is the contents of the spec file:
Code:

[makerpm@centos-ami SPECS]$ cat perl.spec
Name:          perl
Version:        5.16.1
Release:        1%{?dist}
Summary:        Practical Extraction and Report Language
License:        GPLv1+
URL:            http://www.perl.org/
Source0:        %{name}-%{version}.tar.gz
BuildArch:      x86_64

%description


%prep
%setup -q


%build
#%configure
#make %{?_smp_mflags}

./Configure -de
make


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT


%files
%doc



%changelog

Here is the output of rpmbuild:
Code:

[makerpm@centos-ami SPECS]$ rpmbuild -ba perl.spec
Executing(%prep): /bin/sh -e /home/makerpm/rpmbuild/tmp/rpm-tmp.SBPPPS
+ umask 022
+ cd /home/makerpm/rpmbuild/BUILD
+ cd /home/makerpm/rpmbuild/BUILD
+ rm -rf perl-5.16.1
+ /bin/tar -xf -
+ /usr/bin/gzip -dc /home/makerpm/rpmbuild/SOURCES/perl-5.16.1.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd perl-5.16.1
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ exit 0
Executing(%build): /bin/sh -e /home/makerpm/rpmbuild/tmp/rpm-tmp.X76VHk
+ umask 022
+ cd /home/makerpm/rpmbuild/BUILD
+ cd perl-5.16.1
+ CFLAGS='-O2 -g'
+ export CFLAGS
+ CXXFLAGS='-O2 -g'
+ export CXXFLAGS
+ FFLAGS='-O2 -g'
+ export FFLAGS
+ ./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info
/home/makerpm/rpmbuild/tmp/rpm-tmp.X76VHk: line 32: ./configure: No such file or directory
error: Bad exit status from /home/makerpm/rpmbuild/tmp/rpm-tmp.X76VHk (%build)


RPM build errors:
    Bad exit status from /home/makerpm/rpmbuild/tmp/rpm-tmp.X76VHk (%build)

And here is the contents of tmp/rpm-tmp.X76VHk:
Code:

[makerpm@centos-ami SPECS]$ cat /home/makerpm/rpmbuild/tmp/rpm-tmp.X76VHk
#!/bin/sh

  RPM_SOURCE_DIR="/home/makerpm/rpmbuild/SOURCES"
  RPM_BUILD_DIR="/home/makerpm/rpmbuild/BUILD"
  RPM_OPT_FLAGS="-O2 -g"
  RPM_ARCH="x86_64"
  RPM_OS="linux"
  export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS
  RPM_DOC_DIR="/usr/share/doc"
  export RPM_DOC_DIR
  RPM_PACKAGE_NAME="perl"
  RPM_PACKAGE_VERSION="5.16.1"
  RPM_PACKAGE_RELEASE="1.el6"
  export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE
  LANG=C
  export LANG
  unset CDPATH DISPLAY ||:
  RPM_BUILD_ROOT="/home/makerpm/rpmbuild/BUILDROOT/perl-5.16.1-1.el6.x86_64"
  export RPM_BUILD_ROOT
 
  PKG_CONFIG_PATH="/usr/lib64/pkgconfig:/usr/share/pkgconfig"
  export PKG_CONFIG_PATH
 
  set -x
  umask 022
  cd "/home/makerpm/rpmbuild/BUILD"
cd 'perl-5.16.1'
#
  CFLAGS="${CFLAGS:--O2 -g}" ; export CFLAGS ;
  CXXFLAGS="${CXXFLAGS:--O2 -g}" ; export CXXFLAGS ;
  FFLAGS="${FFLAGS:--O2 -g}" ; export FFLAGS ;
  ./configure --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu \
        --program-prefix= \
        --prefix=/usr \
        --exec-prefix=/usr \
        --bindir=/usr/bin \
        --sbindir=/usr/sbin \
        --sysconfdir=/etc \
        --datadir=/usr/share \
        --includedir=/usr/include \
        --libdir=/usr/lib64 \
        --libexecdir=/usr/libexec \
        --localstatedir=/var \
        --sharedstatedir=/var/lib \
        --mandir=/usr/share/man \
        --infodir=/usr/share/info
#make

./Configure -de
make


abrinister 08-23-2012 04:03 PM

According to here, you can change RPM macros by editing your ~/.rpmmacros file.

Alex Brinister

rubanek 08-23-2012 05:23 PM

Thanks abrinister. Your link to that page is what I needed to get unstuck. That page referenced an rpm command:

Code:

rpm --showrc
Which I executed and got me thinking on a different tangent. I did a new google search and found that the configure options I was looking at were being defined here: /usr/lib/rpm/macros. I then created my own user specific version of %configure in my .rpmmacros that takes precedence.

Code:

[makerpm@centos-ami SPECS]$ cat ~/.rpmmacros
%_topdir              /home/makerpm/rpmbuild
%_tmppath              /home/makerpm/rpmbuild/tmp


%_configure ./Configure
%configure \
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
  FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
  %{_configure} -de

FTW!!!

Thanks!


All times are GMT -5. The time now is 04:52 PM.