lot of improvements, i.e. for compiling rpms

master
Marc Wäckerlin 10 years ago
parent b77b1d0ce7
commit 9563b5d8de
  1. 18
      ax_check_qt.m4
  2. 51
      ax_init_standard_project.m4
  3. 55
      bootstrap.sh

@ -1,16 +1,16 @@
# SYNOPSIS
#
# Check if a module exists:
# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
#
# Abort if a module does not exist:
# AX_CXX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
# AX_REQUIRE_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
#
# DESCRIPTIONS
#
# qt_prefix
#
# Each call to AX_CXX_CHECK_QT should have a different prefix
# Each call to AX_CHECK_QT should have a different prefix
# value (with a few exceptions discussed later on). This value,
# usually provided in uppercase, is used as prefix to the
# variables holding the compiler flags and libraries reported by
@ -43,12 +43,18 @@ AC_DEFUN([AX_CXX_QT_TOOL], [
AC_MSG_CHECKING([for $2])
AC_ARG_VAR([$1], [path to Qt tool $2])
$1=${$1:-$(${PKG_CONFIG} --variable=$2_location Qt5Core)}
$1=${$1:-$(${PKG_CONFIG} --variable=host_bins Qt5Core)/$2-qt5}
$1=${$1:-$(${PKG_CONFIG} --variable=host_bins Qt5Core)/$2}
$1=${$1:-$(${PKG_CONFIG} --variable=$2_location QtCore)}
$1=${$1:-$(${PKG_CONFIG} --variable=host_bins QtCore)/$2}
$1=${$1:-$(${PKG_CONFIG} --variable=host_bins QtCore)/$2-qt4}
if ! which "${$1%% *}" > /dev/null; then
if which "$2" > /dev/null; then
if which "$2-qt5" > /dev/null; then
$1=$2-qt5
elif which "$2" > /dev/null; then
$1=$2
elif which "$2-qt4" > /dev/null; then
$1=$2-qt4
else
HAVE_$1=0
$1=""
@ -179,13 +185,13 @@ qrc_%.cxx: %.qrc
# SYNOPSIS
#
# AX_CXX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
# AX_CHECK_QT([qt_prefix], [list-of-qt-modules], [optional-modules])
#
# DESCRIPTIONS
#
# qt_prefix
#
# Each call to AX_CXX_CHECK_QT should have a different prefix
# Each call to AX_CHECK_QT should have a different prefix
# value (with a few exceptions discussed later on). This value,
# usually provided in uppercase, is used as prefix to the
# variables holding the compiler flags and libraries reported by

@ -3,45 +3,46 @@
## 1 2 3 4 5 6 7 8
## 45678901234567890123456789012345678901234567890123456789012345678901234567890
# m4_esyscmd_s does not exist on centos 5 and 6
m4_define([mrw_esyscmd_s], [m4_normalize(m4_esyscmd([$1]))])
# define least version number from subversion's revision number:
# it is taken modulo 256 due to a bug on Apple's MacOSX
m4_define(x_least, m4_esyscmd_s(
m4_define(x_least, mrw_esyscmd_s([
SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout"
for path in . .. ../..; do
if svn info $path 2>&1 > /dev/null; then
SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p')
(cd $path && svn2cl)
break;
fi
done
# Mac does not support LEAST > 255
echo $ECHO_N $(($SVN_REVISION%256))
))
]))
# define version number from subversion's revision number:
# it is taken modulo 256 due to a bug on Apple's MacOSX
# add to x_minor if revision number is > 256
m4_define(x_minor_fixed, m4_esyscmd_s(
m4_define(x_minor_fixed, mrw_esyscmd_s([
SVN_REVISION="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout"
for path in . .. ../..; do
if svn info $path 2>&1 > /dev/null; then
SVN_REVISION=$(LANG= svn info $path | sed -n 's/Last Changed Rev: //p')
(cd $path && svn2cl)
break;
fi
done
# Mac does not support LEAST > 255
echo $ECHO_N $((x_minor+$SVN_REVISION/256))
))
]))
# setup version number
m4_define(x_version, m4_esyscmd_s(
m4_define(x_version, mrw_esyscmd_s([
echo $ECHO_N x_major.x_minor_fixed.x_least
))
]))
## bugreport mail address is taken from <user@host> in first line of AUTHORS
m4_define(x_bugreport, m4_esyscmd_s(
m4_define(x_bugreport, mrw_esyscmd_s([
head -1 AUTHORS | \
sed -n 's,.*<\([-_.a-z0-9A-Z]*@[-_.a-z0-9A-Z]*\)>.*,\1,gp'
))
]))
m4_include(ax_check_qt.m4)
@ -84,7 +85,7 @@ AC_DEFUN([AX_ADD_MAKEFILE_TARGET_DEP], [
# $1 = variable name
AC_DEFUN([AX_SUBST], [
AC_SUBST([$1])
tmp_var=$(echo "${$1}" | awk 1 ORS='\\n')
tmp_var=$(echo "${$1}" | awk 1 ORS='\\n' | sed 's,\\n$,,')
tmp_var=${tmp_var//\"/\\\"}
tmp_var=${tmp_var//\'/\'\"\'\"\'}
tmp_var=${tmp_var//#/\\#}
@ -116,7 +117,7 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
esac
AM_CONDITIONAL(MINGW, test "$MINGW" = "yes")
AM_CONDITIONAL(MAC, test "$MAC" = "yes")
AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_NAME//-/_}'"
AM_CPPFLAGS+=" '-DMAKE_STRING(X)=\#X' '-DNAMESPACE=${PACKAGE_TARNAME//[^a-zA-Z0-9]/_}'"
AX_SUBST(NUMBERS)
AX_SUBST(HOME)
README=$(tail -n +3 README)
@ -164,7 +165,6 @@ AC_DEFUN([AX_INIT_STANDARD_PROJECT], [
test -f makefile.in && cat >> makefile.in <<EOF
#### Begin: Appended by $0
EXTRA_DIST = bootstrap.sh
doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
clean-standard-project-targets:
-rm -rf \${PACKAGE_NAME}-\${PACKAGE_VERSION}
-rm \${PACKAGE_TARNAME}-\${PACKAGE_VERSION}.tar.gz
@ -190,8 +190,9 @@ AC_DEFUN([AX_USE_CXX], [
AM_CPPFLAGS+=' -I ${top_srcdir}/src -I ${top_builddir}/src -I ${srcdir} -I ${builddir}'
AM_LDFLAGS+=' -L ${top_srcdir}/src -L ${top_builddir}/src'
# Get rid of that stupid -O2 -g opions!
CXXFLAGS="${CXXFLAGS:-}"
# Get rid of those stupid -g -O2 options!
CXXFLAGS="${CXXFLAGS//-g -O2/}"
CFLAGS="${CFLAGS//-g -O2/}"
# pass compile flags to make distcheck
AM_DISTCHECK_CONFIGURE_FLAGS="CXXFLAGS='${CXXFLAGS}' CPPFLAGS='${CPPFLAGS}' CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}'"
@ -311,14 +312,16 @@ EOF
# use this in configure.ac to support RPM packages
AC_DEFUN([AX_USE_RPM_PACKAGING], [
# m4_include(ax_rpm_rules.m4)
AC_CONFIG_FILES([${PACKAGE_NAME}.spec])
#AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-debian-targets], [makefile.in])
AX_ADD_MAKEFILE_TARGET_DEP([.PHONY], [rpm], [makefile.in])
#AX_ADD_MAKEFILE_TARGET_DEP([clean-am], [clean-rpm-targets], [makefile.in])
AX_ADD_MAKEFILE_TARGET_DEP([distclean-am], [distclean-rpm-targets], [makefile.in])
test -f makefile.in && cat >> makefile.in <<EOF
#### Begin: Appended by $0
EXTRA_DIST += \${PACKAGE_NAME}.spec.in
rpm: dist
rpmbuild -ba --define "_topdir \$(pwd)" --define "_sourcedir \$(pwd)" \${PACKAGE_NAME}.spec
rpmbuild -ba --define "_topdir \$\$(pwd)" --define "_sourcedir \$\$(pwd)" \${PACKAGE_NAME}.spec
distclean-rpm-targets:
-rm \${PACKAGE_NAME}.spec
#### End: $0
EOF
])
@ -364,7 +367,7 @@ doc: doxyfile
clean-documentation:
-rm doxygen.errors @PDF_DOC@
distclean-documentation:
-rm -r html latex
-rm -r html
-rm @PACKAGE_NAME@.doxytag
maintainer-clean-documentation:
-rm makefile.in
@ -374,7 +377,7 @@ install-data-documentation:
cp -r html \$(DESTDIR)\${docdir}/
uninstall-documentation:
-chmod -R u+w \$(DESTDIR)\${docdir}
-rm -rf \$(DESTDIR)\${docdir}/*
-rm -rf \$(DESTDIR)\${docdir}/html
#### End: $0
EOF
])
@ -415,8 +418,12 @@ AC_DEFUN([AX_PKG_REQUIRE], [
AC_SUBST(CPPFLAGS)
AC_SUBST(CXXFLAGS)
AC_SUBST(PKG_REQUIREMENTS)
if test -n "$3" -a "${$1_found}" != "no"; then
if test -n "$3"; then
if test "${$1_found}" = "no"; then
tmp_package="yes"
else
tmp_package=${$1_found}
fi
$1_found=no
old_CPPFLAGS=${CPPFLAGS}
CPPFLAGS=" ${$1_CFLAGS} ${CPPFLAGS}"

@ -391,7 +391,7 @@ ${HEADER}m4_define(x_package_name, ${DEFAULT_PROJECT_NAME}) # project's name
m4_define(x_major, 0) # project's major version
m4_define(x_minor, 0) # project's minor version
m4_include(ax_init_standard_project.m4)
AC_INIT(x_package_name, x_version, x_package_name)
AC_INIT(x_package_name, x_version, x_bugreport, x_package_name)
AM_INIT_AUTOMAKE([1.9 tar-pax])
AX_INIT_STANDARD_PROJECT
@ -724,7 +724,7 @@ to --condition AX_USE_RPM_PACKAGING ${PACKAGE_NAME}.spec.in <<EOF
Summary: @DESCRIPTION@
Name: @PACKAGE_NAME@
Version: @VERSION@
Release: 1
Release: @BUILD_NUMBER@%{?dist}
License: LGPL
Group: $(if testtag AX_USE_LIBTOOL; then
echo Development/Libraries/C++;
@ -732,17 +732,36 @@ else
echo Applications/...;
fi)
Source0: %{name}-%{version}.tar.gz
BuildRequires: pkg-config, subversion, autotools-devel, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_CXX_QT || testtag AX_CXX_CHECK_QT; then echo -n ", qtbase5-devel | libqt4-devel, qtbase5-devel-tools | qt4-devel-tools"; fi)
BuildRequires: gnupg, subversion, automake, autoconf$(
if testtag AX_USE_DOXYGEN; then
echo -n ", doxygen, graphviz";
fi)
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
$(if testtag AX_USE_CPPUNIT; then
cat <<EOF2
%if 0%{?fedora} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: cppunit-devel
%if 0%{?fedora} || 0%{?rhel} || 0%{?rhl} || 0%{?centos} || 0%{?centos_ver} || 0%{?centos_version}
BuildRequires: pkgconfig, redhat-lsb$(
if testtag AX_USE_CPPUNIT; then
echo -n ", cppunit-devel";
fi;
if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then
echo -n ", qt5-qtwebkit-devel";
fi)
%if 0%{?fedora} || 0%{?rhel} || 0%{?rhl}
$(if testtag AX_USE_DOXYGEN; then echo -n "BuildRequires: mscgen"; fi)
$(if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then echo -n "BuildRequires: qt5-qtbase-devel, qt5-qttools, qt5-qtwebkit-devel"; fi)
%else
$(if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then echo -n "BuildRequires: qt-devel"; fi)
%endif
%else%if 0%{?suse_version} || 0%{?sles_version}
BuildRequires: libcppunit-devel
BuildRequires: pkg-config, lsb-release$(
if testtag AX_USE_CPPUNIT; then
echo -n ", libcppunit-devel";
fi)
%if 0%{?suse_version} < 1200 || 0%{?sles_version} < 1200
$(if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then echo -n "BuildRequires: libqt4-devel, qt4-x11-tools, libQtWebKit-devel"; fi)
%else
$(if testtag AX_REQUIRE_QT || testtag AX_CHECK_QT; then echo -n "BuildRequires: libqt5-qtbase-devel, libqt5-qttools, libQt5WebKit5-devel"; fi)
%endif
%endif%endif
EOF2
fi)
%description
@README@
@ -754,8 +773,8 @@ fi)
%prep
%setup -q
./configure --prefix=/usr \
--docdir=/usr/share/doc/packages/@PACKAGE_NAME@ \
./configure --prefix=/usr \\
--docdir=/usr/share/doc/packages/@PACKAGE_NAME@ \\
--libdir=/usr/%_lib
%build
@ -769,9 +788,10 @@ rm -rf \$RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
/usr/bin/*
$(if testtag AX_USE_LIBTOOL; then
echo '/usr/%_lib/@PACKAGE_NAME@.so.*'
else
/usr/bin/
fi)
%doc
/usr/share/doc/packages/@PACKAGE_NAME@/AUTHORS
@ -784,7 +804,7 @@ fi)
$(if testtag AX_USE_LIBTOOL; then
cat <<EOF2
%package devel
Summary: C++ Wrapper around OpenSSL, PCSC and Cryptoki (development files)
Summary: @DESCRIPTION@
Group: Development/Libraries/C++
Requires: @PACKAGE_NAME@ = @VERSION@
@ -797,13 +817,11 @@ This Package contains all files required for developement.
%defattr(-,root,root,-)
/usr/%_lib/@PACKAGE_NAME@.so
/usr/%_lib/@PACKAGE_NAME@.a
/usr/%_lib/pkgconfig
/usr/%_lib/@PACKAGE_NAME@.la
/usr/%_lib/pkgconfig
/usr/include/
/usr/share/pkgconfig
%doc
/usr/share/doc/packages/@PACKAGE_NAME@/html
/usr/share/doc/packages/@PACKAGE_NAME@/@PACKAGE_NAME@.spec
EOF2
fi)
@ -817,6 +835,8 @@ done
to makefile.am<<EOF
${HEADER}SUBDIRS =${SUBDIRS}
doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog
MAINTAINERCLEANFILES = makefile.in
EOF
to --condition AX_USE_LIBTOOL src/${PACKAGE_NAME}.pc.in <<EOF
@ -839,6 +859,7 @@ if test -f makefile; then
fi
#### Bootstrap Before Configure ####
run --no-check svn2cl
run aclocal
run libtoolize --force
run automake -a

Loading…
Cancel
Save