From 45c048241d3766ed1b6f1637d04b33d26d60ffed Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 7 Feb 2015 17:33:18 +0000 Subject: calcdep: Remove a workaround for a very old version of BSD Make. --- make/calcdep.pl | 3 --- 1 file changed, 3 deletions(-) (limited to 'make/calcdep.pl') diff --git a/make/calcdep.pl b/make/calcdep.pl index 376d19573..626d3a194 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -42,9 +42,6 @@ sub run() { unlink 'include'; symlink "$ENV{SOURCEPATH}/include", 'include'; mkdir $_ for qw/bin modules obj/; -# BSD make has a horribly annoying bug resulting in an extra chdir of the make process -# Create symlinks to work around it - symlink "../$_", "obj/$_" for qw/bin coremods modules obj/; $build = getcwd(); open MAKE, '>real.mk' or die "Could not write real.mk: $!"; -- cgit v1.2.3 From 32b789eec181ccbe720fa75abed8b2f3fddaff47 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 7 Feb 2015 17:55:20 +0000 Subject: calcdep: Use the same preamble as other Perl tools. --- make/calcdep.pl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'make/calcdep.pl') diff --git a/make/calcdep.pl b/make/calcdep.pl index 626d3a194..66eb4f3dc 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -19,8 +19,17 @@ # +BEGIN { + require 5.10.0; + unless (-f 'configure') { + print "Error: $0 must be run from the main source directory!\n"; + exit 1; + } +} + use strict; -use warnings; +use warnings FATAL => qw(all); + use POSIX qw(getcwd); sub find_output; -- cgit v1.2.3 From f02e766924fb7aac0444797a67753ff2c78e5919 Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 7 Feb 2015 17:58:16 +0000 Subject: calcdep: Clean up some unused/duplicate variables. --- make/calcdep.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'make/calcdep.pl') diff --git a/make/calcdep.pl b/make/calcdep.pl index 66eb4f3dc..b1102cfc1 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -30,7 +30,10 @@ BEGIN { use strict; use warnings FATAL => qw(all); -use POSIX qw(getcwd); +use constant { + BUILDPATH => $ENV{BUILDPATH}, + SOURCEPATH => $ENV{SOURCEPATH} +}; sub find_output; sub gendep($); @@ -45,16 +48,14 @@ run; exit 0; sub run() { - my $build = $ENV{BUILDPATH}; - mkdir $build; - chdir $build or die "Could not open build directory: $!"; + mkdir BUILDPATH; + chdir BUILDPATH or die "Could not open build directory: $!"; unlink 'include'; - symlink "$ENV{SOURCEPATH}/include", 'include'; + symlink "${\SOURCEPATH}/include", 'include'; mkdir $_ for qw/bin modules obj/; - $build = getcwd(); open MAKE, '>real.mk' or die "Could not write real.mk: $!"; - chdir "$ENV{SOURCEPATH}/src"; + chdir "${\SOURCEPATH}/src"; if ($ENV{PURE_STATIC}) { run_static(); @@ -65,7 +66,6 @@ sub run() { } sub run_dynamic() { - my $build = $ENV{BUILDPATH}; print MAKE <, , "threadengines/threadengine_pthread.cpp") { my $out = find_output $file, 1; if ($out =~ m#obj/([^/]+)/[^/]+.o$#) { - mkdir "$ENV{BUILDPATH}/obj/$1"; + mkdir "${\BUILDPATH}/obj/$1"; } dep_cpp $file, $out, 'gen-o'; next if $file =~ m#^socketengines/# && $file ne "socketengines/socketengine_$ENV{SOCKETENGINE}.cpp"; -- cgit v1.2.3 From 70faab99c83a9ee13cdbe84118e391ed9d5f5a9f Mon Sep 17 00:00:00 2001 From: Peter Powell Date: Sat, 7 Feb 2015 19:19:56 +0000 Subject: calcdep: Unify coremod and module building code. --- make/calcdep.pl | 56 +++++++++++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 35 deletions(-) (limited to 'make/calcdep.pl') diff --git a/make/calcdep.pl b/make/calcdep.pl index b1102cfc1..513038843 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -77,10 +77,10 @@ bad-target: \@echo "in order to set the correct environment variables" \@exit 1 -all: inspircd coremods modules +all: inspircd modules END - my(@core_deps, @cmodlist, @modlist); + my(@core_deps, @modlist); for my $file (<*.cpp>, , , "threadengines/threadengine_pthread.cpp") { my $out = find_output $file; dep_cpp $file, $out, 'gen-o'; @@ -88,40 +88,28 @@ END push @core_deps, $out; } - opendir my $coremoddir, 'coremods'; - for my $file (sort readdir $coremoddir) { - next if $file =~ /^\./; - if ($file =~ /^core_/ && -d "coremods/$file" && dep_dir "coremods/$file", "modules/$file") { - mkdir "${\BUILDPATH}/obj/$file"; - push @cmodlist, "modules/$file.so"; - } - if ($file =~ /^core_.*\.cpp$/) { - my $out = dep_so "coremods/$file"; - push @cmodlist, $out; - } - } - - opendir my $moddir, 'modules'; - for my $file (sort readdir $moddir) { - next if $file =~ /^\./; - if (-e "modules/extra/$file" && !-l "modules/$file") { - # Incorrect symlink? - print "Replacing symlink for $file found in modules/extra\n"; - rename "modules/$file", "modules/$file~"; - symlink "extra/$file", "modules/$file"; - } - if ($file =~ /^m_/ && -d "modules/$file" && dep_dir "modules/$file", "modules/$file") { - mkdir "${\BUILDPATH}/obj/$file"; - push @modlist, "modules/$file.so"; - } - if ($file =~ /^m_.*\.cpp$/) { - my $out = dep_so "modules/$file"; - push @modlist, $out; + foreach my $directory (qw(coremods modules)) { + opendir(my $moddir, $directory); + for my $file (sort readdir $moddir) { + next if $file =~ /^\./; + if ($directory eq 'modules' && -e "modules/extra/$file" && !-l "modules/$file") { + # Incorrect symlink? + print "Replacing symlink for $file found in modules/extra\n"; + rename "modules/$file", "modules/$file~"; + symlink "extra/$file", "modules/$file"; + } + if ($file =~ /^(?:core|m)_/ && -d "$directory/$file" && dep_dir "$directory/$file", "modules/$file") { + mkdir "${\BUILDPATH}/obj/$file"; + push @modlist, "modules/$file.so"; + } + if ($file =~ /^.*\.cpp$/) { + my $out = dep_so "$directory/$file"; + push @modlist, $out; + } } } my $core_mk = join ' ', @core_deps; - my $cmods = join ' ', @cmodlist; my $mods = join ' ', @modlist; print MAKE <