Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build system improvements #917

Closed
p6rt opened this issue Apr 19, 2009 · 7 comments
Closed

build system improvements #917

p6rt opened this issue Apr 19, 2009 · 7 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Apr 19, 2009

Migrated from rt.perl.org#64868 (status was 'resolved')

Searchable as RT64868$

@p6rt
Copy link
Author

p6rt commented Apr 19, 2009

From @moritz

Rakudo's build system is currently suboptimal in various ways. At least
some of these items could be tackled by somebody with some Makefile
and/or Perl 5 knowledge.

1)
Currently the required parrot revision is stored in
build/PARROT_REVISION. `perl Configure.pl --gen-parrot' builds that
version of parrot, but calling it without the --gen-parrot option should
at least warn if the existing parrot is too old (perhaps it should even
die outright, don't know what's best).

2)
A 'make' warns when the Makefile is out of date, but not if the the
required parrot revision is not met. It would be nice if such a warning
was emitted.

3)
A 'make parrot' builds parrot if it's not up to date, but after that a
normal rakudo build usually fails, which a 'make clean' in Rakudo's root
directory fixes. So a 'make parrot' that actually downloads and builds a
new parrot should also clean the rakudo directory.

4) Currently calling 'make' twice in a row invokes dynpmc.pl on the
second invocation, even though it should do nothing. This is disturbing
because it means that a 'make t/spec/some/file.t' will interfere with a
running 'make spectest' even when none of the source files changed.

--
Moritz Lenz
http://perlgeek.de/ | http://perl-6.de/ | http://sudokugarden.de/

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

From ascent-perl@azor.pl

I've attached patch. Few comments about your points​:

1. I used die, instead of warning. I think this will be better.
2. I did it like pmichaud said on #perl6.
3. There is make clean before checking out new Parrot in gen_parrot.pl.
4. No changes about this.

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

From ascent-perl@azor.pl

rt64868.patch
diff --git a/Configure.pl b/Configure.pl
index 0d98d59..de61435 100644
--- a/Configure.pl
+++ b/Configure.pl
@@ -9,7 +9,7 @@ use Getopt::Long;
 MAIN: {
     my %options;
     GetOptions(\%options, 'help!', 'parrot-config=s',
-               'gen-parrot!', 'gen-parrot-option=s@');
+               'gen-parrot!', 'gen-parrot-option=s@', 'check-parrot-revision!');
 
     # Print help if it's requested
     if ($options{'help'}) {
@@ -17,16 +17,6 @@ MAIN: {
         exit(0);
     }
 
-    # Update/generate parrot build if needed
-    if ($options{'gen-parrot'}) {
-        my @opts    = @{ $options{'gen-parrot-option'} || [] };
-        my @command = ($^X, "build/gen_parrot.pl", @opts);
-
-        print "Generating Parrot ...\n";
-        print "@command\n\n";
-        system @command;
-    }
-
     # Get a list of parrot-configs to invoke.
     my @parrot_config_exe = qw(
         parrot/parrot_config
@@ -38,6 +28,38 @@ MAIN: {
         @parrot_config_exe = ($options{'parrot-config'});
     }
 
+    # Check used by Makefile to be sure that Parrot revision is okay.
+    if ($options{'check-parrot-revision'}) {
+        my $parrot_revision;
+        for my $exe (@parrot_config_exe) {
+            no warnings;
+            if (open my $PARROT_CONFIG, '-|', "$exe revision") {
+                while (<$PARROT_CONFIG>) {
+                    y/\r\n//d;
+                    $parrot_revision = $_;
+                }
+                close $PARROT_CONFIG;
+                last if $parrot_revision;
+            }
+        }
+
+        if ($parrot_revision && minimal_parrot_revision() > $parrot_revision) {
+            print "\nwarning: Parrot is out of date... re-run Configure.pl with --gen-parrot option.\n\n";
+        }
+
+        exit(0);
+    }
+
+    # Update/generate parrot build if needed
+    if ($options{'gen-parrot'}) {
+        my @opts    = @{ $options{'gen-parrot-option'} || [] };
+        my @command = ($^X, "build/gen_parrot.pl", @opts);
+
+        print "Generating Parrot ...\n";
+        print "@command\n\n";
+        system @command;
+    }
+
     #  Get configuration information from parrot_config
     my %config = read_parrot_config(@parrot_config_exe);
     unless (%config) {
@@ -50,6 +72,19 @@ the location of parrot_config.
 END
     }
 
+    # Check if Parrot revision isn't too old
+    my $min_parrot_rev = minimal_parrot_revision();
+
+    printf "\nFound Parrot r%d (needed at least: r%d)\n", $config{revision}, $min_parrot_rev;
+
+    if ($min_parrot_rev > $config{revision}) {
+        die <<'END';
+Your Parrot is too old!
+To automatically checkout (svn) and build a copy of parrot,
+try re-running Configure.pl with the '--gen-parrot' option.
+END
+    }
+
 #  Create the Makefile using the information we just got
     create_makefile(%config);
 
@@ -119,6 +154,11 @@ sub slurp {
     return $maketext;
 }
 
+sub minimal_parrot_revision {
+    my $rev = slurp('build/PARROT_REVISION');
+    $rev =~ y/\r\n//d;
+    return $rev;
+}
 
 #  Print some help text.
 sub print_help {
diff --git a/build/Makefile.in b/build/Makefile.in
index ebf1a82..901ce00 100644
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -333,7 +333,8 @@ help:
 	@echo "  help:              Print this help message."
 	@echo ""
 
-Makefile: build/Makefile.in
+Makefile: build/Makefile.in build/PARROT_REVISION
+	@$(PERL) Configure.pl --check-parrot-revision
 	@echo ""
 	@echo "warning: Makefile is out of date... re-run Configure.pl"
 	@echo ""
diff --git a/build/gen_parrot.pl b/build/gen_parrot.pl
index 23b548b..b356299 100644
--- a/build/gen_parrot.pl
+++ b/build/gen_parrot.pl
@@ -42,6 +42,9 @@ close $REQ;
     }
 }
 
+print "Cleaning up Rakudo...\n";
+system(qw(make clean));
+
 print "Checking out Parrot r$required via svn...\n";
 system(qw(svn checkout -r),  $required , qw(https://svn.parrot.org/parrot/trunk parrot));
 

@p6rt
Copy link
Author

p6rt commented Apr 22, 2009

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented May 9, 2009

From @pmichaud

Thanks for the patch. I ultimately decided to refactor things slightly
differently from the patch (although it did help me to crystallize
exactly where the problems were). In particular, I basically
reconfigured the build system so that the proper way to address a
dependency issue is to re-run Configure.pl. In particular​:

a. Configure.pl always checks for a parrot that is >= PARROT_REVISION.

b. Running Configure.pl performs a "make clean" (to remove any left-over
files from previous builds).

c. Any changes to the build environment issues a warning that the
Makefile is out of date and that Configure.pl needs to be re-run.

d. The "make parrot" target now simply calls Configure.pl with --gen-parrot.

This resolves the issue from the original post as follows​:

1. Configure.pl now dies with a helpful message if the version of Parrot
being used isn't >= PARROT_REVISION.

2. The Makefile is considered "out of date" if any of the build
components (including Parrot) are changed, and issues a warning to
re-run Configure.pl .

3. 'make parrot' now simply calls Configure.pl --gen-parrot, which will
update Parrot if necessary, regenerate the Makefile, and perform a 'make
clean' from any previous build.

4. The Makefile dependencies that would cause dynpmc.pl to be executed
even when not needed have been eliminated.

Closing ticket, if any further problems arise, feel free to reopen this
ticket or open a new one.

Thanks!

Pm

1 similar comment
@p6rt
Copy link
Author

p6rt commented May 9, 2009

From @pmichaud

Thanks for the patch. I ultimately decided to refactor things slightly
differently from the patch (although it did help me to crystallize
exactly where the problems were). In particular, I basically
reconfigured the build system so that the proper way to address a
dependency issue is to re-run Configure.pl. In particular​:

a. Configure.pl always checks for a parrot that is >= PARROT_REVISION.

b. Running Configure.pl performs a "make clean" (to remove any left-over
files from previous builds).

c. Any changes to the build environment issues a warning that the
Makefile is out of date and that Configure.pl needs to be re-run.

d. The "make parrot" target now simply calls Configure.pl with --gen-parrot.

This resolves the issue from the original post as follows​:

1. Configure.pl now dies with a helpful message if the version of Parrot
being used isn't >= PARROT_REVISION.

2. The Makefile is considered "out of date" if any of the build
components (including Parrot) are changed, and issues a warning to
re-run Configure.pl .

3. 'make parrot' now simply calls Configure.pl --gen-parrot, which will
update Parrot if necessary, regenerate the Makefile, and perform a 'make
clean' from any previous build.

4. The Makefile dependencies that would cause dynpmc.pl to be executed
even when not needed have been eliminated.

Closing ticket, if any further problems arise, feel free to reopen this
ticket or open a new one.

Thanks!

Pm

@p6rt
Copy link
Author

p6rt commented May 9, 2009

@pmichaud - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed May 9, 2009
@p6rt p6rt added the Todo label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant