From 04be9e4ab0bfd1499adda077ecbac21b567e541b Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 15 Jun 2013 17:52:29 -0600 Subject: mv src/devtools/lib/common.sh src/lib/ # and add common-devtools.mk --- src/lib/.gitignore | 3 +++ src/lib/Makefile | 43 +++++++++++++++++++++++++++++++++++++------ src/lib/common.sh.top | 13 +++++++++++++ 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 src/lib/.gitignore create mode 100644 src/lib/common.sh.top (limited to 'src/lib') diff --git a/src/lib/.gitignore b/src/lib/.gitignore new file mode 100644 index 0000000..9a0c402 --- /dev/null +++ b/src/lib/.gitignore @@ -0,0 +1,3 @@ +common.sh +common.sh.in +common.sh.top diff --git a/src/lib/Makefile b/src/lib/Makefile index e1068c1..8683ee1 100644 --- a/src/lib/Makefile +++ b/src/lib/Makefile @@ -1,10 +1,41 @@ -libre_execdir=$(bindir) -libre_datadir=$(libexecdir)/libretools -include ../../common.mk +include ../../common-devtools.mk +pkglibexecdir=$(libexecdir)/libretools + +# Copy from devtools ################################################# + +copy: common.sh.in + +common.sh.in: $(devtoolsdir)/lib/common.sh ; cp $< $@ + +# Build ############################################################## + +build: common.sh + +lib/common.sh: %: %.in %.top Makefile + @echo "GEN $@" + @{ \ + cat "$*.top" && \ + echo 'if [[ -z $${_INCLUDE_COMMON_SH:-} ]]; then' && \ + echo '_INCLUDE_COMMON_SH=true' && \ + cat "$*.in" && \ + echo 'fi'; } > "$@" + +# Install ############################################################ + +executables = $(wildcard libre*) +libraries = $(wildcard *.sh) + +# relative path to `/` from $(bindir) rootdir=$(shell sed -r 's|^/||;s|[^/]+|..|g'<<<$(bindir)) -$(DESTDIR)$(libre_execdir)/%: % - install -Dm755 '$<' '$(DESTDIR)$(libre_datadir)/$(@F)' +install: \ + $(addprefix $(DESTDIR)$(bindir)/,$(executables)) \ + $(addprefix $(DESTDIR)$(pkglibexecdir)/,$(executables) $(libraries)) + +$(DESTDIR)$(bindir)/%: % install -d '$(@D)' - ln -sf '$(rootdir)$(libre_datadir)/$(@F)' "$@" + ln -sf '$(rootdir)$(pkglibexecdir)/$(@F)' "$@" + +$(DESTDIR)$(pkglibexecdir)/%: % + install -Dm755 '$<' '$@' diff --git a/src/lib/common.sh.top b/src/lib/common.sh.top new file mode 100644 index 0000000..d59268d --- /dev/null +++ b/src/lib/common.sh.top @@ -0,0 +1,13 @@ +#!/bin/bash -euE +#!/bin/bash +# This file is included by libremessages. +# You should probably use libremessages instead of this. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. -- cgit v1.2.3-54-g00ecf