Perl6-Pugs

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

= Changes for 6.2.13 (r14402) - October 17, 2006

== Build System

* Perl 5 embedding is now enabled by default
** For Windows users, Perl 5.8.x is required
** Set the `PUGS_EMBED` environment variable to `noperl5` to disable this

* Prompting for Parrot embedding is now disabled by default
** Set the `PUGS_EMBED` environment variable to `parrot` to enable this

* Support for compiling using GHC 6.6
** GHC 6.4.1+ is still supported, but 6.6 will be required in the next release

== Feature Changes

=== Interactive Shell and Command-Line Flags

* New `pugs -d` flag to display a trace for debugging
* The `:r` command now resets the environment once, not twice

INSTALL  view on Meta::CPAN


There are several environment variables that control pugs's build process.

You may use the GHC environment variable to set the ghc executable before 
you run "perl Makefile.PL", for example:

    export GHC=${HOME}/bin/ghc (bash)
    setenv GHC ${HOME}/bin/ghc (csh)
    
To control which optional subsystems are embedded in Pugs, set the 
PUGS_EMBED variable. For example: 
 
    export PUGS_EMBED="parrot noperl5" (bash)
    setenv PUGS_EMBED "parrot noperl5" (csh)

Perl5 is now embedded by default.  Use "noperl5" to disable.

To build with an embedded parrot interpreter, make sure the PUGS_EMBED 
variable contains "parrot", and set the PARROT_PATH variable to point to 
the directory in which you checked out the parrot source tree. For example:
 
    export PARROT_PATH=${HOME}/src/parrot (bash)
    setenv PARROT_PATH ${HOME}/src/parrot (csh)

MAKE TARGETS
------------

The default make target builds an optimized Pugs. This means that Pugs will

