Changeset 7447 for src/Pugs.hs

Show
Ignore:
Timestamp:
10/08/05 21:00:13 (3 years ago)
Author:
iblech
Message:

* util/PugsConfig.pm: Very minor comment fix.
* src/Pugs/Run.hs: Include $pugslibdir/perl6 in the default @*INC.
* src/Pugs.hs: Find jspugs.pl, runjs.pl, and pugs-p5.pl even if $sourcedir

had been deleted and thus $pugslibdir has to be used.
The patch is a bit hacky (for example, pugs-p5.pl is searched for in --
amongst other dirs -- PIL2JS), but seems reasonable given that the directory
structure of $sourcedir doesn't match the one of $pugslibdir.
Note: PIL-Run still can't be run from $pugslibdir.
Note: pugs::hack is not yet updated WRT the recent dir moves.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs.hs

    r7405 r7447  
    232232    case map toLower backend of 
    233233        "js"    -> if (args' == []) 
    234                    then (doExecuteHelper [ "perl5", "PIL2JS",  "jspugs.pl"  ] args) 
    235                    else (doExecuteHelper [ "perl5", "PIL2JS",  "runjs.pl"   ] args) 
    236         "perl5" ->       doExecuteHelper [ "perl5", "PIL-Run", "pugs-p5.pl" ] args 
     234                   then (doExecuteHelper "jspugs.pl" args) 
     235                   else (doExecuteHelper "runjs.pl"  args) 
     236        "perl5" ->       doExecuteHelper "pugs-p5.pl" args 
    237237        _       ->       fail ("unknown backend: " ++ backend) 
    238238    where 
     
    244244    f (x:xs) = x:f xs 
    245245 
    246 doExecuteHelper :: [FilePath] -> [String] -> IO () 
     246doExecuteHelper :: FilePath -> [String] -> IO () 
    247247doExecuteHelper helper args = do 
    248     let searchPaths = [["."], ["..", ".."], [getConfig "installsitelib"], [getConfig "sourcedir"]] 
     248    let searchPaths = concatMap (\x -> map (x++) suffixes) [["."], ["..", ".."], [getConfig "sourcedir"], [getConfig "pugslibdir"]] 
    249249    mbin <- findHelper searchPaths 
    250250    case mbin of 
    251251        Just binary -> do 
    252252            exitWith =<< executeFile' perl5 True (binary:args) Nothing 
    253         _ -> fail ("Couldn't find helper program " ++ (foldl1 joinFileName helper) ++ " (searched in " ++ show searchPaths ++ ")") 
    254     where 
     253        _ -> fail ("Couldn't find helper program " ++ helper ++ " (searched in " ++ show (map (foldl1 joinFileName) searchPaths) ++ ")") 
     254    where 
     255    suffixes = 
     256        [ [] 
     257        , ["perl5", "PIL2JS"]      --  $sourcedir/perl5/PIL2JS/jspugs.pl 
     258        , ["perl5", "PIL-Run"]     --  $sourcedir/perl5/PIL-Run/pugs-p5.pl 
     259        , ["perl5", "lib"]         --  $pugslibdir/perl5/lib/jspugs.pl 
     260        , ["perl5", "lib", "PIL"]  --  $pugslibdir/perl5/PIL/pugs-p5.pl 
     261        ] 
    255262    perl5 = getConfig "perl5path" 
    256263    findHelper :: [[FilePath]] -> IO (Maybe FilePath) 
     
    270277                | filex'    -> return $ Just $ file' x 
    271278                | otherwise -> findHelper xs 
    272     file  x = foldl1 joinFileName (x ++ helper) 
     279    file  x = foldl1 joinFileName (x ++ [helper]) 
    273280    file' x = (file x) ++ (getConfig "exe_ext") 
    274281    fileExists path = do