use automake and libtool

This commits replaces the handwritten makefile with automake+libtool.
There is some hackery needed for the LD_PRELOAD shared library,
but apart from that there is nothing special and it is a large gain in
portability and standardization.

The spec file is modified as little as is needed to properly build
the RPMs.
This commit is contained in:
Paolo Bonzini
2011-10-28 14:29:43 +02:00
parent d56fa027ff
commit 17319072b1
10 changed files with 127 additions and 152 deletions

1
packaging/RPM/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/*.spec

View File

@@ -40,25 +40,13 @@ export CC
## always run autogen.sh
./autogen.sh
CFLAGS="$RPM_OPT_FLAGS $EXTRA -O0" ./configure \
--prefix=%{_prefix} \
--sysconfdir=%{_sysconfdir} \
--mandir=%{_mandir} \
--localstatedir="/var"
%configure
make
%install
# Clean up in case there is trash left from a previous build
rm -rf $RPM_BUILD_ROOT
# Create the target build directory hierarchy
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT%{_includedir}
mkdir -p $RPM_BUILD_ROOT%{_includedir}/iscsi
#
make DESTDIR=$RPM_BUILD_ROOT%{_prefix} LIBDIR=$RPM_BUILD_ROOT%{_libdir} install
make DESTDIR=$RPM_BUILD_ROOT install
# Remove "*.old" files
find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \;
@@ -73,10 +61,10 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%{_bindir}/ld_iscsi.so
%{_bindir}/iscsi-ls
%{_bindir}/iscsi-inq
%{_libdir}/libiscsi.so.1.0.0
%{_libdir}/libiscsi.so.*
%package devel
Summary: iSCSI client development libraries
@@ -90,6 +78,8 @@ development libraries for iSCSI
%{_includedir}/iscsi/iscsi.h
%{_includedir}/iscsi/scsi-lowlevel.h
%{_libdir}/libiscsi.a
%{_libdir}/libiscsi.la
%{_libdir}/libiscsi.so
%changelog
* Sat Dec 4 2010 : Version 1.0.0

View File

@@ -58,14 +58,15 @@ VERSION=$(grep ^Version ${DIRNAME}/${SPECFILE} | sed -e 's/^Version:\ \+//')
RELEASE=$(grep ^Release ${DIRNAME}/${SPECFILE} | sed -e 's/^Release:\ \+//')
if echo | gzip -c --rsyncable - > /dev/null 2>&1 ; then
GZIP="gzip -9 --rsyncable"
GZIP_ENV="-9 --rsyncable"
else
GZIP="gzip -9"
GZIP_ENV="-9"
fi
pushd ${TOPDIR}
echo -n "Creating libiscsi-${VERSION}.tar.gz ... "
git archive --prefix=libiscsi-${VERSION}/ HEAD | ${GZIP} > ${SRCDIR}/libiscsi-${VERSION}.tar.gz
sh autogen.sh
make dist GZIP_ENV="\"$GZIP_ENV\""
RC=$?
popd
echo "Done."
@@ -79,6 +80,7 @@ fi
##
## copy additional source files
##
cp -p ${TOPDIR}/libiscsi-${VERSION}.tar.gz ${SRCDIR}
cp -p ${DIRNAME}/${SPECFILE} ${SPECDIR}
##