diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 114 |
1 files changed, 53 insertions, 61 deletions
@@ -1044,74 +1044,66 @@ EOF # but right now we only parse .inspircd.inc to form './inspircd' prepare_dynamic_makefile(); - print "Writing \e[1;32mMakefiles\e[0m\n"; + my @dotfiles = qw(main.mk inspircd); + push @dotfiles, 'org.inspircd.plist' if $config{OSNAME} eq 'darwin'; - opendir(DIRHANDLE, $this); - - foreach my $name (sort readdir(DIRHANDLE)) { - if ($name =~ /^\.(.+)\.inc$/) { - $file = $1; - - # Bug #353, omit this on non-darwin - next if (($config{OSNAME} !~ /darwin/) && ($file eq "org.inspircd.plist")); + foreach my $file (@dotfiles) { + open(FILEHANDLE, "make/template/$file") or die "Can't open make/template/$file: $!"; + $_ = join '', <FILEHANDLE>; + close(FILEHANDLE); - # All .name.inc files need parsing! - open(FILEHANDLE, ".$file.inc") or die ("Can't open .$file.inc"); - $_ = join '', <FILEHANDLE>; - close(FILEHANDLE); + $config{BUILD_DIR} ||= resolve_directory($config{ME}."/build"); + for my $var (qw( + CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR + STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE + )) { + s/\@$var\@/$config{$var}/g; + } + s/\@EXECUTABLE\@/$exe/ if defined $exe; + s/\@VERSION\@/$version/ if defined $version; + + if ($file eq 'main.mk') { + print "Writing \e[1;32mGNUmakefile\e[0m ...\n"; + + my $mk_tmp = $_; + s/\@IFDEF (\S+)/ifdef $1/g; + s/\@IFNDEF (\S+)/ifndef $1/g; + s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g; + s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g; + s/\@ELSE/else/g; + s/\@ENDIF/endif/g; + s/ *\@BSD_ONLY .*\n//g; + s/\@GNU_ONLY //g; + s/\@DO_EXPORT (.*)/export $1/g; + open MKF, '>GNUmakefile' or die "Can't write to GNUmakefile: $!"; + print MKF $_; + close MKF; + + print "Writing \e[1;32mBSDmakefile\e[0m ...\n"; + $_ = $mk_tmp; + s/\@IFDEF (\S+)/.if defined($1)/g; + s/\@IFNDEF (\S+)/.if !defined($1)/g; + s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g; + s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g; + s/\@ELSE/.else/g; + s/\@ENDIF/.endif/g; + s/\@BSD_ONLY //g; + s/ *\@GNU_ONLY .*\n//g; + $mk_tmp = $_; + $mk_tmp =~ s#\@DO_EXPORT (.*)#"MAKEENV += ".join ' ', map "$_='\${$_}'", split /\s/, $1#eg; + open MKF, '>BSDmakefile' or die "Can't write to BSDmakefile: $!"; + print MKF $mk_tmp; + close MKF; + } else { print "Writing \e[1;32m$file\e[0m ...\n"; - - $config{BUILD_DIR} ||= resolve_directory($config{ME}."/build"); - - for my $var (qw( - CC SYSTEM BASE_DIR CONFIG_DIR MODULE_DIR BINARY_DIR BUILD_DIR - STARTSCRIPT DESTINATION EXTRA_DIR SOCKETENGINE - )) { - s/\@$var\@/$config{$var}/g; - } - s/\@EXECUTABLE\@/$exe/ if defined $exe; - s/\@VERSION\@/$version/ if defined $version; - - if ($file eq 'Makefile') { - my $mk_tmp = $_; - s/\@IFDEF (\S+)/ifdef $1/g; - s/\@IFNDEF (\S+)/ifndef $1/g; - s/\@IFEQ (\S+) (\S+)/ifeq ($1,$2)/g; - s/\@ELSIFEQ (\S+) (\S+)/else ifeq ($1,$2)/g; - s/\@ELSE/else/g; - s/\@ENDIF/endif/g; - s/ *\@BSD_ONLY .*\n//g; - s/\@GNU_ONLY //g; - s/\@DO_EXPORT (.*)/export $1/g; - open MKF, '>GNUmakefile' or die "Can't write to GNUmakefile: $!"; - print MKF $_; - close MKF; - $_ = $mk_tmp; - s/\@IFDEF (\S+)/.if defined($1)/g; - s/\@IFNDEF (\S+)/.if !defined($1)/g; - s/\@IFEQ (\S+) (\S+)/.if $1 == $2/g; - s/\@ELSIFEQ (\S+) (\S+)/.elif $1 == $2/g; - s/\@ELSE/.else/g; - s/\@ENDIF/.endif/g; - s/\@BSD_ONLY //g; - s/ *\@GNU_ONLY .*\n//g; - $mk_tmp = $_; - $mk_tmp =~ s#\@DO_EXPORT (.*)#"MAKEENV += ".join ' ', map "$_='\${$_}'", split /\s/, $1#eg; - open MKF, '>BSDmakefile' or die "Can't write to BSDmakefile: $!"; - print MKF $mk_tmp; - close MKF; - } else { - open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n"); - print FILEHANDLE $_; - close(FILEHANDLE); - } + open(FILEHANDLE, ">$file") or die("Can't write to $file: $!\n"); + print FILEHANDLE $_; + close(FILEHANDLE); } } - closedir(DIRHANDLE); - # Make inspircd executable! - chmod 0744, 'inspircd'; + chmod 0755, 'inspircd'; } sub depcheck |