From b1c7368f95e93ccdefdd0748e04398c26766f47f Mon Sep 17 00:00:00 2001 From: Lasse Collin Date: Fri, 8 Oct 2010 15:25:45 +0300 Subject: Build: Add options to disable individual command line tools. --- src/Makefile.am | 15 +++++++++++- src/scripts/Makefile.am | 62 +++++++++++++++++++++---------------------------- src/xz/Makefile.am | 6 ++++- src/xzdec/Makefile.am | 12 ++++++++-- 4 files changed, 55 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/Makefile.am b/src/Makefile.am index f03f5a3d..9fb4caad 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,5 +5,18 @@ ## You can do whatever you want with this file. ## -SUBDIRS = liblzma xz xzdec lzmainfo scripts +SUBDIRS = liblzma xzdec + +if COND_XZ +SUBDIRS += xz +endif + +if COND_LZMAINFO +SUBDIRS += lzmainfo +endif + +if COND_SCRIPTS +SUBDIRS += scripts +endif + EXTRA_DIST = common diff --git a/src/scripts/Makefile.am b/src/scripts/Makefile.am index 86f27388..29bdbcd7 100644 --- a/src/scripts/Makefile.am +++ b/src/scripts/Makefile.am @@ -8,58 +8,48 @@ nodist_bin_SCRIPTS = xzdiff xzgrep xzmore xzless dist_man_MANS = xzdiff.1 xzgrep.1 xzmore.1 xzless.1 +links = \ + xzdiff-xzcmp \ + xzgrep-xzegrep \ + xzgrep-xzfgrep + +if COND_LZMALINKS +links += \ + xzdiff-lzdiff \ + xzdiff-lzcmp \ + xzgrep-lzgrep \ + xzgrep-lzegrep \ + xzgrep-lzfgrep \ + xzmore-lzmore \ + xzless-lzless +endif + install-exec-hook: cd $(DESTDIR)$(bindir) && \ - target=`echo xzdiff | sed '$(transform)'` && \ - for name in xzcmp lzdiff lzcmp; do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link && \ - $(LN_S) $$target $$link; \ - done && \ - target=`echo xzgrep | sed '$(transform)'` && \ - for name in xzegrep xzfgrep lzgrep lzegrep lzfgrep; do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link && \ - $(LN_S) $$target $$link; \ - done && \ - for name in xzmore xzless; do \ - target=`echo $$name | sed '$(transform)'` && \ - link=`echo $$name | sed 's/xz/lz/;$(transform)'` && \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ rm -f $$link && \ $(LN_S) $$target $$link; \ done install-data-hook: cd $(DESTDIR)$(mandir)/man1 && \ - target=`echo xzdiff | sed '$(transform)'` && \ - for name in xzcmp lzdiff lzcmp; do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1 && \ - $(LN_S) $$target.1 $$link.1; \ - done && \ - target=`echo xzgrep | sed '$(transform)'` && \ - for name in xzegrep xzfgrep lzgrep lzegrep lzfgrep; do \ - link=`echo $$name | sed '$(transform)'` && \ - rm -f $$link.1 && \ - $(LN_S) $$target.1 $$link.1; \ - done && \ - for name in xzmore xzless; do \ - target=`echo $$name | sed '$(transform)'` && \ - link=`echo $$name | sed 's/xz/lz/;$(transform)'` && \ + for pair in $(links); do \ + target=`echo $$pair | sed 's/-.*$$//' | sed '$(transform)'` && \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ rm -f $$link.1 && \ $(LN_S) $$target.1 $$link.1; \ done uninstall-hook: cd $(DESTDIR)$(bindir) && \ - for name in xzcmp lzdiff lzcmp xzegrep xzfgrep \ - lzgrep lzegrep lzfgrep lzmore lzless; do \ - link=`echo $$name | sed '$(transform)'` && \ + for pair in $(links); do \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ rm -f $$link; \ done cd $(DESTDIR)$(mandir)/man1 && \ - for name in xzcmp lzdiff lzcmp xzegrep xzfgrep \ - lzgrep lzegrep lzfgrep lzmore lzless; do \ - link=`echo $$name | sed '$(transform)'` && \ + for pair in $(links); do \ + link=`echo $$pair | sed 's/^.*-//' | sed '$(transform)'` && \ rm -f $$link.1; \ done diff --git a/src/xz/Makefile.am b/src/xz/Makefile.am index e4ed59cf..10ceee75 100644 --- a/src/xz/Makefile.am +++ b/src/xz/Makefile.am @@ -69,7 +69,11 @@ dist_man_MANS = xz.1 ## Create symlinks for unxz and xzcat for convenience. Create symlinks also ## for lzma, unlzma, and lzcat for compatibility with LZMA Utils 4.32.x. -xzlinks = unxz xzcat lzma unlzma lzcat +xzlinks = unxz xzcat + +if COND_LZMALINKS +xzlinks += lzma unlzma lzcat +endif install-exec-hook: cd $(DESTDIR)$(bindir) && \ diff --git a/src/xzdec/Makefile.am b/src/xzdec/Makefile.am index c31a30a7..2348e4e6 100644 --- a/src/xzdec/Makefile.am +++ b/src/xzdec/Makefile.am @@ -12,8 +12,6 @@ $(xzdec_CPPFLAGS) $(CPPFLAGS) $(RCFLAGS) -i $< -o $@ -bin_PROGRAMS = xzdec lzmadec - xzdec_SOURCES = \ xzdec.c \ $(top_srcdir)/src/common/tuklib_progname.c \ @@ -51,8 +49,17 @@ lzmadec_LDFLAGS = $(xzdec_LDFLAGS) lzmadec_LDADD = $(xzdec_LDADD) +bin_PROGRAMS = + +if COND_XZDEC +bin_PROGRAMS += xzdec dist_man_MANS = xzdec.1 +endif +if COND_LZMADEC +bin_PROGRAMS += lzmadec + +# FIXME: If xzdec is disabled, this will create a dangling symlink. install-data-hook: cd $(DESTDIR)$(mandir)/man1 && \ target=`echo xzdec | sed '$(transform)'` && \ @@ -64,3 +71,4 @@ uninstall-hook: cd $(DESTDIR)$(mandir)/man1 && \ link=`echo lzmadec | sed '$(transform)'` && \ rm -f $$link.1 +endif -- cgit v1.2.3