Add build-conditions disabling Emacs

This commit is contained in:
fuanan 2022-02-15 18:16:27 +08:00
parent 44c56284a4
commit 3eb73dfc50
2 changed files with 89 additions and 4 deletions

61
libidn-emacsopt.patch Normal file
View File

@ -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
@@ -51,7 +51,6 @@ LT_INIT([win32-dll])
AM_MISSING_PROG(PERL, perl, $missing_dir)
AM_MISSING_PROG(HELP2MAN, help2man, $missing_dir)
AM_ICONV
-AM_PATH_LISPDIR
AM_GNU_GETTEXT([external])
AM_GNU_GETTEXT_VERSION([0.19.3])
@@ -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

View File

@ -1,20 +1,31 @@
%bcond_with java
# Build with Emacs support
%bcond_without libidn_enables_emacs
%bcond_with java
Name: libidn
Version: 1.38
Release: 1
Release: 2
Summary: GNU IDN Library - Libidn
License: LGPLv2+ and GPLv3+ and GFDL
URL: http://www.gnu.org/software/libidn/
Source0: http://ftp.gnu.org/gnu/libidn/libidn-%{version}.tar.gz
# Allow disabling Emacs support
Patch0: libidn-emacsopt.patch
BuildRequires: autoconf autoconf-archive automake libtool texinfo
BuildRequires: gcc gettext gettext-devel pkgconfig help2man emacs
BuildRequires: gcc gettext gettext-devel pkgconfig help2man
BuildRequires: gtk-doc
%if %{with libidn_enables_emacs}
BuildRequires: emacs
%endif
Provides: bundled(gnulib)
%if %{with libidn_enables_emacs}
Obsoletes: emacs-libidn < 1.30-4
Provides: emacs-libidn < 1.30-4
Requires: emacs-filesystem >= %{_emacs_version}
%endif
%description
GNU Libidn is a fully documented implementation of the Stringprep, Punycode and IDNA 2003 specifications.
@ -58,7 +69,13 @@ autoreconf -vif
touch src/idn_cmd.c src/idn_cmd.h
%build
%configure --disable-csharp --enable-emacs --with-lispdir=%{_emacs_sitelispdir}/%{name} \
%configure --disable-csharp \
%if %{with libidn_enables_emacs}
--enable-emacs \
--with-lispdir=%{_emacs_sitelispdir}/%{name} \
%else
--disable-emacs \
%endif
%if %{with java}
--enable-java
%else
@ -77,7 +94,9 @@ rm -rf %{buildroot}%{_datadir}/info/dir
rm -rf %{buildroot}%{_libdir}/*.la \
%{buildroot}%{_datadir}/info/*.png
%if %{with libidn_enables_emacs}
%{_emacs_bytecompile} $RPM_BUILD_ROOT%{_emacs_sitelispdir}/%{name}/*.el
%endif
%if %{with java}
rm -rf doc/java/*
@ -97,7 +116,9 @@ rm -rf $RPM_BUILD_ROOT%{_javadir}/libidn*.jar
%doc AUTHORS NEWS FAQ THANKS README
%{_bindir}/idn
%{_libdir}/libidn.so.12*
%if %{with libidn_enables_emacs}
%{_emacs_sitelispdir}/%{name}
%endif
%files devel
%{_libdir}/libidn.so
@ -119,6 +140,9 @@ rm -rf $RPM_BUILD_ROOT%{_javadir}/libidn*.jar
%{_infodir}/%{name}.info.gz
%changelog
* Tue Feb 15 2022 fuanan <fuanan3@h-partners.com> - 1.38-2
- Add build-conditions disabling Emacs
* Tue Feb 8 2022 fuanan <fuanan3@h-partners.com> - 1.38-1
- Type:enhancement
- ID:NA