mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-10-04 07:57:45 +00:00
build: fix usage of sed and drop build-aux/genman
"sed -i" is a GNU specific extention. Replace with more portable version and drop completely genman in favour of a make rule. Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com> Reviewed-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
parent
9240c8d565
commit
3a64fc4382
@ -37,7 +37,6 @@ EXTRA_DIST = autogen.sh $(SPEC).in \
|
||||
build-aux/git-version-gen \
|
||||
build-aux/gitlog-to-changelog \
|
||||
build-aux/release.mk \
|
||||
build-aux/genman \
|
||||
.version
|
||||
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
@ -1,52 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Set variables
|
||||
# in - input man page (something_foo.3.in)
|
||||
# out - output file (something_foo.3)
|
||||
# common - common ipc error file
|
||||
|
||||
in="$1"
|
||||
out="$2"
|
||||
common="$3"
|
||||
|
||||
# make sure to trap on error and ctrl+c
|
||||
# so we can cleanup our temporary files
|
||||
# and provide error back to Makefile
|
||||
cleanup() {
|
||||
rm -f "$out"-t "$out"
|
||||
}
|
||||
|
||||
trap "cleanup" ABRT
|
||||
trap "cleanup" QUIT
|
||||
trap "cleanup" TERM
|
||||
trap "cleanup" INT
|
||||
trap "cleanup" ERR
|
||||
|
||||
# Determine build date in man page format YYYY-MM-DD
|
||||
date="$(LC_ALL=C date "+%F")"
|
||||
|
||||
# do the hack.. it looks ugly but it works fine
|
||||
|
||||
# remove temporary file
|
||||
rm -f "$out"-t
|
||||
|
||||
# insert the $common ipc error file in the man page
|
||||
if grep -q @COMMONIPCERRORS@ "$in"; then
|
||||
awk "{print}(\$1 ~ /@COMMONIPCERRORS@/){exit 0}" "$in" > "$out"-t
|
||||
cat "$common" >> "$out"-t
|
||||
awk -v p=0 "(\$1 ~ /@COMMONIPCERRORS@/){p = 1} {if(p==1)print}" "$in" >> "$out"-t
|
||||
else
|
||||
cp "$in" "$out"-t
|
||||
fi
|
||||
|
||||
# substitute BUILDDATE with precalculated date
|
||||
# and remove COMMONIPCERRORS tag from above
|
||||
sed -i \
|
||||
-e 's#@BUILDDATE@#'$date'#g' \
|
||||
-e 's#@COMMONIPCERRORS@##g' \
|
||||
"$out"-t
|
||||
|
||||
# move in place as requested
|
||||
mv "$out"-t "$out"
|
@ -47,14 +47,13 @@ initscript_SCRIPTS = corosync corosync-notifyd
|
||||
|
||||
%: %.in Makefile
|
||||
rm -f $@-t $@
|
||||
cp $< $@-t
|
||||
sed -i \
|
||||
cat $< | sed \
|
||||
-e 's#@''SBINDIR@#$(sbindir)#g' \
|
||||
-e 's#@''SYSCONFDIR@#$(sysconfdir)#g' \
|
||||
-e 's#@''INITDDIR@#$(INITDDIR)#g' \
|
||||
-e 's#@''INITWRAPPERSDIR@#$(INITWRAPPERSDIR)#g' \
|
||||
-e 's#@''LOCALSTATEDIR@#$(localstatedir)#g' \
|
||||
$@-t
|
||||
> $@-t
|
||||
mv $@-t $@
|
||||
|
||||
all-local: $(initscript_SCRIPTS) $(systemdconf_DATA)
|
||||
|
@ -140,13 +140,18 @@ endif
|
||||
HTML_DOCS = $(dist_man_MANS:%=%.html) $(man_MANS:%=%.html)
|
||||
|
||||
# developer man page generation
|
||||
%.3: %.3.in $(autogen_common) $(top_srcdir)/build-aux/genman
|
||||
%.3: %.3.in $(autogen_common)
|
||||
@echo Generating $@ man page && \
|
||||
rm -f $@-t $@ && \
|
||||
$(top_srcdir)/build-aux/genman \
|
||||
$(srcdir)/$@.in \
|
||||
$(builddir)/$@-t \
|
||||
$(srcdir)/$(autogen_common) && \
|
||||
rm -f $@-t-t $@-t $@ && \
|
||||
date="$$(LC_ALL=C date "+%F")" && \
|
||||
awk "{print}(\$$1 ~ /@COMMONIPCERRORS@/){exit 0}" $@.in > $@-t-t && \
|
||||
cat $(autogen_common) >> $@-t-t && \
|
||||
awk -v p=0 "(\$$1 ~ /@COMMONIPCERRORS@/){p = 1} {if(p==1)print}" $@.in >> $@-t-t && \
|
||||
cat $@-t-t | \
|
||||
sed -e 's#@BUILDDATE@#'$$date'#g' \
|
||||
-e 's#@COMMONIPCERRORS@##g' \
|
||||
> $@-t && \
|
||||
rm -f $@-t-t && \
|
||||
mv $@-t $@
|
||||
|
||||
clean-local:
|
||||
|
Loading…
Reference in New Issue
Block a user