From ac2a6ec8f8485ee10c53be818f11fc1d5f31bbcb Mon Sep 17 00:00:00 2001 From: sof Date: Thu, 11 Jun 1998 19:26:53 +0000 Subject: [PATCH] [project @ 1998-06-11 19:26:50 by sof] -syslib win32: Do the right thing if using a non-installed compiler --- ghc/driver/ghc.lprl | 27 ++++++++++++++++----------- ghc/utils/mkdependHS/mkdependHS.prl | 29 +++++++++++++++++++++++------ 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/ghc/driver/ghc.lprl b/ghc/driver/ghc.lprl index 4edb575..9f96736 100644 --- a/ghc/driver/ghc.lprl +++ b/ghc/driver/ghc.lprl @@ -2453,18 +2453,23 @@ sub add_Hsc_flags { sub add_syslib { local($syslib) = @_; - unshift(@SysImport_dir, - $INSTALLING ? "$InstLibDirGhc/imports/$syslib" - : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib"); - - push(@SysLibrary_dir, - $INSTALLING ? ("$InstLibDirGhc") - : ("$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib", - "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib/cbits")); - + # The Win32 lib sources live in hslibs/ + if ( $syslib eq 'win32' && ! $INSTALLING ) { + unshift(@SysImport_dir, "$TopPwd/hslibs/$syslib/src"); + push(@SysLibrary_dir, "$TopPwd/hslibs/$syslib/src"); + } else { + unshift(@SysImport_dir, + $INSTALLING ? "$InstLibDirGhc/imports/$syslib" + : "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib"); + + push(@SysLibrary_dir, + $INSTALLING ? ("$InstLibDirGhc") + : ("$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib", + "$TopPwd/$CURRENT_DIR/$GHC_LIB_DIR/$syslib/cbits")); + } push(@SysLibrary, "-lHS$syslib"); push(@SysLibrary, "-lHS${syslib}_cbits") - unless $syslib =~ /^(contrib|exts|conc|win32)$/; #HACK! have no cbits + unless $syslib =~ /^(contrib|exts|concurrent|win32)$/; #HACK! have no cbits } \end{code} @@ -2813,7 +2818,7 @@ arg: while($_ = $Args[0]) { /^-syslib(.*)/ && do { local($syslib) = &grab_arg_arg(*Args,'-syslib',$1); print STDERR "$Pgm: no such system library (-syslib): $syslib\n", - $Status++ unless $syslib =~ /^(exts|misc|posix|win32)$/; + $Status++ unless $syslib =~ /^(exts|misc|posix|concurrent|win32)$/; # # The posix library is a `special' in that it relies on diff --git a/ghc/utils/mkdependHS/mkdependHS.prl b/ghc/utils/mkdependHS/mkdependHS.prl index 2dca4db..a1cbac0 100644 --- a/ghc/utils/mkdependHS/mkdependHS.prl +++ b/ghc/utils/mkdependHS/mkdependHS.prl @@ -127,9 +127,14 @@ if (!$Include_prelude) { } foreach $lib ( @Syslibs ) { - local($dir) = - ($INSTALLING) ? "${InstLibDirGhc}/imports/${lib}" - : "${TopPwd}/ghc/lib/${lib}"; + local($dir); + + if ( $lib eq 'win32' && ! $INSTALLING ) { + $dir = "${TopPwd}/hslibs/${lib}/src"; + } else { + $dir = ($INSTALLING) ? "${InstLibDirGhc}/imports/${lib}" + : "${TopPwd}/ghc/lib/${lib}"; + } if (!$Include_prelude) { push(@Ignore_dirs,$dir); } else { @@ -360,7 +365,8 @@ sub preprocess_import_dirs { sub slurp_file_for_imports { local($file_to_read, $orig_src_file) = @_; - local($follow_file); + local($follow_file,$read_from_file); + local($cleanup)=0; local($last_seen_dir) = $orig_src_file; $last_seen_dir =~ s/\/[^\/]+$//; # strip to dir name @@ -373,13 +379,17 @@ sub slurp_file_for_imports { local ($open_cmd); if ($Cpp_flag_set) { - $open_cmd = "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |"; +# $open_cmd = "${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines |"; + &run_something("${SED} -e '/^# *include/{p;s/^# *include/!include/;};s/'\\''//g;s/\"//g' $file_to_read | $Cpp $Include_dirs -I$last_seen_dir @Defines 2>&1 > ${file_to_read}.i", 'Running cpp'); + $read_from_file="${file_to_read}.i"; + $cleanup=1; } else { + $read_from_file="${file_to_read}"; $open_cmd = $file_to_read; } print STDERR "$open_cmd\n" if $Verbose; - open(SRCFILE, $open_cmd) || die "$Pgm: Can't open $file_to_read: $!\n"; + open(SRCFILE, $read_from_file) || die "$Pgm: Can't open $file_to_read: $!\n"; while () { # @@ -396,6 +406,13 @@ sub slurp_file_for_imports { &process_dependency($todo,$source,$modname); } close(SRCFILE) || exit(1); + # remove temporary file, if any. + if ($cleanup) { + # truncate() may not be implemented, so we + # play it safe here. + local(*TRUNC); + open(TRUNC,"> $read_from_file") && close(TRUNC); + } } # -- 1.7.10.4