Add build-conditions disabling Emacs and Java support

These macros allows to build libidn package without Emacs or Java
support and that is handy when building libidn for modular Fedora
when these dependencies are not necessary.

By default the package is built with all features enabled.
epel9
Petr Písař 7 years ago
parent c9b896cc7d
commit 372636f005

@ -0,0 +1,61 @@
From d011a6ae00ce9abd445d6d01ce9131a7b97ef5bc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 3 Oct 2017 10:04:18 +0200
Subject: [PATCH] Allow disabling Emacs support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch adds --disable-emacs configure option to disable installing
LISP scripts for Emacs.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
configure.ac | 9 ++++++++-
src/Makefile.am | 2 ++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 649ddcd..a6dc9ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -50,7 +50,6 @@ AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
AM_GNU_GETTEXT(external)
AM_GNU_GETTEXT_VERSION(0.19.3)
AM_ICONV
-AM_PATH_LISPDIR
if test "$am_cv_func_iconv" != "yes"; then
AC_MSG_NOTICE([
@@ -100,6 +99,14 @@ AM_CONDITIONAL(JAVA, test "$enable_java" != "no")
AC_MSG_CHECKING([if implementation in Java should be built])
AC_MSG_RESULT($enable_java)
+# Check for Emacs
+AC_ARG_ENABLE(emacs, AC_HELP_STRING([--disable-emacs], [disable Emacs support]),
+ enable_emacs=$enableval, enable_emacs=yes)
+AM_CONDITIONAL(EMACS, test "$enable_emacs" != "no")
+if test "$enable_emacs" != "no"; then
+ AM_PATH_LISPDIR
+fi
+
# Check for C#
if test -n "$HAVE_CSHARPCOMP"; then
gt_CSHARPEXEC
diff --git a/src/Makefile.am b/src/Makefile.am
index 6832c20..ec99560 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -20,7 +20,9 @@ AM_CFLAGS = $(WERROR_CFLAGS) $(WARN_CFLAGS)
AM_CPPFLAGS = -I$(top_srcdir)/lib -I../lib -I$(top_srcdir)/gl -I../gl
AM_CPPFLAGS += -DLOCALEDIR=\"$(localedir)\"
+if EMACS
dist_lisp_DATA = punycode.el idna.el
+endif
bin_PROGRAMS = idn
idn_SOURCES = idn.c
--
2.13.6

@ -1,3 +1,8 @@
# Build with Emacs support
%bcond_without libidn_enables_emacs
# Build with Java support
%bcond_without libidn_enables_java
Summary: Internationalized Domain Name support library
Name: libidn
Version: 1.33
@ -5,17 +10,27 @@ Release: 4%{?dist}
URL: http://www.gnu.org/software/libidn/
License: LGPLv2+ and GPLv3+ and GFDL
Source0: http://ftp.gnu.org/gnu/libidn/libidn-%{version}.tar.gz
# Allow disabling Emacs support
Patch0: libidn-1.33-Allow-disabling-Emacs-support.patch
Group: System Environment/Libraries
BuildRequires: pkgconfig gettext emacs
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext-devel
%if %{with libidn_enables_emacs}
BuildRequires: emacs
%endif
BuildRequires: pkgconfig gettext
Requires(post): /sbin/install-info /sbin/ldconfig
Requires(preun): /sbin/install-info
Requires(postun): /sbin/ldconfig
# gnulib is a copylib, bundling is allowed
Provides: bundled(gnulib)
%if %{with libidn_enables_emacs}
# emacs-libidn merged with main package in 1.30-4
Obsoletes: emacs-libidn < 1.30-4
Provides: emacs-libidn < 1.30-4
Requires: emacs-filesystem >= %{_emacs_version}
%endif
%description
GNU Libidn is an implementation of the Stringprep, Punycode and
@ -33,6 +48,7 @@ Requires: pkgconfig
This package includes header files and libraries necessary for
developing programs which use the GNU libidn library.
%if %{with libidn_enables_java}
%package java
Summary: Java port of the GNU Libidn library
BuildRequires: java-devel
@ -55,16 +71,23 @@ BuildArch: noarch
%description javadoc
This package contains javadoc for %{name}-java.
%endif
%prep
%setup -q
%patch0 -p1
autoreconf -fi
# Prevent from regenerating sources by gengetopt because it's broken.
touch src/idn_cmd.c src/idn_cmd.h
# Cleanup
find . -name '*.jar' -print -delete
find . -name '*.class' -print -delete
%if %{with libidn_enables_java}
# Not available test dep
%pom_remove_dep com.google.caliper:caliper java/pom.xml.in
%endif
# Name directory sections consistently in the info file, #209491
sed -i '/^INFO-DIR-SECTION/{s/GNU Libraries/Libraries/;s/GNU utilities/Utilities/;}' doc/libidn.info
@ -73,7 +96,18 @@ iconv -f ISO-8859-1 -t UTF-8 doc/libidn.info > iconv.tmp
mv iconv.tmp doc/libidn.info
%build
%configure --disable-csharp --disable-static --with-lispdir=%{_emacs_sitelispdir}/%{name} --enable-java
%configure --disable-csharp --disable-static \
%if %{with libidn_enables_emacs}
--enable-emacs \
--with-lispdir=%{_emacs_sitelispdir}/%{name} \
%else
--disable-emacs \
%endif
%if %{with libidn_enables_java}
--enable-java
%else
--disable-java
%endif
# remove RPATH hardcoding
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
@ -87,7 +121,11 @@ export LD_LIBRARY_PATH=$(pwd)/lib/.libs
make %{?_smp_mflags} -C tests check VALGRIND=env
%install
make install DESTDIR=$RPM_BUILD_ROOT pkgconfigdir=%{_libdir}/pkgconfig libidn_jardir=%{_javadir}
make install DESTDIR=$RPM_BUILD_ROOT pkgconfigdir=%{_libdir}/pkgconfig \
%if %{with libidn_enables_java}
libidn_jardir=%{_javadir} \
%endif
;
# provide more examples
make %{?_smp_mflags} -C examples distclean
@ -102,8 +140,11 @@ sed -i '/gnu compiler/d' $RPM_BUILD_ROOT%{_includedir}/idn-int.h
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la \
$RPM_BUILD_ROOT%{_datadir}/info/*.png
%if %{with libidn_enables_emacs}
%{_emacs_bytecompile} $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}/*.el
%endif
%if %{with libidn_enables_java}
# regenerate java documentation
rm -rf doc/java/*
%javadoc -source 1.6 -d doc/java $(find java/src/main/java -name "*.java")
@ -112,6 +153,7 @@ rm -rf $RPM_BUILD_ROOT%{_javadir}/libidn*.jar
%mvn_artifact java/pom.xml java/libidn-%{version}.jar
%mvn_file org.gnu.inet:libidn libidn
%mvn_install -J doc/java
%endif
%find_lang %{name}
@ -134,7 +176,9 @@ fi
%{_mandir}/man1/idn.1*
%{_libdir}/libidn.so.*
%{_infodir}/%{name}.info.gz
%if %{with libidn_enables_emacs}
%{_emacs_sitelispdir}/%{name}
%endif
%files devel
%doc doc/libidn.html examples
@ -143,11 +187,13 @@ fi
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/*
%if %{with libidn_enables_java}
%files java -f .mfiles
%license COPYING* java/LICENSE-2.0.txt
%files javadoc -f .mfiles-javadoc
%license COPYING* java/LICENSE-2.0.txt
%endif
%changelog
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.33-4

Loading…
Cancel
Save