Home My Page Projects gf2x
Summary Tracker Lists

[#21746] gf2x should provide a pkg-config configuration

Date:
2019-03-19 18:08
Priority:
3
State:
Open
Submitted by:
Dmitrii Pasechnik (dimpase)
Assigned to:
Nobody (None)
Hardware:
none
Product:
none
Operating System:
none
Component:
none
Version:
none
Severity:
none
Resolution:
none
URL:
Summary:
gf2x should provide a pkg-config configuration

Detailed description
It is a tricky task to detect the version of gf2x installed, without this information provided in an easy to access way. E.g. to detect gf2x I had to write am m4 macro that checks signatures of the function gf2x_mul_r, see

https://github.com/sagemath/sage/blob/develop/build/pkgs/gf2x/spkg-configure.m4

certainly this is not easy, and pkg-config (with its PKG_...() macros) would have been much easier.

Would you care to add pkg-config configuration? I can provide a patch...




Message  ↓
Date: 2019-03-29 07:12
Sender: Emmanuel Thomé

ok done. pulled your patch from github, and completely detached the apps/ subdir to make it an example of how one might want to use the pkg-config stuff.

Thanks.

Date: 2019-03-28 14:35
Sender: Dmitrii Pasechnik

The usual (for the autotools) way would be to have in
configure.ac (this tests for presence of gf2x of version 1.2.0 or
newer)

PKG_CHECK_MODULES([GF2X], [gf2x >= 1.2.0])

and in Makefile.am, for an application foo:

foo_CFLAGS = $(GF2X_CFLAGS)
foo_LDADD = $(GF2X_LIBS)

to set up the needed flags for foo.

After gf2x is installed into location <prefix>, one would need to make sure that pkg-config knows about <prefix>,
and, if needed, add <prefix>/lib/pkg_config to the environment variable PKG_CONFIG_PATH.

I presume this can be done in apps/ just as well, with main configure.ac having AC_CONFIG_SUBDIRS([apps]) set.

Date: 2019-03-28 13:44
Sender: Emmanuel Thomé

ok, getting back to it right now.

Looks good to me as far as I can tell. However I wonder how it's supposed to work on the side of the application that uses the software. Ideally, I'd like to have the apps/ subdirectory test itself with a configure's --with-gf2x=/some/path ; and make that a test in the jenkins/ subdir.

As I said I'm looking into it, but any hints/contributions are welcome.

Date: 2019-03-28 11:49
Sender: Dmitrii Pasechnik

attaching doesn't work, so I paste it here:
diff --git a/Makefile.am b/Makefile.am
index 9ee9873..b459ff5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -120,6 +120,9 @@ EXTRA_DIST+=config/configfsf.guess
EXTRA_DIST+=toom-gpl-placeholder.c
EXTRA_DIST+=check-gf2x-version.c

+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = gf2x.pc
+
# This is really a maintainer-only command. This can be used for creating
# a tarball with an LGPL-licensed gf2x. Note that when this is done,
# configure must be re-run !
diff --git a/NEWS b/NEWS
index 4e2622c..4486361 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,9 @@ gf2x-1.3.0:
been fixed.
- two long-standing bugs in the ternary FFT for ridiculously small
transform lengths have been fixed.
+ - configuration file for pkg-config added: assuming gf2x installed in
+ <prefix> known to pkg-config, "pkg-config --cflags gf2x" etc will
+ work. (Otherwise, one would need PKG_CONFIG_PATH=<prefix>/lib/pkg_config).

gf2x-1.2:
- changed the type representing the polynomial sizes from "unsigned int"
diff --git a/configure.ac b/configure.ac
index 7424e59..4b52ea5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -296,7 +296,7 @@ AC_CONFIG_HEADERS([gf2x/gf2x-config.h gf2x/gf2x-config-export.h gf2x.h])
#AC_SUBST([MAYBE_GF2X_FFT])

AC_CONFIG_FILES([version.sh Makefile tests/Makefile lowlevel/Makefile
- src/Makefile fft/Makefile apps/Makefile gf2x.h.in])
+ src/Makefile fft/Makefile apps/Makefile gf2x.h.in gf2x.pc])

AC_OUTPUT

diff --git a/gf2x.pc.in b/gf2x.pc.in
new file mode 100644
index 0000000..580541d
--- /dev/null
+++ b/gf2x.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@prefix@/include
+
+Name: @PACKAGE_NAME@
+Description: C library for multiplying polynomials over the binary field
+Version: @PACKAGE_VERSION@
+Libs: -L${libdir} -lgf2x
+Cflags: -I${includedir}

Date: 2019-03-28 11:46
Sender: Dmitrii Pasechnik

A better link (just showing a raw diff): https://github.com/dimpase/gf2x/commit/c7cd1f26d193c8e2ee8a3648d6701231c14e29be.diff

I'll also try to post it as attachment.

Date: 2019-03-19 22:35
Sender: Dmitrii Pasechnik

Please see https://github.com/dimpase/gf2x/commit/c7cd1f26d193c8e2ee8a3648d6701231c14e29be

(not sure if this is an acceptable here way to provide a patch, let me know...)

Date: 2019-03-19 21:07
Sender: Emmanuel Thomé

Thanks for your feedback.

You're welcome to submit a patch.

E.

No Changes Have Been Made to This Item