From 5511989854671aa28628a43cf723603211297241 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Thu, 31 Oct 2019 12:01:34 +0100 Subject: Use a work directory --- bundle/Configure.pl | 319 +++++++++++++++++++++++++++++++++++++++++++++++++++ bundle/README.md | 229 ++++++++++++++++++++++++++++++++++++ bundle/build_msi.bat | 10 ++ 3 files changed, 558 insertions(+) create mode 100644 bundle/Configure.pl create mode 100644 bundle/README.md create mode 100644 bundle/build_msi.bat (limited to 'bundle') diff --git a/bundle/Configure.pl b/bundle/Configure.pl new file mode 100644 index 0000000..4a1984e --- /dev/null +++ b/bundle/Configure.pl @@ -0,0 +1,319 @@ +#! perl +# Copyright (C) 2009-2018 The Perl Foundation + +use 5.008; +use strict; +use warnings; +use Text::ParseWords; +use Getopt::Long; +use File::Spec; +use Cwd; +use lib 'tools/lib'; +use NQP::Configure qw(sorry slurp cmp_rev gen_nqp read_config + fill_template_text fill_template_file + system_or_die verify_install); + +my $lang = 'Rakudo'; +my $lclang = lc $lang; +my $uclang = uc $lang; +my $slash = $^O eq 'MSWin32' ? '\\' : '/'; + + +MAIN: { + if (-r 'config.default') { + unshift @ARGV, shellwords(slurp('config.default')); + } + + my %config = (perl => $^X); + my $config_status = "${lclang}_config_status"; + $config{$config_status} = join ' ', map { qq("$_") } @ARGV; + + my $exe = $NQP::Configure::exe; + + my %options; + GetOptions(\%options, 'help!', 'prefix=s', + 'sysroot=s', 'sdkroot=s', + 'backends=s', 'no-clean!', + 'gen-nqp:s', 'gen-moar:s', 'moar-option=s@', + 'make-install!', 'makefile-timing!', + 'force!', + ) or do { + print_help(); + exit(1); + }; + + # Print help if it's requested + if ($options{'help'}) { + print_help(); + exit(0); + } + + if (-d '.git') { + worry( + $options{'force'}, + "I see a .git directory here -- you appear to be trying", + "to run Configure.pl from a clone of the Rakudo Star git", + "repository.", + "You most probably should be following", + " tools/star/release-guide.pod", + "instead. Please be aware that running Configure.pl from", + "a clone of the rakudo star git repo will never be", + "the right thing to do.", + $options{'force'} ? '--force specified, continuing' : download_text() + ); + } + + unless (defined $options{prefix}) { + + my $default = defined($options{sysroot}) ? '/usr' : File::Spec->catdir(getcwd, 'install'); + print "ATTENTION: no --prefix supplied, building and installing to $default\n"; + + $options{prefix} = $default; + } + + $options{prefix} = File::Spec->rel2abs($options{prefix}); + + my $prefix = $options{'prefix'}; + my %known_backends = (jvm => 1, moar => 1); + my %letter_to_backend; + my $default_backend; + + for (keys %known_backends) { + $letter_to_backend{ substr($_, 0, 1) } = $_; + } + + my %backends; + + if (defined $options{backends}) { + $options{backends} = 'moar,jvm' if lc($options{backends}) eq 'all'; + + for my $b (split /,\s*/, $options{backends}) { + $b = lc $b; + + if (!$known_backends{$b}) { + die "Unknown backend '$b'; Supported backends are: " . join(", ", sort keys %known_backends) . "\n"; + } + + $backends{$b} = 1; + $default_backend ||= $b; + } + + if (!%backends) { + die "--prefix given, but no valid backend?!\n"; + } + } + else { + for my $l (sort keys %letter_to_backend) { + # TODO: needs .exe/.bat magic on windows? + if (-x "$prefix/bin/nqp-$l") { + my $b = $letter_to_backend{$l}; + print "Found $prefix/bin/nqp-$l (backend $b)\n"; + $backends{$b} = 1; + $default_backend ||= $b; + } + } + if (exists $options{'gen-moar'}) { + $backends{moar} = 1; + $default_backend ||= 'moar'; + } + unless (%backends) { + die "No suitable nqp executables found! Please specify some --backends, or a --prefix that contains nqp-{p,j,m} executables\n\n" + . "Example to build for all backends (which will take a while):\n" + . "\tperl Configure.pl --backends=moar,jvm --gen-moar\n\n" + . "Example to build for MoarVM only:\n" + . "\tperl Configure.pl --gen-moar\n\n" + . "Example to build for JVM only:\n" + . "\tperl Configure.pl --backends=jvm --gen-nqp\n\n"; + } + } + + $config{backends} = join ',', keys %backends; + $config{backend_exes} = join ' ', map + { '$(RAKUDO_DIR)/$(PERL6_' . uc(substr $_, 0, 1) . '_EXE)' } + keys %backends; + $config{backend_modules_install} = join ' ', map + { 'modules-install-' . lc(substr $_, 0, 1) } + keys %backends; + $config{backend_modules_test} = join ' ', map + { 'modules-test-' . lc(substr $_, 0, 1) } + keys %backends; + $config{verbose_backend_modules_test} = join ' ', map + { 'verbose-modules-test-' . lc(substr $_, 0, 1) } + keys %backends; + $config{default_backend_exe} = '$(PERL6_' . + uc(substr $default_backend, 0, 1) . + '_INSTALL)'; + + if ($backends{jvm}) { + warn "Warning: JVM backend does not yet support all modules\n"; + } + + # Save options in config.status + unlink('config.status'); + if (open(my $CONFIG_STATUS, '>', 'config.status')) { + print $CONFIG_STATUS + "$^X Configure.pl $config{$config_status} \$*\n"; + close($CONFIG_STATUS); + } + + $config{prefix} = $prefix; + $config{sdkroot} = $options{sdkroot}; + $config{sysroot} = $options{sysroot}; + $config{pass_rakudo_config} = ""; + $config{pass_rakudo_config} .= $options{sdkroot} ? " --sdkroot=\"\$(SDKROOT_DIR)\"" : ""; + $config{pass_rakudo_config} .= $options{sysroot} ? " --sysroot=\"\$(SYSROOT_DIR)\"" : ""; + $config{slash} = $slash; + $config{'makefile-timing'} = $options{'makefile-timing'}; + $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'}; + $config{'cpsep'} = $^O eq 'MSWin32' ? ';' : ':'; + $config{'shell'} = $^O eq 'MSWin32' ? 'cmd' : 'sh'; + $config{'bat'} = $^O eq 'MSWin32' ? '.bat' : ''; + $config{'path'} = $^O ne 'MSWin32' ? 'sh -c "PATH=\'$(STAR_BIN_DIR):$(PATH)\'' : 'cmd /c "path $(STAR_BIN_DIR);$(PATH) && '; + my $make = $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make'; + + my @prefixes = sort map substr($_, 0, 1), keys %backends; + + # determine the version of NQP we want + my ($nqp_want) = split(' ', slurp('rakudo/tools/templates/NQP_REVISION')); + + my %binaries; + my %impls = gen_nqp($nqp_want, prefix => $prefix, backends => join(',', sort keys %backends), %options); + + my @errors; + my %errors; + if ($backends{jvm}) { + $config{j_nqp} = $impls{jvm}{bin}; + $config{j_nqp} =~ s{/}{\\}g if $^O eq 'MSWin32'; + my %nqp_config; + if ( $impls{jvm}{config} ) { + %nqp_config = %{ $impls{jvm}{config} }; + } + else { + push @errors, "Unable to read configuration from NQP on the JVM"; + } + my $bin = $impls{jvm}{bin}; + + if (!@errors && !defined $nqp_config{'jvm::runtime.jars'}) { + push @errors, "jvm::runtime.jars value not available from $bin --show-config."; + } + + $errors{jvm}{'no gen-nqp'} = @errors && !defined $options{'gen-nqp'}; + + unless (@errors) { + %config = (%nqp_config, %config); + print "Using $bin.\n"; + } + } + if ($backends{moar}) { + $config{m_nqp} = $impls{moar}{bin}; + $config{m_nqp} =~ s{/}{\\}g if $^O eq 'MSWin32'; + my %nqp_config; + if ( $impls{moar}{config} ) { + %nqp_config = %{ $impls{moar}{config} }; + } + else { + push @errors, "Unable to read configuration from NQP on MoarVM"; + } + + $errors{moar}{'no gen-nqp'} = @errors && !defined $options{'gen-nqp'}; + + unless (@errors) { + %config = (%nqp_config, %config); + print "Using $config{m_nqp} (version $nqp_config{'nqp::version'} / MoarVM $nqp_config{'moar::version'}).\n"; + } + } + + if ($errors{jvm}{'no gen-nqp'} || $errors{moar}{'no gen-nqp'}) { + my @options_to_pass; + push @options_to_pass, "--gen-moar" if $backends{moar}; + push @options_to_pass, "--gen-nqp" unless @options_to_pass; + my $options_to_pass = join ' ', @options_to_pass; + my $want_executables = + $backends{moar} + ? ' and MoarVM' + : ''; + my $s1 = @options_to_pass > 1 ? 's' : ''; + my $s2 = $want_executables ? 's' : ''; + push @errors, + "\nTo automatically clone (git) and build a copy of NQP $nqp_want,", + "try re-running Configure.pl with the '$options_to_pass' option$s1.", + "Or, use '--prefix=' to explicitly specify the path where the NQP$want_executables", + "executable$s2 can be found that are use to build $lang."; + } + sorry(@errors) if @errors; + + fill_template_file('tools/build/Makefile.in', 'Makefile', %config); + + unless ($options{'no-clean'}) { + no warnings; + print "Cleaning up ...\n"; + for my $p ('', map { "-$_" } @prefixes) { + if (open my $CLEAN, '-|', "$make configclean$p") { + my @slurp = <$CLEAN>; + close($CLEAN); + } + } + } + + if ($options{'make-install'}) { + system_or_die($make); + system_or_die($make, 'install'); + print "\n$lang has been built and installed.\n"; + } + else { + print "\nYou can now use '$make' to build $lang.\n"; + print "After that, '$make test' will run some tests and\n"; + print "'$make install' will install $lang.\n"; + } + + exit 0; +} + + +# Print some help text. +sub print_help { + print <<"END"; +Configure.pl - $lang Configure + +General Options: + --help Show this text + --prefix=dir Install files in dir; also look for executables there + --sdkroot=dir When given, use for searching build tools here, e.g. + nqp, java etc. + --sysroot=dir When given, use for searching runtime components here + --backends=jvm,moar + Which backend(s) to use + --gen-moar[=branch] + Download and build a copy of MoarVM + --gen-nqp[=branch] + Download and build a copy of NQP + --makefile-timing Enable timing of individual makefile commands + --moar-option='--option=value' + Options to pass to MoarVM's Configure.pl + +Configure.pl also reads options from 'config.default' in the current directory. +END + + return; +} + +sub download_text { + ("The git repository contains the tools needed to build a Rakudo Star", + "release, but does not contain a complete Rakudo Star release.", + "To download and build the latest release of Rakudo Star, please", + "download a .tar.gz file from https://rakudo.perl6.org/downloads/star/ .") +} + +sub worry { + my ($force, @text) = @_; + sorry(@text) unless $force; + print join "\n", @text, ''; +} + + +# Local Variables: +# mode: cperl +# cperl-indent-level: 4 +# fill-column: 100 +# End: +# vim: expandtab shiftwidth=4: diff --git a/bundle/README.md b/bundle/README.md new file mode 100644 index 0000000..857b3a6 --- /dev/null +++ b/bundle/README.md @@ -0,0 +1,229 @@ +This is Rakudo Star, a useful, usable Rakudo Perl 6 production distribution. + +This is the 2019.03 release of Rakudo Star for the 6.d version of Perl 6. + +Rakudo Star is Copyright (C) 2010 - 2019 by the Rakudo Star Team. + + +License Information +------------------- +Rakudo Star is distributed under the terms of the Artistic License 2.0. +This distribution contains software collected from other sources; see the +individual source subdirectories (in rakudo/, MoarVM/ and modules/) +for copyright and licensing information of those components. + + +Overview +-------- +The Rakudo Perl 6 compiler can target MoarVM and the JVM. Rakudo Star fully +supports MoarVM; not all modules work on the JVM at present. You can choose +to build and install Rakudo for one or more of these virtual machines at +configure time. + + +Build Prerequisites for Rakudo on MoarVM +---------------------------------------- +To build Rakudo Star on MoarVM, you need at least a 'make' utility, a C +compiler, and Perl 5.10.0 or newer. Building Rakudo on MoarVM needs a +machine with a gigabyte of memory; for a 32-bit build, you may get by +with less. + + +Build Prerequisites for Rakudo on the JVM +----------------------------------------- +Please note that this release of Rakudo Star is *not* fully functional with the +JVM backend from the Rakudo compiler. Use the JVM backend only if you are +trying to help with fixing JVM support (which is best done upstream with the +monthly Rakudo release). This is a known issue and it's not worth reporting +JVM failures as bugs unless you have patches. + +To build an experimental Rakudo Star on the JVM, you need at least a 'make' +utility, both 'java' and 'javac' available in your path, and Perl 5.10.0 or +newer. The 'java' and 'javac' are obtained by installing a Java Development +kit, for example openjdk-8 or the Oracle JDK. + +The newer the JDK you have the better; due to bugs in the invokedynamic +instruction in early releases, JDK 8 or above is needed. The build can +complete within a gigabyte of memory. + + +Configuring Rakudo Star +----------------------- +The easiest way to build Rakudo Star for a particular backend is: + + $ perl Configure.pl --backend=moar --gen-moar # MoarVM + $ perl Configure.pl --backend=jvm --gen-nqp # JVM + +You can also build for all backends: + + $ perl Configure.pl --backend=moar,jvm --gen-moar + +Note that --gen-moar automatically builds a MoarVM for you, and implies +--gen-nqp, which builds NQP, a subset of Perl 6 that is used to implement +Rakudo. + +Configured this way, one or more Perl 6 executables and selected Perl 6 +modules will be installed into the install/ subdirectory, which resides inside +the source archive directory. Running make install will *not* install anything +into /usr/local. If you want to change this behavior, specify the install +prefix using the --prefix option. + +Configuring with the --prefix option +------------------------------------ +If you want to install rakudo into a system-wide directory, you must either +have root privileges or own the desired installation directory. Assuming you +are root, use any of the desired configuration commands shown above and add +"--prefix=$INSTDIR" to the end where $INSTDIR is the installation directory +of choice. + +Building Rakudo Star +-------------------- +After configuration, build Rakudo Star on a UNIX-like system with: + + $ make + $ make install + +Rakudo Star can be built on Windows either using Microsoft tools (MSVC) and +nmake or using gcc and gmake as bundled with Strawberry Perl. In the latter +case use cmd.exe rather than bash as a shell. + +Note that possible platform-specific errata may be covered under: +https://perl6.org/downloads/ + +Setting up the environment +-------------------------- +To set up the environment under a UNIX type system you will need to add the +absolute path of the local "install/bin" directory under your source build +directory or system-wide "${INSTDIR}/bin" directory (if you used the +--prefix option) to your PATH environment variable. + +Note also that other executable scripts such as "p6doc" will be installed +under "${INSTDIR}/share/perl6/site/bin" so you also need to add that to the +PATH for development convenience. + +You will have to append the %PATH% in a similar way under Windows. You +may have to use Windows type directory path separators. + +You will be reminded of the two additions to the PATH by a welcome message +after the source build completes. + +Once Rakudo Star is installed (and assuming perl6 is in your PATH), you can +run Perl 6 programs by doing: + + $ perl6 hello.p6 + +If the Rakudo compiler is invoked without an explicit script to run, it +enters a small interactive mode that allows Perl 6 statements to be executed +from the command line. + + +Running the Perl 6 test suite +----------------------------- +Entering "make rakudo-test" will run a small test suite that comes bundled +with Rakudo. This is a simple suite of tests, designed to make sure that the +Rakudo compiler is basically working and that it's capable of running a simple +test harness. + +Running "make rakudo-spectest" will run the Perl 6 specification test suite +("roast") that was bundled with the Rakudo compiler release. + +Running "make modules-test" will run the test suites of any installed modules. +The modules currently have to be installed (via 'make install' or 'make +modules-install') before the tests can be run. + +Currently a number of roast tests may be reported as missing due to a known +issue with test suite versioning. This can be ignored and it's hoped this will +be fixed shortly. + + +Perl 6 Documentation +-------------------- +The official documentation site is https://docs.perl6.org/ + +This distribution also contains documentation in the docs/ directory: + + docs/cheatsheet.txt — Perl 6 cheat sheet + docs/2015-spw-perl6-course.pdf — A short Perl 6 course + docs/perl6intro.pdf — Recent snapshot of https://perl6intro.com/ + docs/announce/ — Detailed release announcements + +https://perl6intro.com/ is available in multiple languages, French, German, +Japanese, Spanish, Portuguese, Dutch, Bulgarian, Chinese, Italian, Turkish, +Indonesian and Russian at the time of writing. + + +Installing Perl 6 Modules +------------------------- +zef is a module installer bundled with Rakudo Star. + +See https://github.com/ugexe/zef for zef documentation. + +A list of modules available in the "ecosystem" is at https://modules.perl6.org/ + +Git is useful for zef. + +When upgrading between versions of perl 6 it may be necessary to remove +~/.perl6 and/or ~/.zef due to a possible toolchain bug. If you see this issue +please email details as suggested in the "Reporting Bugs" section below. + + +Where to get help or answers to questions +----------------------------------------- +'p6doc faq' will display a version of the FAQ. + +Also see https://faq.perl6.org/ + +There are several mailing lists, IRC channels, and wikis available with help +for Perl 6 and Rakudo. + +A friendly IRC channel for new starter questions is irc.freenode.net/#perl6 + +The Rakudo and MoarVM development teams tend to hang out on IRC a fair bit, on +irc.freenode.net/#perl6-dev and irc.freenode.net/#moarvm, respectively. + +IRC tends to be busier than the mailing lists but if you have a question about +Perl 6 syntax or the right way to approach a problem using Perl 6, you could +use the perl6-users@perl.org mailing list. This list is primarily for the +people who want to use Perl 6 to write programs, as opposed to those who are +implementing or developing the Perl 6 language itself. + +Questions about the Rakudo compiler can go to perl6-compiler@perl.org. + +The https://perl6.org/ website contains a great many links to resources for Perl +6 development, and is generally the starting point for information about Perl +6. + +Rakudo's official web site is https://rakudo.org/, where you can +find useful information for developers and users alike. + + +Reporting bugs +-------------- +Bug reports about Rakudo Star or the Perl 6 specification should be sent to +rakudobug@perl.org with the moniker [BUG] (including the brackets) at the +start of the subject so that it gets appropriately tagged in the RT system +(https://rt.perl.org/rt3/). Please include or attach any sample source code +that exhibits the bug, and include either the release name/date or the git +commit identifier. You find this information in the output from "perl6 +--version". There's no need to Cc: the perl6-compiler mailing list, as the RT +system will handle this on its own. + + +Submitting patches +------------------ +Patches to the Rakudo compiler itself should be submitted to +'rakudobug@perl.org'. Patches for individual modules should be submitted to +the module authors (see the module source code for details). + +We'll generally accept patches in any form if we can get them to work, but +unified diff from the 'git' command is greatly preferred. See further +instructions in the rakudo/ subdirectory for more details. Other ways to +create and submit patches are discussed at +https://github.com/rakudo/rakudo/wiki/contrib-introduction + + +AUTHOR +------ +Patrick Michaud (pmichaud@pobox.com) was originally the primary author and +maintainer for Rakudo Star. See docs/CREDITS for further Rakudo Star authors, +and */CREDITS for authors of other collected components. diff --git a/bundle/build_msi.bat b/bundle/build_msi.bat new file mode 100644 index 0000000..270c5f9 --- /dev/null +++ b/bundle/build_msi.bat @@ -0,0 +1,10 @@ +rem needs strawberry perl installed and WiX Toolset in the %path% +rmdir /q/s \rakudo +perl Configure.pl --prefix=C:\rakudo --gen-moar +gmake install +rem following two lines are temporary hack +rem main rakudo star Configure.pl needs fixing for windows +copy c:\strawberry\perl\bin\libgcc_s_sjlj-1.dll c:\rakudo\bin +copy c:\strawberry\perl\bin\libwinpthread-1.dll c:\rakudo\bin +copy c:\strawberry\perl\bin\libgcc_s_seh-1.dll c:\rakudo\bin +gmake msi -- cgit v1.1