[Pkg-privacy-commits] [irssi-plugin-otr] 154/267: Fix: Finally fix the build system
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:26:27 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch debian
in repository irssi-plugin-otr.
commit b06dba364ab2ac731b50af5f3f9db588a7e1fb7f
Author: David Goulet <dgoulet at ev0ke.net>
Date: Tue Nov 27 18:40:23 2012 -0500
Fix: Finally fix the build system
Autoconf/make was clashing with the real libotr.so of the system so the
module object was renamed to "otr.so".
Also, this commit copies the libotr.m4 from the upstream version and add
it locally so it does not have to use the aclocal/ directory of the
system when bootstrapping.
Signed-off-by: David Goulet <dgoulet at ev0ke.net>
---
.gitignore | 1 +
README.md | 2 +-
bootstrap | 4 +-
config/libotr.m4 | 134 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
configure.ac | 9 ++--
src/Makefile.am | 10 ++---
6 files changed, 147 insertions(+), 13 deletions(-)
diff --git a/.gitignore b/.gitignore
index d196ee4..bce7fd5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,4 @@ libtool
tags
config/
+!config/libotr.m4
diff --git a/README.md b/README.md
index bb483c8..17113d1 100644
--- a/README.md
+++ b/README.md
@@ -44,7 +44,7 @@ Instructions
---------
To load the OTR module at startup, use the following and make sure
-**libotr.so** is located in the **modules/** directory of the Irssi home
+**otr.so** is located in the **modules/** directory of the Irssi home
(usually ~/.irssi).
`echo "load otr" >> ~/.irssi/startup`
diff --git a/bootstrap b/bootstrap
index ef679a1..8ba807f 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,10 +1,8 @@
#! /bin/sh
-ACLOCAL_FLAGS="-I /usr/local/share/aclocal"
-
set -x
if [ ! -e config ]; then
mkdir config
fi
-autoreconf -i -s $ACLOCAL_FLAGS
+autoreconf -i -s
diff --git a/config/libotr.m4 b/config/libotr.m4
new file mode 100644
index 0000000..80b25f8
--- /dev/null
+++ b/config/libotr.m4
@@ -0,0 +1,134 @@
+dnl
+dnl Off-the-Record Messaging library
+dnl Copyright (C) 2004-2007 Ian Goldberg, Chris Alexander, Nikita Borisov
+dnl <otr at cypherpunks.ca>
+dnl
+dnl This library is free software; you can redistribute it and/or
+dnl modify it under the terms of version 2.1 of the GNU Lesser General
+dnl Public License as published by the Free Software Foundation.
+dnl
+dnl This library is distributed in the hope that it will be useful,
+dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+dnl Lesser General Public License for more details.
+dnl
+dnl You should have received a copy of the GNU Lesser General Public
+dnl License along with this library; if not, write to the Free Software
+dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+dnl
+
+dnl AM_PATH_LIBOTR([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
+dnl Test for libotr, and define LIBOTR_CFLAGS and LIBOTR_LIBS as appropriate.
+dnl enables arguments --with-libotr-prefix=
+dnl --with-libotr-inc-prefix=
+dnl
+dnl You must already have found libgcrypt with AM_PATH_LIBGCRYPT
+dnl
+dnl Adapted from alsa.m4, originally by
+dnl Richard Boulton <richard-alsa at tartarus.org>
+dnl Christopher Lansdown <lansdoct at cs.alfred.edu>
+dnl Jaroslav Kysela <perex at suse.cz>
+
+AC_DEFUN([AM_PATH_LIBOTR],
+[dnl Save the original CFLAGS, LDFLAGS, and LIBS
+libotr_save_CFLAGS="$CFLAGS"
+libotr_save_LDFLAGS="$LDFLAGS"
+libotr_save_LIBS="$LIBS"
+libotr_found=yes
+
+dnl
+dnl Get the cflags and libraries for libotr
+dnl
+AC_ARG_WITH(libotr-prefix,
+[ --with-libotr-prefix=PFX Prefix where libotr is installed(optional)],
+[libotr_prefix="$withval"], [libotr_prefix=""])
+
+AC_ARG_WITH(libotr-inc-prefix,
+[ --with-libotr-inc-prefix=PFX Prefix where libotr includes are (optional)],
+[libotr_inc_prefix="$withval"], [libotr_inc_prefix=""])
+
+dnl Add any special include directories
+AC_MSG_CHECKING(for libotr CFLAGS)
+if test "$libotr_inc_prefix" != "" ; then
+ LIBOTR_CFLAGS="$LIBOTR_CFLAGS -I$libotr_inc_prefix"
+ CFLAGS="$CFLAGS $LIBOTR_CFLAGS"
+fi
+AC_MSG_RESULT($LIBOTR_CFLAGS)
+
+dnl add any special lib dirs
+AC_MSG_CHECKING(for libotr LIBS)
+if test "$libotr_prefix" != "" ; then
+ LIBOTR_LIBS="$LIBOTR_LIBS -L$libotr_prefix"
+ LDFLAGS="$LDFLAGS $LIBOTR_LIBS"
+fi
+
+dnl add the libotr library
+LIBOTR_LIBS="$LIBOTR_LIBS -lotr"
+LIBS="$LIBOTR_LIBS $LIBS"
+AC_MSG_RESULT($LIBOTR_LIBS)
+
+dnl Check for a working version of libotr that is of the right version.
+min_libotr_version=ifelse([$1], ,3.0.0,$1)
+no_libotr=""
+ libotr_min_major_version=`echo $min_libotr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+ libotr_min_minor_version=`echo $min_libotr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+ libotr_min_sub_version=`echo $min_libotr_version | \
+ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+AC_MSG_CHECKING(for libotr headers version $libotr_min_major_version.x >= $min_libotr_version)
+
+AC_LANG_SAVE
+AC_LANG_C
+AC_TRY_COMPILE([
+#include <stdlib.h>
+#include <libotr/version.h>
+], [
+# if(OTRL_VERSION_MAJOR != $libotr_min_major_version)
+# error not present
+# else
+
+# if(OTRL_VERSION_MINOR > $libotr_min_minor_version)
+ exit(0);
+# else
+# if(OTRL_VERSION_MINOR < $libotr_min_minor_version)
+# error not present
+# endif
+
+# if(OTRL_VERSION_SUB < $libotr_min_sub_version)
+# error not present
+# endif
+# endif
+# endif
+exit(0);
+],
+ [AC_MSG_RESULT(found.)],
+ [AC_MSG_RESULT(not present.)
+ ifelse([$3], , [AC_MSG_ERROR(Sufficiently new version of libotr not found.)])
+ libotr_found=no]
+)
+AC_LANG_RESTORE
+
+dnl Now that we know that we have the right version, let's see if we have the library and not just the headers.
+AC_CHECK_LIB([otr], [otrl_message_receiving],,
+ [ifelse([$3], , [AC_MSG_ERROR(No linkable libotr was found.)])
+ libotr_found=no],
+ $LIBGCRYPT_LIBS
+)
+
+LDFLAGS="$libotr_save_LDFLAGS"
+LIBS="$libotr_save_LIBS"
+
+if test "x$libotr_found" = "xyes" ; then
+ ifelse([$2], , :, [$2])
+else
+ LIBOTR_CFLAGS=""
+ LIBOTR_LIBS=""
+ ifelse([$3], , :, [$3])
+fi
+
+dnl That should be it. Now just export our symbols:
+AC_SUBST(LIBOTR_CFLAGS)
+AC_SUBST(LIBOTR_LIBS)
+])
+
diff --git a/configure.ac b/configure.ac
index ac8ed0b..5212534 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([irssi-otr],[1.0.0],[dgoulet at ev0ke.net],[],[Web])
+AC_INIT([irssi-otr],[1.0.0-alpha1],[dgoulet at ev0ke.net],[],[https://github.com/dgoulet/irssi-otr])
AC_CONFIG_AUX_DIR([config])
AC_CANONICAL_TARGET
AC_CANONICAL_HOST
@@ -9,6 +9,8 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_PROG_GREP
AC_PROG_CC
+# We do not want to create a .a for the module, so disable by default.
+AM_DISABLE_STATIC
AM_PROG_LIBTOOL
# Check for pthread
@@ -33,7 +35,7 @@ AM_PATH_LIBOTR(4.0.0, [], [AC_MSG_ERROR([libotr 4.0.0 or newer is required.])])
pkg_modules="gmodule-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GMODULE, [$pkg_modules])
-AC_SUBST(PACKAGE_LIBS)
+
LIBS="$LIBS $GMODULE_LIBS"
PACKAGE_CFLAGS="$GMODULE_CFLAGS -Wall -Werror=format-security"
@@ -62,10 +64,9 @@ AC_CHECK_HEADERS([\
LT_INIT
-CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing -fstack-protector-all -D_FORTIFY_SOURCE=2 -O1 -Wl,-z,relro,-z,now -fPIE -pie"
+CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing -fstack-protector-all -D_FORTIFY_SOURCE=2 -O1 -Wl,-z,relro,-z,now -fPIE -pie $PACKAGE_CFLAGS"
DEFAULT_INCLUDES="-I\$(top_srcdir) -I\$(top_builddir) -I\$(top_builddir)/src -I\$(top_builddir)/include"
-
AC_SUBST(DEFAULT_INCLUDES)
AC_CONFIG_FILES([
diff --git a/src/Makefile.am b/src/Makefile.am
index 188c4d8..349a0c7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,4 @@
-AM_CFLAGS = $(PACKAGE_CFLAGS)
+AM_CFLAGS = $(LIBOTR_CFLAGS) $(LIBGCRYPT_CFLAGS) $(PACKAGE_FLAGS)
IRSSI_DIST=/usr/include/irssi
IRSSI_INCLUDE = -I$(IRSSI_DIST) \
@@ -13,10 +13,10 @@ IRSSI_INCLUDE = -I$(IRSSI_DIST) \
INCLUDES = -I$(top_srcdir)/src $(IRSSI_INCLUDE)
-lib_LTLIBRARIES = libotr.la
+lib_LTLIBRARIES = otr.la
-libotr_la_SOURCES = key.c key.h cmd.c cmd.h otr.c otr-ops.c \
+otr_la_SOURCES = key.c key.h cmd.c cmd.h otr.c otr-ops.c \
utils.h utils.c otr.h module.c irssi_otr.h \
otr-formats.c otr-formats.h
-libotr_la_LDFLAGS = -module -avoid-version -shared
-libotr_la_LIBADD = $(LIBOTR_LIBS) $(LIBGCRYPT_LIBS)
+otr_la_LDFLAGS = -avoid-version -module
+otr_la_LDFLAGS += $(LIBOTR_LIBS) $(LIBGCRYPT_LIBS)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/irssi-plugin-otr.git
More information about the Pkg-privacy-commits
mailing list