[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Next autoconf problem for today libdisorder



(resending because I got the mailing list address wrong, sorry)

On 06/27/2016 05:00 PM, Andreas Tille wrote:
> ftpmaster spotted in two of my packages a code copy of libdisorder[1]
> which better should be packaged separately.  Since I'd like to create
> dynamic and static library (upstream Makefile only creates static) I
> intended to add autoconf - but today I just proved that my skills are
> quite limited here.

You have a toplevel Makefile.am that defines a library (libdisorder)
but sets no source files, so automake/make assuems that libdisorder.c
has to be there. The sub-level Makefile.ams are never found because
you don't set SUBDIRS.

However, I think you're making your life far more complicated than it
needs to be:

1) alter configure.ac to have automake enable the option subdir-objects
   and don't generate the subdirectory Makefiles, only the top-level
   one

2) put everything in a top-level Makefile.am (makes your life so much
   easier)

3) don't bother to drop upstream's src/Makefile (if you don't use a
   src/Makefile.am, there'll be no conflict)

4) actually reference libtool in configure.ac via LT_INIT/LT_PREREQ,
   AC_PROG_LIBTOOL/AM_PROG_LIBTOOL are the old, deprecated names of
   LT_INIT (see [1])

I've attached an updated version of your autoconf patch that does just
his.

Other comments regarding the package:

 - if you use autoconf/automake, you don't need to use d-moveshlibs
   for multiarch, dh_auto_configure / dh_auto_build / dh_auto_install
   will do all the heavy lifting for you (just create proper .install
   files for the packages, and use /usr/lib/*/filename to select the
   proper file names) That's a matter of taste, of course.

 - you build tool/ropy, but you never use it? Neither in the test suite
   (dh_auto_test doesn't do anything) nor do you package that - why?

 - you don't provide a symbols file for your library. Not required,
   but it's good practice to provide one (I've attached one based on
   your current package, save it as debian/libdisorder0.symbols, dh
   will take care of the rest)

 - why hardening only +bindnow? The package builds with +all in the
   hardening options just fine?

 - Have you actually tested this with automake 1.6 and autoconf
   2.57? (they are ancient!) If not I'd recommend using autoconf 2.64
   and automake 1.11 as the minimal required versions for each (just
   to be on the safe side, even though it won't have any effect on
   Debian's package build)

 - you could consider installing a pkg-config file for the library,
   as it requires linking against -lm. While this works automatically
   with the shared library, this is not the case for the static
   library, where you explicitly have to add -lm after libdisorder.a
   when linking against it

 - I would recommend maybe sending the build system changes upstream,
   so that other people can also profit from this?

 - you install everything into the proper multiarch locations, but
   libdisorder0 and libdisorder-dev are not Multi-Arch: same, even
   though they easily could be

 - you don't build the test program (although it doesn't serve as
   a unit test, because it will never fail unless /dev/urandom is
   not accessible, so there's no actual check whether the routine
   works as expected or not - so I don't think that's a problem
   really, just wanted to make you aware of it)

 - this is more of an upstream issue (i.e. not related to your
   packaging): the library uses global state and is non-reentrant;
   which is actually not a great thing for a shared library to be

   Unfortunately, improving that would require breaking both API
   and ABI, so I'm not suggesting to you to do so, but I would
   maybe talk with upstream about improving that in the future.

Regards,
Christian

[1] https://www.gnu.org/software/automake/manual/libtool.html#LT_005fINIT
Author: Andreas Tille <tille@debian.org>
Last-Update: Wed, 22 Jun 2016 16:27:46 +0200
Description: Add autoconf stuff to enable simple library creation

--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,12 @@
+lib_LTLIBRARIES  = libdisorder.la
+libdisorder_la_SOURCES = src/disorder.c
+libdisorder_la_LDFLAGS = -version-info @LIB_VERSION@
+libdisorder_la_CPPFLAGS = -Iinclude
+libdisorder_la_LIBADD = -lm
+
+bin_PROGRAMS = ropy
+ropy_SOURCES = tool/ropy.c
+ropy_LDADD = libdisorder.la
+
+include_HEADERS = include/disorder.h
+man_MANS = man/shannon_H.3
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,62 @@
+#                                               -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_INIT(disorder, 0.0.2, michael@freshdefense.net)
+AC_CONFIG_HEADERS([config.h])
+
+AC_PREREQ(2.57)
+
+#	Directory that contains install-sh and other auxiliary files
+AC_CONFIG_AUX_DIR([config])
+
+################################################################################
+#	According to (http://www.mail-archive.com/autoconf@gnu.org/msg14232.html)
+#		this macro should be after AC_INIT but before AM_INIT_AUTOMAKE
+################################################################################
+AC_CONFIG_MACRO_DIR(config)
+
+AM_INIT_AUTOMAKE([1.6 foreign subdir-objects dist-zip tar-ustar filename-length-max=299])
+
+LIB_VERSION=0:0
+
+AC_SUBST([VERSION])
+AC_SUBST([LIB_VERSION])
+
+AC_SUBST([VERSION])
+
+# Checks for programs.
+AC_PROG_LN_S
+AC_PROG_INSTALL
+
+LT_PREREQ(2.2)
+LT_INIT
+
+################################################################################
+# calling AC_PROG_CXX resets CXXFLAGS, we use our own flags set in the
+#	the AX_CXXFLAGS macro below.
+# So we cache the argument to configure
+#	here in ARG_CXX_FLAGS (so that our macro does not override them)
+################################################################################
+ARG_CXX_FLAGS="$CXXFLAGS"
+AC_PROG_CXX
+
+#Ranlib handled by check for libtool
+CXXFLAGS="$ARG_CXX_FLAGS"
+AX_CXXFLAGS
+
+AC_SUBST(CXXFLAGS)
+
+CPPFLAGS="-I\$(top_srcdir) $CPPFLAGS"
+# Checks for libraries.
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h])
+
+AC_PROG_MAKE_SET
+
+AC_CONFIG_FILES([
+	Makefile
+	])
+AC_OUTPUT
+

libdisorder.so.0 libdisorder0 #MINVER#
 get_entropy_ratio@Base 0.0.2
 get_max_entropy@Base 0.0.2
 get_num_tokens@Base 0.0.2
 shannon_H@Base 0.0.2


Reply to: