File jbig2enc-disable-rpath.patch of Package jbig2enc

Index: jbig2enc-0.28/Makefile.am
===================================================================
--- jbig2enc-0.28.orig/Makefile.am
+++ jbig2enc-0.28/Makefile.am
@@ -3,3 +3,22 @@ SUBDIRS = src doc
 dist_bin_SCRIPTS = pdf.py
 dist_doc_DATA = AUTHORS ChangeLog COPYING INSTALL NEWS README 
 EXTRA_DIST = autogen.sh
+AM_CXXFLAGS = -Wall
+AM_LDFLAGS = -Wl,-E
+if ENABLE_RPATH
+AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
+endif
+
+lib_LTLIBRARIES = libjbig2enc.la
+libjbig2enc_la_SOURCES = jbig2enc.cc jbig2arith.cc jbig2sym.cc jbig2comparator.cc
+libjbig2enc_la_LDFLAGS = -no-undefined -version-info $(GENERIC_LIBRARY_VERSION)
+include_HEADERS = jbig2arith.h jbig2sym.h jbig2structs.h jbig2segments.h jbig2comparator.h
+
+bin_PROGRAMS = jbig2
+jbig2_SOURCES = jbig2.cc
+jbig2_LDADD = libjbig2enc.la
+jbig2_LDFLAGS = -static
+
+if MINGW
+jbig2_LDADD += -lws2_32
+endif
Index: jbig2enc-0.28/configure.ac
===================================================================
--- jbig2enc-0.28.orig/configure.ac
+++ jbig2enc-0.28/configure.ac
@@ -3,6 +3,11 @@ AC_INIT([jbig2enc], [0.28], [agl@imperia
 		[https://github.com/agl/jbig2enc])
 AC_CONFIG_MACRO_DIR([m4])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign no-dependencies])
+
+# this should fix automake 1.12 build and compatible with automake 1.11
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
+LT_INIT
+
 AC_PROG_CXX
 AC_PROG_LIBTOOL
 
@@ -26,9 +31,6 @@ GENERIC_RELEASE=$GENERIC_MAJOR_VERSION.$
 AC_SUBST(GENERIC_RELEASE)
 AC_SUBST(GENERIC_VERSION)
 
-# this should fix automake 1.12 build and compatible with automake 1.11
-m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
-
 # default conditional
 AM_CONDITIONAL(MINGW, false)
 
@@ -51,6 +53,26 @@ case $host_os in
 		;;
 esac 
 
+# Check if rpath is disabled
+AC_MSG_CHECKING(whether to use rpath)
+AC_ARG_ENABLE(rpath,
+	[AC_HELP_STRING([--disable-rpath],
+			[Patches libtool to not use rpath in the libraries produced.])],
+	[enable_rpath="$enableval"], [enable_rpath="yes"])
+AC_MSG_RESULT($enable_rpath)
+
+AM_CONDITIONAL([ENABLE_RPATH], [test "x$enable_rpath" = "xyes"])
+
+AC_CONFIG_COMMANDS([libtool-rpath-patch],
+	[if test "$libtool_patch_use_rpath" = "no"; then
+		sed < libtool > libtool-2 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=""/'
+		mv libtool-2 libtool
+		sed < libtool > libtool-2 's/^runpath_var=LD_RUN_PATH$'/'runpath_var=DIE_RPATH_DIE/'
+		mv libtool-2 libtool
+		chmod 755 libtool
+	fi],
+[libtool_patch_use_rpath=$enable_rpath])
+
 AC_CHECK_LIB([lept], [findFileFormatStream], [], [
 			echo "Error! Leptonica not detected."
 			exit -1
Index: jbig2enc-0.28/src/Makefile.am
===================================================================
--- jbig2enc-0.28.orig/src/Makefile.am
+++ jbig2enc-0.28/src/Makefile.am
@@ -1,4 +1,8 @@
 AM_CXXFLAGS = -Wall
+AM_LDFLAGS = -Wl,-E
+if ENABLE_RPATH
+AM_LDFLAGS += -Wl,-rpath -Wl,$(libdir)
+endif
 
 lib_LTLIBRARIES = libjbig2enc.la
 libjbig2enc_la_SOURCES = jbig2enc.cc jbig2arith.cc jbig2sym.cc jbig2comparator.cc
openSUSE Build Service is sponsored by