From c7ee71f792fc96f71916751cb84b023a145345a4 Mon Sep 17 00:00:00 2001 From: Amir Taaki Date: Wed, 7 May 2014 06:10:08 +0000 Subject: [PATCH 1/4] add pkg-config support --- Makefile.am | 2 ++ configure.ac | 7 ++++++- libsecp256k1.pc.in | 12 ++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 libsecp256k1.pc.in diff --git a/Makefile.am b/Makefile.am index 06c8d74b..0695e571 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,8 @@ noinst_HEADERS += src/field_gmp_impl.h noinst_HEADERS += src/field.h noinst_HEADERS += src/field_impl.h +pkgconfig_DATA = libsecp256k1.pc + if USE_ASM libsecp256k1_la_SOURCES += src/field_5x52_asm.asm endif diff --git a/configure.ac b/configure.ac index 178ccbc2..8bed0422 100644 --- a/configure.ac +++ b/configure.ac @@ -15,6 +15,11 @@ AC_PROG_INSTALL AC_PROG_SED PKG_PROG_PKG_CONFIG +AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], + [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), + [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) +AC_SUBST([pkgconfigdir]) + AC_PROG_CC_C99 if test x"$ac_cv_prog_cc_c99" == x"no"; then AC_MSG_ERROR([c99 compiler support required]) @@ -284,7 +289,7 @@ AC_MSG_NOTICE([Using field implementation: $set_field]) AC_MSG_NOTICE([Using bignum implementation: $set_bignum]) AC_CONFIG_HEADERS([src/libsecp256k1-config.h]) -AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([Makefile libsecp256k1.pc]) AC_SUBST(SECP_INCLUDES) AC_SUBST(SECP_LIBS) AC_SUBST(SECP_TEST_LIBS) diff --git a/libsecp256k1.pc.in b/libsecp256k1.pc.in new file mode 100644 index 00000000..62a786db --- /dev/null +++ b/libsecp256k1.pc.in @@ -0,0 +1,12 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libsecp256k1 +Description: Optimized C library for EC operations on curve secp256k1 +URL: https://github.com/bitcoin/secp256k1 +Version: @PACKAGE_VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} + From 81b2faebd4ef2fc267617513b3786002a7cea603 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 20 May 2014 20:59:11 -0400 Subject: [PATCH 2/4] packaging: remove the --with-pkgconfigdir option It was not necessary and would only confuse packagers. --- Makefile.am | 1 + configure.ac | 5 ----- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 0695e571..e3334284 100644 --- a/Makefile.am +++ b/Makefile.am @@ -32,6 +32,7 @@ noinst_HEADERS += src/field_gmp_impl.h noinst_HEADERS += src/field.h noinst_HEADERS += src/field_impl.h +pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libsecp256k1.pc if USE_ASM diff --git a/configure.ac b/configure.ac index 8bed0422..0f171d72 100644 --- a/configure.ac +++ b/configure.ac @@ -15,11 +15,6 @@ AC_PROG_INSTALL AC_PROG_SED PKG_PROG_PKG_CONFIG -AC_ARG_WITH([pkgconfigdir], AS_HELP_STRING([--with-pkgconfigdir=PATH], - [Path to the pkgconfig directory [[LIBDIR/pkgconfig]]]), - [pkgconfigdir="$withval"], [pkgconfigdir='${libdir}/pkgconfig']) -AC_SUBST([pkgconfigdir]) - AC_PROG_CC_C99 if test x"$ac_cv_prog_cc_c99" == x"no"; then AC_MSG_ERROR([c99 compiler support required]) From 67a476599bc3e42416ec366321ccd752096c0e19 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 20 May 2014 21:02:02 -0400 Subject: [PATCH 3/4] packaging: fixup pkg-config Set the private libs as determined by configure, and add the missing lib link. --- libsecp256k1.pc.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsecp256k1.pc.in b/libsecp256k1.pc.in index 62a786db..1c72dd00 100644 --- a/libsecp256k1.pc.in +++ b/libsecp256k1.pc.in @@ -8,5 +8,6 @@ Description: Optimized C library for EC operations on curve secp256k1 URL: https://github.com/bitcoin/secp256k1 Version: @PACKAGE_VERSION@ Cflags: -I${includedir} -Libs: -L${libdir} +Libs.private: @SECP_LIBS@ +Libs: -L${libdir} -lsecp256k1 From 4212f7d7cb1718303506a6be4347d4028182d558 Mon Sep 17 00:00:00 2001 From: Cory Fields Date: Tue, 20 May 2014 21:04:31 -0400 Subject: [PATCH 4/4] packaging: add pkg-config file to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7eaf3d07..f3d26df3 100644 --- a/.gitignore +++ b/.gitignore @@ -32,3 +32,4 @@ m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 src/stamp-h1 +libsecp256k1.pc