Makefile.PL  view on Meta::CPAN

    # XXX - This is no longer needed for GHC 6.6!
    if ($Config{osname} eq 'cygwin' or $Config{osname} eq 'MSWin32') {
        $heap = WIN32_GHC_HEAPSIZE;
    }

    $heap = PugsBuild::Config->lookup('ghc_heap_size') || $heap;
    $ghc_flags .= " +RTS -M$heap -RTS" if $heap;
    # $ghc_flags .= ' -dcore-lint';
    # $ghc_flags .= " -keep-tmp-files";

    if ($ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /\bhaskell\b/i) {
        if (has_ghc_package('plugins')
            and  try_compile("import System.Eval\n"
                            ."main :: IO ()\n"
                            .'main = (eval_ "return ()" [] [] [] [] :: IO (Either [String] (Maybe ()))) >> return ()', $ghc, '-package', 'plugins')) {
            $ghc_flags .= ' -package plugins -DPUGS_HAVE_HSPLUGINS ';
        }
        else {
            push @warn, << '.';
*** Inline Haskell support disabled.  If you want dynamic loading
    of haskell modules, please install the hs-plugins library:

Makefile.PL  view on Meta::CPAN

    my @prereqs = ($pcre);
    my @derived_srcfiles = qw< src/Pugs/Embed/Parrot.hs src/Pugs/pugs_config.h src/Pugs/pugs_version.h src/Pugs/Config.hs src/Pugs/Prelude.hs src/Pugs/CodeGen/PIR/Prelude.hs >;

    my $embed_flags = "";
    my $hsc2hs_flags = "";
    my $ccdlflags = "";

    # [-!]perl5 does not work with the \bFLAG\b convention used in this file.
    # It should be removed, or the convention, and code, fixed.
    # Went in 2006-08-30.  Depreciated 2006-09-11.
    if ($ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /[-!]perl5\b/i) {
        push @warn,  << '.';
*** PUGS_EMBED flags "-perl5" and "!perl5" are depreciated and buggy.
    Please use "noperl5" instead.

.
    }
    if (!$ENV{PUGS_EMBED} or $ENV{PUGS_EMBED} !~ /(?:[-!]|\bno)perl5\b/i) {
        $ENV{PUGS_EMBED} .= " perl5 ";
        #push @prereqs, "src/perl5/p5embed.o"; # XXX
        # $ghc_output .= " src/perl5/p5embed.o ";
        $embed_flags .= " -DPUGS_HAVE_PERL5 -isrc/perl5 ";
        my $flags = "$Config{ccflags} $Config{ccdlflags} ";
        if ($flags =~ /\S/) {
            $flags =~ s{([\\"'])}{\\$1}g;
            my @flags = grep { length $_ } split /\s+/, $flags;
            if ($^O eq 'MSWin32') {
                if ($Config{libperl} =~ /lib(\w+)\.a/) {
                    $embed_flags .= " -optl-l$1 ";

Makefile.PL  view on Meta::CPAN

                };
                $embed_flags =~ s{(/usr/\S+)}{$cygpath->($1)}eg;
                $embed_flags =~ s{/cygdrive/(\w)/}{$1:/}g;
                #warn "** Cygwin embedding flags: embed_flags\n";
            }
        }
    }
    else {
        push @warn, << '.';
*** Perl 5 embedding disabled.  If you want Perl 5 support, please set the
    PUGS_EMBED environment variable to not contain "noperl5".

.
    }
    
    if ($ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /\bparrot\b/i and $Config{cc} eq 'cl') {
        push @warn, << '.';
*** Parrot linking not supported with MSVC.  Parrot linking will be disabled.

.
        $ENV{PUGS_EMBED} =~ s/\bparrot\b//g;
    }

    # Respect CC setting
    my $cc = $ENV{CC} || 'gcc';
    $ghc_flags .= " -pgmc $cc " unless $cc eq 'gcc';

    if ($Config{cf_by} eq 'Debian Project' and $ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /\bperl5\b/i) {
        # Is it safe to remove 'Debian Project' above, to test on all platforms?
        my $need_path = 1;
        my $libperlpath = '';
        my $libperl = $Config{libperl};
        foreach my $path (split(/\s/, $Config{libpth} . ' ' . $Config{libsdirs})) {
            if (-e "$path/libperl.so") {
                $need_path = 0;
                last;
            } elsif (-e "$path/$libperl") {
                $libperlpath ||= $path;
            }
        }
        if ($need_path) {
            my $message = '';
            $message .= qq[        * Symlink $libperlpath/$libperl to libperl.so\n] if ($libperlpath and $libperl);
            $message .= qq[        * Install libperl-dev package\n] if ($Config{cf_by} eq 'Debian Project');
            die <<EOD;
*** Could not find libperl.so in: $Config{libpth} $Config{libsdirs}
    Solutions include:
        * Add noperl5 to PUGS_EMBED
$message
EOD
        }
    }

    if ($ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /\bparrot\b/i) {
        my $base = $ENV{PARROT_PATH};
        my $parrot_config = which('parrot-config.imc') || which('parrot-config.pir') || which('parrot-config') || '';
        if (!$base && -e $parrot_config) {
            $base = (File::Spec->splitpath($parrot_config))[1];
        }
        if (!$base) {
            $parrot_config = which('parrot-config') || '';
            $base = (File::Spec->splitpath($parrot_config))[1] if -e $parrot_config;
        }
        if (!$base and -d File::Spec->catdir(File::Spec->updir, 'parrot')) {

Makefile.PL  view on Meta::CPAN

        my $config = $parrot_libdir."/parrot/config/install_config$Config{_o}";
        $config = $parrot_libdir."/parrot/config/parrot_config$Config{_o}" unless -e $config;
        $config = $parrot_libdir."/parrot/config/null_config$Config{_o}" unless -e $config;
        $config = "$build_dir/src/install_config$Config{_o}" unless -e $config;
        $config = "$build_dir/src/parrot_config$Config{_o}" unless -e $config;
        $config = "$build_dir/src/null_config$Config{_o}" unless -e $config;

        die <<"EOD" unless -e $config or $is_shared; 
*** Could not find src/null_config.o in $build_dir.
    Solutions include:
        * Remove parrot from PUGS_EMBED
        * Place a built Parrot source tree under $build_dir.
EOD

        $embed_flags .= " $config ";
        $embed_flags .= " $rpath_blib " if -d $build_dir;

        # parrot include paths for hsc2hs
        $hsc2hs_flags .= " -DPUGS_HAVE_PARROT -I$base/include ";

        push @warn, << ".";

Makefile.PL  view on Meta::CPAN


        if ($whichparrot) {
            push @warn, << ".";
*** External 'parrot' executable found in your PATH at:

        $whichparrot

    You can use it for Perl 6 regex support by setting the
    PUGS_REGEX_ENGINE environment variable to "PGE" at runtime.

    If you want to link against Parrot, set the PUGS_EMBED environment
    variable to contain 'parrot', the PARROT_PATH environment variable to
    the path of a built parrot tree, then run Makefile.PL again.

.
        }
    }

    my $config = get_pugs_config();
    my $is_win32 = ($^O =~ /MSWin|mingw|cygwin/i);
    my $threaded = (try_compile_and_run("main :: IO ()\nmain = return ()", $ghc, "-threaded")) ? '-threaded' : '';

    if ($threaded and $ENV{PUGS_EMBED} and $ENV{PUGS_EMBED} =~ /\bperl5\b/ and !$Config{usethreads}) {
        push @warn, << '.';
*** Thread support disabled because you are building with embedded perl5 and
    your perl5 is not threaded.

.

        $threaded = '';
    }
    if ($threaded && $ENV{PUGS_NO_THREADS}) {
        push @warn, << '.';

docs/summaries/2006/06-30.yaml  view on Meta::CPAN

          YAPC docathon could work on making this clearer.
      - date_from: 1151450313
        date_to: 1151535354
        hidden: ~
        message_id: 1151450223.597799.130150@d56g2000cwd.googlegroups.com
        posters:
          - email: mmalaure@hotmail.com
        subject: problem compiling UTF8 on Win32
        summary: |-
          A problem was reported with compiling UTF8 on Win32, but the same
          poster discovered that `PUGS_EMBED` had been set tp 'perl5' and
          removing the setting fixed the problem.
    title: perl6-compiler

examples/network/evalbot/evalbot-loop  view on Meta::CPAN

    die "This should be run from the root directory of a pugs $svn checkout\n";
}

chomp(my $PUGSHOME = `pwd`);

$nick_base ||= "evalbot";
@channels = ('#perl6') unless @channels;

my $pid = 0;

$ENV{PUGS_EMBED} = 'perl5';
$ENV{PERL6LIB} = "$PUGSHOME/blib6/lib";

my $pipe = "evalbot_nick";

sub update_pugs {
    print STDERR "*** Updating repository...\n";
    system "$svn update";
    my $revision;
    if ($svn eq 'svn') {
        my $info = `$svn info`;

src/perl5/p5embed.c  view on Meta::CPAN

#include "p5embed.h"
#include <XSUB.h>
#include "perlxsi.c"
#include "pugsembed.c"

/* define to enable pugsembed debug messages */
#define PERL5_EMBED_DEBUG 0

#if PERL5_EMBED_DEBUG
#define oRZ ""
#define hate Perl_croak(aTHX_ "hate software")
#else
#define oRZ "#"
#define hate
#endif

/* Workaround for mapstart: the only op which needs a different ppaddr */
#undef Perl_pp_mapstart
#define Perl_pp_mapstart Perl_pp_grepstart

src/perl5/p5embed.c  view on Meta::CPAN

    dXSARGS;
    if (items < 1) {
        hate;
    }

    val = pugs_Eval(SvPV_nolen(ST(0)));

    New(6, stack, items, Val*);

    for (i = 1; i < items; ++i) {
#if PERL5_EMBED_DEBUG
        fprintf(stderr, "put into stack: %s\n", SvPV_nolen(ST(i)));
#endif
        stack[i-1] = pugs_SvToVal(ST(i));
    }
    stack[i-1] = NULL;
    
    ST(0) = pugs_Apply(val, NULL, stack, GIMME_V);
    Safefree(stack);
    
    XSRETURN(1);

src/perl5/p5embed.c  view on Meta::CPAN

    exitstatus = perl_parse(my_perl, xs_init, argc, argv, (char **)NULL);

    if (exitstatus == 0)
        exitstatus = perl_run( my_perl );

    __init = 1;

    newXS((char*) "pugs::guts::invoke", _pugs_guts_invoke, (char*)__FILE__);
    newXS((char*) "pugs::guts::eval_apply", _pugs_guts_eval_apply, (char*)__FILE__);

#if PERL5_EMBED_DEBUG
    fprintf(stderr, "(%s)", pugs_guts_code);
#endif
    eval_pv(pugs_guts_code, TRUE);

    if (SvTRUE(ERRSV)) {
        STRLEN n_a;
        printf("Error init perl: %s\n", SvPV(ERRSV,n_a));
        exit(1);
    }
    return my_perl;

src/perl5/pugsembed.c  view on Meta::CPAN

                /* no error happened -- used the tied obj */
                sv = rv[1];
            }
            else {
                fprintf(stderr, "error in pugs::guts application on type: %s\n", typeStr);
                sv_dump(rv[0]);
            }
        }
        else {
            /* for scalar ref, should still turn into tied one */
#if PERL5_EMBED_DEBUG
            fprintf(stderr, "unknown type\n");
#endif
        }
    }

    return (sv);
}

Val *pugs_getenv ()
{

util/cperl-mode.el  view on Meta::CPAN

      (set-buffer buf))
    (if (= (buffer-size) 0)
	(progn
	  (insert (documentation-property 'cperl-short-docs
					  'variable-documentation))
	  (setq buffer-read-only t)))))

(defun cperl-beautify-regexp-piece (b e embed level)
  ;; b is before the starting delimiter, e before the ending
  ;; e should be a marker, may be changed, but remains "correct".
  ;; EMBED is nil iff we process the whole REx.
  ;; The REx is guaranteed to have //x
  ;; LEVEL shows how many levels deep to go
  ;; position at enter and at leave is not defined
  (let (s c tmp (m (make-marker)) (m1 (make-marker)) c1 spaces inline code pos)
    (if (not embed)
	(goto-char (1+ b))
      (goto-char b)
      (cond ((looking-at "(\\?\\\\#")	;  (?#) wrongly commented when //x-ing
	     (forward-char 2)
	     (delete-char 1)

util/smoke_loop.sh  view on Meta::CPAN

# AFTER_CMD='DEST=pasta:.htdocs/pugs_test_status; rsync -avz html/ $DEST/; rsync -avz docs/haddock/ $DEST/haddock/'

# this is the -j param to make and the PUGS_TEST_CONCURRENT value
PARALLEL_PROCS=3

#### CONFIG ENDS ####




export PUGS_EMBED=parrot

while true; do
    while [ `svn up | wc -l` -le 1 ]; do
        sleep 300;
    done

    rm -rf html
    mkdir html

    wait; # finish cleanup



( run in 1.723 second using v1.01-cache-2.11-cpan-71847e10f99 )