From b593a5d0b1a6ddf163507f1f80d1f4cf5d974fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20W=C3=A4ckerlin?= Date: Thu, 10 Nov 2011 10:31:08 +0000 Subject: [PATCH] new make target rpm; builds versionnumber; closes #1 --- configure.in | 44 +++++++++++++++++++++------ doc/examples/makefile.am | 10 +++--- doc/makefile.am | 23 ++++++-------- libpcscxx.spec.in | 66 ++++++++++++++++++++++++++++++++++++++++ makefile.am | 32 ++++++++----------- src/makefile.am | 15 ++++----- 6 files changed, 135 insertions(+), 55 deletions(-) create mode 100644 libpcscxx.spec.in diff --git a/configure.in b/configure.in index 5e79bdb..293b293 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,19 @@ # $Id$ +AC_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) +AC_DEFUN([AX_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ax_define_dir="\"[$]$2\"" + eval ax_define_dir="\"$ax_define_dir\"" + AC_SUBST($1, "$ax_define_dir") + AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) AC_INIT([README]) SRC_DIR=src @@ -11,29 +26,35 @@ m4_define(x_minor, 0) PACKAGENAME=x_packagename MAJOR=x_major MINOR=x_minor -LEAST="ERROR-UNDEFINED-REVISION-to-be-built-in-subdirectory-of-svn-checkout" -for path in . .. ../..; do - if svn info $path 2>&1 > /dev/null; then +BUILDDATE=$(date "+%d.%m.%Y/%H.%M") + +if svn info . 2>&1 > /dev/null; then LEAST=$(LANG= svn info $path | sed -n 's/Revision: //p') break; - fi -done +else + LEAST=[$(pwd | sed -n 's,^.*/'${PACKAGENAME}'-'${MAJOR}'\.'${MINOR}'\.\([0-9]*\).*$,\1,p')] + if test -z "${LEAST}"; then + LEAST="ERROR CANNOT DETERMINE REVISION NUMBER from $(pwd)" + fi +fi AM_INIT_AUTOMAKE($PACKAGENAME, $MAJOR.$MINOR.$LEAST, [marc@waeckerlin.org]) # files to create -AC_CONFIG_FILES([makefile +AC_CONFIG_FILES([makefile ${PACKAGENAME}.spec src/makefile doc/doxyfile doc/examples/makefile doc/makefile - src/libpcscxx.pc debian/changelog]) + src/${PACKAGENAME}.pc debian/changelog]) +# copy M4 to shell AC_SUBST(MAJOR) AC_SUBST(MINOR) AC_SUBST(LEAST) +AC_SUBST(BUILDDATE) # libtool versioning LIB_MAJOR=m4_eval(x_major+x_minor) -LIB_MINOR=$LEAST +LIB_MINOR=${LEAST} LIB_LEAST=x_minor LIB_VERSION="${LIB_MAJOR}:${LIB_MINOR}:${LIB_LEAST}" AC_SUBST(LIB_VERSION) @@ -41,6 +62,10 @@ AC_SUBST(LIB_VERSION) # home AC_SUBST(HOME) +# datadir for languages +AX_DEFINE_DIR([DATADIR], [datadir]) +#AC_SUBST(DATADIR) + # macros README=README AC_SUBST_FILE(README) @@ -64,6 +89,7 @@ AC_PROG_MAKE_SET AC_PROG_LIBTOOL AC_CHECK_PROG(have_doxygen, doxygen, yes, no) AC_CHECK_PROG(have_dot, dot, yes, no) +PKG_PROG_PKG_CONFIG AC_ARG_ENABLE(pedantic, [AS_HELP_STRING([--enable-pedantic], @@ -101,8 +127,6 @@ AC_SUBST(PACKAGENAME) AC_SUBST(AM_CXXFLAGS) AC_SUBST(AM_CPPFLAGS) AC_SUBST(LIBS) -AC_SUBST(QMAKE) -AC_SUBST(QMAKE_OPTIONS) # create output AC_OUTPUT diff --git a/doc/examples/makefile.am b/doc/examples/makefile.am index c2d375c..108c9a5 100644 --- a/doc/examples/makefile.am +++ b/doc/examples/makefile.am @@ -31,13 +31,13 @@ endif pcsc_demo_SOURCES = pcsc-demo.cxx pcsc_demo_LDFLAGS = -L${top_builddir}/src -pcsc_demo_LDADD = -lcryptoki++ +pcsc_demo_LDADD = -lpcscxx if MINGW32 pcsc_demo_LDADD += /opt/local/i586-mingw32msvc/lib/winscard.a endif cryptoki_demo_SOURCES = cryptoki-demo.cxx -cryptoki_demo_LDADD = -lcryptoki++ +cryptoki_demo_LDADD = -lpcscxx cryptoki_demo_LDFLAGS = -L${top_builddir}/src if MINGW32 cryptoki_demo_LDADD += -leay32 @@ -45,21 +45,21 @@ endif openssl_tcp_demo_SOURCES = openssl-tcp-demo.cxx openssl_tcp_demo_LDFLAGS = -L${top_builddir}/src -openssl_tcp_demo_LDADD = -lcryptoki++ +openssl_tcp_demo_LDADD = -lpcscxx if MINGW32 openssl_tcp_demo_LDADD += /opt/local/i586-mingw32msvc/lib/ssleay32.a /opt/local/i586-mingw32msvc/lib/libeay32.a endif openssl_ssl_demo_SOURCES = openssl-ssl-demo.cxx openssl_ssl_demo_LDFLAGS = -L${top_builddir}/src -openssl_ssl_demo_LDADD = -lcryptoki++ +openssl_ssl_demo_LDADD = -lpcscxx if MINGW32 openssl_ssl_demo_LDADD += /opt/local/i586-mingw32msvc/lib/ssleay32.a /opt/local/i586-mingw32msvc/lib/libeay32.a endif openssl_engine_demo_SOURCES = openssl-engine-demo.cxx openssl_engine_demo_LDFLAGS = -L${top_builddir}/src -openssl_engine_demo_LDADD = -lcryptoki++ +openssl_engine_demo_LDADD = -lpcscxx if MINGW32 openssl_engine_demo_LDADD += /opt/local/i586-mingw32msvc/lib/ssleay32.a /opt/local/i586-mingw32msvc/lib/libeay32.a endif diff --git a/doc/makefile.am b/doc/makefile.am index 9298df2..ffdcaa7 100644 --- a/doc/makefile.am +++ b/doc/makefile.am @@ -6,15 +6,11 @@ ## 45678901234567890123456789012345678901234567890123456789012345678901234567890 SUBDIRS = examples - -develdir = ${pkgdatadir}/doc -devel_DATA = html/index.html - ALL_SRC = ${top_srcdir}/src/*.[ch]xx ${top_srcdir}/src/*.doc -#${top_srcdir}/test/*.[ch]xx +# ${top_srcdir}/src/*.doc DIRS = html -# latex +#latex all: ${DIRS} @@ -24,7 +20,7 @@ all: ${DIRS} deps = ${top_srcdir}/COPYING ${top_srcdir}/README \ ${top_srcdir}/INSTALL ${top_srcdir}/NEWS ${top_srcdir}/ChangeLog -${devel_DATA}: ${ALL_SRC} doxyfile ${deps} +html: ${ALL_SRC} doxyfile ${deps} doxygen doxyfile if PEDANTIC test \! -s doxygen.errors @@ -39,13 +35,14 @@ MAINTAINERCLEANFILES = makefile.in distclean-local: - rm -r html latex -dist-hook: ${devel_DATA} - cp -r html ${distdir}/ +dist-hook: html +# cp -r html latex ${distdir}/ install-data-hook: - chmod -R u+w ${develdir} - cp -r html/* ${develdir}/ + test -d $(DESTDIR)${docdir} || mkdir -p $(DESTDIR)${docdir} + chmod -R u+w $(DESTDIR)${docdir} + cp -r html $(DESTDIR)${docdir}/ uninstall-hook: - -chmod -R u+w ${develdir} - -rm -rf ${develdir}/* + -chmod -R u+w $(DESTDIR)${docdir} + -rm -rf $(DESTDIR)${docdir}/* diff --git a/libpcscxx.spec.in b/libpcscxx.spec.in new file mode 100644 index 0000000..de1e3ac --- /dev/null +++ b/libpcscxx.spec.in @@ -0,0 +1,66 @@ +Summary: C++ Wrapper around OpenSSL, PCSC and Cryptoki +Name: @PACKAGENAME@ +Version: @VERSION@ +Release: 1 +License: LGPL +Group: Development/Libraries/C++ +URL: https://dev.marc.waeckerlin.org/projects/@PACKAGENAME@ +Source0: %{name}-%{version}.tar.gz +BuildRequires: subversion libcppunit-devel gcc-c++ doxygen graphviz texlive automake autoconf libtool make libopenssl-devel pcsc-lite-devel boost-devel +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root + + +%description +@README@ + +This package contains only the shared libraries required at runtime. + +%prep +%setup -q +./configure --prefix=/usr \ + --docdir=/usr/share/doc/packages/@PACKAGENAME@ \ + --libdir=/usr/lib + +%build +make + +%install +DESTDIR=$RPM_BUILD_ROOT make install + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +/usr/lib/@PACKAGENAME@.so.* +%doc +/usr/share/doc/packages/@PACKAGENAME@/AUTHORS +/usr/share/doc/packages/@PACKAGENAME@/COPYING +/usr/share/doc/packages/@PACKAGENAME@/ChangeLog +/usr/share/doc/packages/@PACKAGENAME@/INSTALL +/usr/share/doc/packages/@PACKAGENAME@/NEWS +/usr/share/doc/packages/@PACKAGENAME@/README + +%package devel +Summary: C++ Wrapper around OpenSSL, PCSC and Cryptoki (development files) +Group: Development/Libraries/C++ +Requires: @PACKAGENAME@ = @VERSION@ + +%description devel +@README@ + +This Package contains all files required for developement. + +%files devel +%defattr(-,root,root,-) +/usr/lib/@PACKAGENAME@.so +/usr/lib/@PACKAGENAME@.a +/usr/lib/pkgconfig +/usr/lib/@PACKAGENAME@.la +/usr/include/ +/usr/share/pkgconfig +%doc +/usr/share/doc/packages/@PACKAGENAME@/html +/usr/share/doc/packages/@PACKAGENAME@/@PACKAGENAME@.spec + +%changelog diff --git a/makefile.am b/makefile.am index a7ee264..ec009fa 100644 --- a/makefile.am +++ b/makefile.am @@ -22,10 +22,9 @@ DISTCLEANFILES = debian/changelog deb: dist tar xzvf @PACKAGE@-@VERSION@.tar.gz cd @PACKAGE@-@VERSION@ && dpkg-buildpackage - rm -rf @PACKAGE@-@VERSION@ + rm -rf @PACKAGE@-@VERSION@ -infosdir = ${pkgdatadir} -infos_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog # @PACKAGENAME@.spec +doc_DATA = AUTHORS NEWS README COPYING INSTALL ChangeLog @PACKAGENAME@.spec RPMS = /usr/src/packages/RPMS/i586/@PACKAGENAME@-@MAJOR@.@MINOR@.@LEAST@-1.i586.rpm \ /usr/src/packages/RPMS/i586/@PACKAGENAME@-devel-@MAJOR@.@MINOR@.@LEAST@-1.i586.rpm \ @@ -41,15 +40,21 @@ tag: distcheck cvs ci -R . cvs tag -FR REL_@PACKAGENAME@-@MAJOR@-@MINOR@-@LEAST@ . -#rpm: dist -# cp @PACKAGENAME@-@MAJOR@.@MINOR@.@LEAST@.tar.gz \ -# /usr/src/packages/SOURCES/ -# rpmbuild -ba --clean @PACKAGENAME@.spec +rpm: dist + cp @PACKAGENAME@-@MAJOR@.@MINOR@.@LEAST@.tar.gz \ + /usr/src/packages/SOURCES/ + rpmbuild -ba --clean @PACKAGENAME@.spec deps = ${top_srcdir}/COPYING ${top_srcdir}/README ${top_srcdir}/INSTALL ${top_srcdir}/NEWS ${top_srcdir}/ChangeLog clean-local: - rm doxygen.err lib@PACKAGENAME@.doxytag + - rm @PACKAGENAME@-dev_@MAJOR@.@MINOR@.@LEAST@-*.deb \ + @PACKAGENAME@_@MAJOR@.@MINOR@.@LEAST@-*.changes \ + @PACKAGENAME@_@MAJOR@.@MINOR@.@LEAST@-1.tar.gz \ + @PACKAGENAME@_@MAJOR@.@MINOR@.@LEAST@-1.dsc \ + @PACKAGENAME@-@MAJOR@.@MINOR@.@LEAST@.tar.gz \ + @PACKAGENAME@_@MAJOR@.@MINOR@.@LEAST@-*.deb distclean-local: - rm -r ${top_builddir}/@DOC_DIR@/html/* ${top_builddir}/@DOC_DIR@/latex/* @@ -59,16 +64,3 @@ distclean-local: - rm aclocal.m4 config.guess config.sub configure \ depcomp install-sh ltmain.sh makefile makefile.in \ missing mkinstalldirs - -dist-hook: - test -d ${distdir}/@DOC_DIR@/html || \ - mkdir -p ${distdir}/@DOC_DIR@/html - cp ${top_builddir}/@DOC_DIR@/html/* ${distdir}/@DOC_DIR@/html/. - -install-data-hook: - chmod -R u+w ${pkgdatadir}/@DOC_DIR@ - cp -rf ${top_builddir}/@DOC_DIR@/html ${pkgdatadir}/@DOC_DIR@/ - -#uninstall-hook: -# chmod -R u+w ${pkgdatadir}/doc -# rm -rf ${pkgdatadir}/doc diff --git a/src/makefile.am b/src/makefile.am index 439bcc4..1dc5420 100644 --- a/src/makefile.am +++ b/src/makefile.am @@ -25,19 +25,20 @@ pkgconfig_DATA = libpcscxx.pc pkgconfig2dir = $(datarootdir)/pkgconfig pkgconfig2_DATA = $(pkgconfig_DATA) -EXTRA_DIST = $(pkgconfig_DATA).in +EXTRA_DIST = $(pkgconfig_DATA).in ${top_srcdir}/src/*.doc -lib_LTLIBRARIES = libcryptoki++.la +lib_LTLIBRARIES = libpcscxx.la -libcryptoki___la_SOURCES = cryptoki.cxx cryptoki.hxx pcsc.cxx \ +libpcscxx_la_SOURCES = cryptoki.cxx cryptoki.hxx pcsc.cxx \ version.cxx openssl-engine.cxx -libcryptoki___la_LIBADD = -lssl -lcrypto +libpcscxx_la_LDFLAGS = -version-info ${LIB_VERSION} +libpcscxx_la_LIBADD = -lssl -lcrypto if MINGW32 -libcryptoki___la_LIBADD += -lgdi32 -lws2_32 +libpcscxx_la_LIBADD += -lgdi32 -lws2_32 else -libcryptoki___la_LIBADD += -ldl +libpcscxx_la_LIBADD += -ldl if !MAC -libcryptoki___la_LIBADD += -lpcsclite +libpcscxx_la_LIBADD += -lpcsclite endif endif