From edb2d028551e54a4f328a8798353ca3cffef875e Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Mon, 6 Feb 2017 22:47:41 +0100 Subject: [PATCH] cmdline-opts: Fixed build and test in out of source tree builds --- docs/cmdline-opts/Makefile.am | 2 +- docs/cmdline-opts/gen.pl | 10 +++++----- src/Makefile.am | 2 +- tests/data/test1139 | 2 +- tests/manpage-scan.pl | 5 +++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/cmdline-opts/Makefile.am b/docs/cmdline-opts/Makefile.am index 3467de156..c844bca4f 100644 --- a/docs/cmdline-opts/Makefile.am +++ b/docs/cmdline-opts/Makefile.am @@ -73,4 +73,4 @@ EXTRA_DIST = $(DPAGES) MANPAGE.md gen.pl $(OTHERPAGES) all: $(MANPAGE) $(MANPAGE): $(DPAGES) $(OTHERPAGES) - @PERL@ gen.pl mainpage > $(MANPAGE) + @PERL@ $(srcdir)/gen.pl mainpage $(srcdir) > $(MANPAGE) diff --git a/docs/cmdline-opts/gen.pl b/docs/cmdline-opts/gen.pl index 89a5df845..91e893f3e 100755 --- a/docs/cmdline-opts/gen.pl +++ b/docs/cmdline-opts/gen.pl @@ -16,7 +16,7 @@ Unfortunately it seems some perls like msysgit can't handle a global input-only =end comment =cut -my $some_dir="."; +my $some_dir=$ARGV[1] || "."; opendir(my $dh, $some_dir) || die "Can't opendir $some_dir: $!"; my @s = grep { /\.d$/ && -f "$some_dir/$_" } readdir($dh); @@ -101,7 +101,7 @@ sub added { sub single { my ($f, $standalone)=@_; - open(F, "<:crlf", "$f") || + open(F, "<:crlf", "$some_dir/$f") || return 1; my $short; my $long; @@ -235,7 +235,7 @@ sub single { sub getshortlong { my ($f)=@_; - open(F, "<:crlf", "$f"); + open(F, "<:crlf", "$some_dir/$f"); my $short; my $long; my $help; @@ -281,7 +281,7 @@ sub indexoptions { sub header { my ($f)=@_; - open(F, "<:crlf", "$f"); + open(F, "<:crlf", "$some_dir/$f"); my @d; while() { push @d, $_; @@ -371,7 +371,7 @@ sub getargs { } } while($f); - print "Usage: gen.pl \n"; + print "Usage: gen.pl [srcdir]\n"; } #------------------------------------------------------------------------ diff --git a/src/Makefile.am b/src/Makefile.am index 67fa6d70d..19bab68ac 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -93,7 +93,7 @@ EXTRA_DIST = mkhelp.pl makefile.dj Makefile.b32 \ macos/src/curl_GUSIConfig.cpp macos/src/macos_main.cpp makefile.amiga \ curl.rc Makefile.netware Makefile.inc Makefile.Watcom CMakeLists.txt -MANPAGE=$(top_srcdir)/docs/curl.1 +MANPAGE=$(top_builddir)/docs/curl.1 README=$(top_srcdir)/docs/MANUAL MKHELP=$(top_srcdir)/src/mkhelp.pl HUGE=tool_hugehelp.c diff --git a/tests/data/test1139 b/tests/data/test1139 index 30f730c2e..17c74097f 100644 --- a/tests/data/test1139 +++ b/tests/data/test1139 @@ -19,7 +19,7 @@ Verify that all libcurl options have man pages -%SRCDIR/manpage-scan.pl %SRCDIR/.. +%SRCDIR/manpage-scan.pl %SRCDIR/.. %PWD/.. diff --git a/tests/manpage-scan.pl b/tests/manpage-scan.pl index f374be99d..1cc47eb31 100644 --- a/tests/manpage-scan.pl +++ b/tests/manpage-scan.pl @@ -39,8 +39,9 @@ use strict; use warnings; -# we may get the dir root pointed out +# we may get the dir roots pointed out my $root=$ARGV[0] || "."; +my $buildroot=$ARGV[1] || "."; my $syms = "$root/docs/libcurl/symbols-in-versions"; my $curlh = "$root/include/curl/curl.h"; my $errors=0; @@ -196,7 +197,7 @@ close(R); ######################################################################### # parse the curl.1 man page, extract all documented command line options -open(R, "<$root/docs/curl.1") || +open(R, "<$buildroot/docs/curl.1") || die "no input file"; my @manpage; # store all parsed parameters while() {