[svn:parrot] r43369 - in branches/one_make: . config/gen config/gen/makefiles tools/build
coke at svn.parrot.org
coke at svn.parrot.org
Sat Jan 2 07:16:48 UTC 2010
Author: coke
Date: Sat Jan 2 07:16:47 2010
New Revision: 43369
URL: https://trac.parrot.org/parrot/changeset/43369
Log:
Convert dynoplibs.pl from config-generated into standalone, using Parrot::Config
Added:
branches/one_make/tools/build/dynoplibs.pl
Deleted:
branches/one_make/config/gen/makefiles/dynoplibs_pl.in
Modified:
branches/one_make/MANIFEST
branches/one_make/MANIFEST.SKIP
branches/one_make/config/gen/makefiles.pm
branches/one_make/config/gen/makefiles/root.in
branches/one_make/tools/build/ (props changed)
Modified: branches/one_make/MANIFEST
==============================================================================
--- branches/one_make/MANIFEST Sat Jan 2 06:53:39 2010 (r43368)
+++ branches/one_make/MANIFEST Sat Jan 2 07:16:47 2010 (r43369)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Fri Jan 1 02:48:55 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jan 2 07:12:12 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -328,7 +328,6 @@
config/gen/makefiles/CFLAGS.in []
config/gen/makefiles/docs.in []
config/gen/makefiles/dynoplibs.in []
-config/gen/makefiles/dynoplibs_pl.in []
config/gen/makefiles/dynpmc.in []
config/gen/makefiles/editor.in []
config/gen/makefiles/ext.in []
@@ -2142,6 +2141,7 @@
t/tools/testdata [test]
tools/build/addopstags.pl []
tools/build/c2str.pl []
+tools/build/dynoplibs.pl []
tools/build/dynpmc.pl []
tools/build/fixup_gen_file.pl []
tools/build/headerizer.pl []
Modified: branches/one_make/MANIFEST.SKIP
==============================================================================
--- branches/one_make/MANIFEST.SKIP Sat Jan 2 06:53:39 2010 (r43368)
+++ branches/one_make/MANIFEST.SKIP Sat Jan 2 07:16:47 2010 (r43369)
@@ -1,6 +1,6 @@
# ex: set ro:
# $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Thu Dec 31 18:57:26 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Jan 2 07:12:12 2010 UT
#
# This file should contain a transcript of the svn:ignore properties
# of the directories in the Parrot subversion repository. (Needed for
@@ -1043,9 +1043,6 @@
^t/tools/pmc2c\..*\.h/
^t/tools/pmc2c\..*\.pmc$
^t/tools/pmc2c\..*\.pmc/
-# generated from svn:ignore of 'tools/build/'
-^tools/build/dynoplibs\.pl$
-^tools/build/dynoplibs\.pl/
# Local variables:
# mode: text
# buffer-read-only: t
Modified: branches/one_make/config/gen/makefiles.pm
==============================================================================
--- branches/one_make/config/gen/makefiles.pm Sat Jan 2 06:53:39 2010 (r43368)
+++ branches/one_make/config/gen/makefiles.pm Sat Jan 2 07:16:47 2010 (r43369)
@@ -47,11 +47,6 @@
'editor/Makefile' =>
{ SOURCE => 'config/gen/makefiles/editor.in' },
- 'tools/build/dynoplibs.pl' => {
- SOURCE => 'config/gen/makefiles/dynoplibs_pl.in',
- replace_slashes => 0,
- conditioned_lines => 1,
- },
'parrot.pc' => { SOURCE => 'config/gen/makefiles/parrot_pc.in' },
'docs/Makefile' => { SOURCE => 'config/gen/makefiles/docs.in' },
};
Deleted: branches/one_make/config/gen/makefiles/dynoplibs_pl.in
==============================================================================
--- branches/one_make/config/gen/makefiles/dynoplibs_pl.in Sat Jan 2 07:16:47 2010 (r43368)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,216 +0,0 @@
-# Copyright (C) 2001-2007, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-tools/build/dynoplibs.pl - Build script for dynamic op libraries
-
-=head1 DESCRIPTION
-
-This file is generated by F<config/gen/makefiles.pm> from
-F<config/gen/makefiles/dynopslibs_pl.in>. This script is used for building
-dynamic op libraries.
-
-=cut
-
-use strict;
-use warnings;
-
-use File::Copy qw(copy);
-
-# qq[] isn't guaranteed to work, but it's safer than "" as some platforms
-# (eg FreeBSD) have ""s embedded in their substution values. q[] is used in
-# some places as Win32 paths have \'s in, which qq[] treats as escape sequences.
-# Config stuff
-our $CC = q[@cc@ -c];
-our $LD = q[@ld@];
-our $LDFLAGS = q[@ldflags@ @ld_debug@ @rpath_blib@ @linkflags@];
-our $LD_LOAD_FLAGS = q[@ld_load_flags@];
-our $PERL = q[@perl@];
-our $LOAD_EXT = q[@load_ext@];
-our $O = q[@o@];
-our $CFLAGS = q[@ccflags@ @cc_shared@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@];
-
-our $LIBPARROT = q[];
-#IF(parrot_is_shared):$LIBPARROT = q[@libparrot_ldflags@];
-
-# Here comes some stuff for Win32.
-our $PATHQUOTE = $^O eq 'MSWin32' ? q["] : q[];
-
-# OPS2C Config
-our $OPS2C = "$PERL -I $PATHQUOTE" .
- q[@build_dir@@slash at lib] .
- "$PATHQUOTE $PATHQUOTE" .
- q[@build_dir@@slash at tools@slash at build@slash at ops2c.pl] .
- $PATHQUOTE;
-our %cores = (
- C => q[],
-#IF(cg_flag): CGP => '_cgp',
-#IF(cg_flag): CGoto => '_cg',
- CSwitch => '_switch'
-);
-
-# Actual commands
-sub compile_cmd {
- my ($target, $source) = @_;
-
- return
- "$CC " .
- "@cc_o_out@" . $target . " " .
- "-I" . $PATHQUOTE . '@build_dir@@slash at include' . $PATHQUOTE . " " .
- "-I" . $PATHQUOTE . '@build_dir@@slash at src@slash at pmc' . $PATHQUOTE . " " .
- "$CFLAGS " .
- $source;
-};
-
-sub partial_link_cmd {
- my ($target, $libs, $sources) = @_;
-
- my $liblist;
- if ($^O =~ /mswin32/i) {
- # Need to put various libraries in the link line.
- $liblist = join( ' ', map { "$_.lib" } keys %$libs );
- my $extraLibs = '@libs@ @icu_shared@';
- $extraLibs =~ s/blib/..\\blib/g;
- $extraLibs =~ s/\Q$(A)\E/.lib/g;
- $liblist .= ' ' . $extraLibs;
- }
- else {
- $liblist = join( ' ', map { "-l$_" } keys %$libs );
- }
-
- return
- "$LD ".
- "@ld_out@" . $target . " " .
- join(" ", map {"$PATHQUOTE$_$PATHQUOTE"} @$sources) .
- " $liblist $LDFLAGS $LD_LOAD_FLAGS $LIBPARROT";
-}
-
-our $NOW = time();
-
-################### MAIN PROGRAM ################
-
-my ($mode, @oplibs) = @ARGV;
-
-if ($mode eq 'generate') {
- # Convert X.ops -> ops_X.c, ops_X_cgp.c, ops_X_cg.c and ops_X_switch.c
- my $core;
- generate_c($_) foreach (@oplibs);
-}
-elsif ($mode eq 'compile') {
- # Convert X.c -> X.o for all X.c
- my $core_suffix;
- foreach $core_suffix (values %cores) {
- compile($_ . "_ops$core_suffix") foreach (@oplibs);
- }
-}
-elsif ($mode eq 'linklibs') {
- my @objs = grep { /$O$/} @oplibs;
- @oplibs = grep {!/$O$/} @oplibs;
-
- # Convert X.o -> X.so
- my $core_suffix;
- foreach $core_suffix (values %cores) {
- partial_link({}, $_ . "_ops$core_suffix", @objs) foreach (@oplibs);
- }
-}
-elsif ($mode eq 'copy') {
- # Copy *.so -> destination, where destination is the first
- # argument, given as --destination=DIRECTORY
- shift(@oplibs) =~ /--destination=(.*)/
- or die "copy command requires destination";
- my $dest = $1;
-
- my $core_suffix;
- foreach $core_suffix (values %cores) {
- foreach (@oplibs) {
- my $src = $_ . "_ops$core_suffix$LOAD_EXT";
- copy($src, $dest)
- or die "Copy $src failed ($?)\n";
-
- # Execute permissions on libraries is especially important on
- # some platforms
- if ($^O eq 'hpux' or $^O eq 'cygwin') {
- chmod 0755, "$dest at slash@$src";
- }
- }
- }
-}
-else {
- die "invalid command '$mode'\nmust be one of generate, compile, linklibs, or copy\n";
-}
-
-sub run {
- print join(" ", @_), "\n";
-
- return system(@_) == 0;
-}
-
-sub modtime {
- my $ago = (-M shift);
-
- if (defined $ago) {
- return $NOW - $ago;
- }
- else {
- return;
- }
-}
-
-sub needs_build {
- my ($target, @sources) = @_;
-
- my $target_mod = modtime($target)
- or return 1;
- for my $source (@sources) {
- return 1 if modtime($source) > $target_mod;
- }
-
- return 0;
-}
-
-sub generate_c {
- my ($oplib) = @_;
-
- foreach (keys %cores) {
- if (needs_build($oplib . "_ops$cores{$_}.c", "$oplib.ops")) {
- run("$OPS2C $_ --dynamic $oplib.ops")
- or die "ops2c code generation failed ($?)\n";
- }
- }
-
- return;
-}
-
-sub compile {
- my ($src_stem, $dest_stem) = @_;
-
- $dest_stem ||= $src_stem;
- if (needs_build("$dest_stem$O", "$src_stem.c")) {
- return run(compile_cmd("$dest_stem$O", "$src_stem.c"))
- or die "compile $src_stem.c failed ($?)\n";
- }
- else {
- return 1;
- }
-}
-
-sub partial_link {
- my ($libs, $stem, @objs) = @_;
-
- if (needs_build("$stem$LOAD_EXT", "$stem$O", @objs)) {
- return run(partial_link_cmd("$stem$LOAD_EXT", $libs, [ "$stem$O", @objs ]))
- or die "partial link $stem$LOAD_EXT failed ($?)\n";
- }
- else {
- return 1;
- }
-}
-
-
-# Local Variables:
-# mode: cperl
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4:
Modified: branches/one_make/config/gen/makefiles/root.in
==============================================================================
--- branches/one_make/config/gen/makefiles/root.in Sat Jan 2 06:53:39 2010 (r43368)
+++ branches/one_make/config/gen/makefiles/root.in Sat Jan 2 07:16:47 2010 (r43369)
@@ -177,7 +177,6 @@
CFLAGS \
compilers/imcc/CFLAGS \
config_lib.pasm \
- $(BUILD_TOOLS_DIR)/dynoplibs.pl \
parrot.pc \
compilers/imcc/imcc.y.flag \
src/ops/core_ops.c \
@@ -601,7 +600,7 @@
$(LIBNCI_TEST_SO) \
$(GEN_LIBRARY) \
dynpmc \
- dynoplibs \
+ dynoplibs
$(GEN_LIBRARY) : $(PARROT)
Added: branches/one_make/tools/build/dynoplibs.pl
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/one_make/tools/build/dynoplibs.pl Sat Jan 2 07:16:47 2010 (r43369)
@@ -0,0 +1,210 @@
+# Copyright (C) 2001-2009, Parrot Foundation.
+# $Id $
+
+=head1 NAME
+
+tools/build/dynoplibs.pl - Build script for dynamic op libraries
+
+=head1 DESCRIPTION
+
+This script is used for building dynamic op libraries.
+
+=cut
+
+use strict;
+use warnings;
+
+use lib qw(lib);
+
+use File::Copy qw(copy);
+use Parrot::Config qw(%PConfig);
+
+our $LDFLAGS = join(' ', map {$PConfig{$_}} qw/ldflags ld_debug rpath_blib linkflags/);
+our $LD_LOAD_FLAGS = $PConfig{ld_load_flags};
+our $LOAD_EXT = $PConfig{load_ext};
+our $O = $PConfig{o};
+our $CFLAGS = join(' ', map {$PConfig{$_}} qw/ccflags cc_shared cc_debug ccwarn cc_hasjit cg_flag gc_flag/);
+our $SLASH = $PConfig{slash};
+
+our $LIBPARROT = q[];
+if ($PConfig{parrot_is_shared}) {
+ $LIBPARROT = $PConfig{libparrot_ldflags};
+}
+
+# OPS2C Config
+our $OPS2C = "$^X -I \"" .
+ $PConfig{build_dir} . $SLASH . 'lib" "' .
+ $PConfig{build_dir} . $SLASH . 'tools' . $SLASH . 'build' .
+ $SLASH . 'ops2c.pl"';
+our %cores = (
+ C => '',
+ CSwitch => '_switch'
+);
+
+if ($PConfig{cg_flag}) {
+ $cores{CGP} = '_cgp';
+ $cores{CGoto} = '_cg';
+}
+
+# Actual commands
+sub compile_cmd {
+ my ($target, $source) = @_;
+
+ return
+ $PConfig{cc} . ' -c ' .
+ $PConfig{cc_o_out} . $target . ' ' .
+ '-I"' . $PConfig{build_dir} . $SLASH . $PConfig{include} . '" ' .
+ "$CFLAGS $source";
+};
+
+sub partial_link_cmd {
+ my ($target, $libs, $sources) = @_;
+
+ my $liblist;
+ if ($^O =~ /mswin32/i) {
+ # Need to put various libraries in the link line.
+ $liblist = join( ' ', map { "$_.lib" } keys %$libs );
+ my $extraLibs = $PConfig{libs} . ' ' . $PConfig{icu_shared};
+ $extraLibs =~ s/blib/..\\blib/g;
+ $extraLibs =~ s/\Q$(A)\E/.lib/g;
+ $liblist .= ' ' . $extraLibs;
+ }
+ else {
+ $liblist = join( ' ', map { "-l$_" } keys %$libs );
+ }
+
+ return
+ $PConfig{ld} . ' ' . $PConfig{ld_out} .
+ $target . ' ' .
+ join(' ', map {"\"$_\""} @$sources) .
+ " $liblist $LDFLAGS $LD_LOAD_FLAGS $LIBPARROT";
+}
+
+our $NOW = time();
+
+################### MAIN PROGRAM ################
+
+my ($mode, @oplibs) = @ARGV;
+
+if ($mode eq 'generate') {
+ # Convert X.ops -> ops_X.c, ops_X_cgp.c, ops_X_cg.c and ops_X_switch.c
+ my $core;
+ generate_c($_) foreach (@oplibs);
+}
+elsif ($mode eq 'compile') {
+ # Convert X.c -> X.o for all X.c
+ my $core_suffix;
+ foreach $core_suffix (values %cores) {
+ compile($_ . "_ops$core_suffix") foreach (@oplibs);
+ }
+}
+elsif ($mode eq 'linklibs') {
+ my @objs = grep { /$O$/} @oplibs;
+ @oplibs = grep {!/$O$/} @oplibs;
+
+ # Convert X.o -> X.so
+ my $core_suffix;
+ foreach $core_suffix (values %cores) {
+ partial_link({}, $_ . "_ops$core_suffix", @objs) foreach (@oplibs);
+ }
+}
+elsif ($mode eq 'copy') {
+ # Copy *.so -> destination, where destination is the first
+ # argument, given as --destination=DIRECTORY
+ shift(@oplibs) =~ /--destination=(.*)/
+ or die "copy command requires destination";
+ my $dest = $1;
+
+ my $core_suffix;
+ foreach $core_suffix (values %cores) {
+ foreach (@oplibs) {
+ my $src = $_ . "_ops$core_suffix$LOAD_EXT";
+ copy($src, $dest)
+ or die "Copy $src failed ($?)\n";
+
+ # Execute permissions on libraries is especially important on
+ # some platforms
+ if ($^O eq 'hpux' or $^O eq 'cygwin') {
+ chmod 0755, "$dest$SLASH$src";
+ }
+ }
+ }
+}
+else {
+ die "invalid command '$mode'\nmust be one of generate, compile, linklibs, or copy\n";
+}
+
+sub run {
+ print join(" ", @_), "\n";
+
+ return system(@_) == 0;
+}
+
+sub modtime {
+ my $ago = (-M shift);
+
+ if (defined $ago) {
+ return $NOW - $ago;
+ }
+ else {
+ return;
+ }
+}
+
+sub needs_build {
+ my ($target, @sources) = @_;
+
+ my $target_mod = modtime($target)
+ or return 1;
+ for my $source (@sources) {
+ return 1 if modtime($source) > $target_mod;
+ }
+
+ return 0;
+}
+
+sub generate_c {
+ my ($oplib) = @_;
+
+ foreach (keys %cores) {
+ if (needs_build($oplib . "_ops$cores{$_}.c", "$oplib.ops")) {
+ run("$OPS2C $_ --dynamic $oplib.ops")
+ or die "ops2c code generation failed ($?)\n";
+ }
+ }
+
+ return;
+}
+
+sub compile {
+ my ($src_stem, $dest_stem) = @_;
+
+ $dest_stem ||= $src_stem;
+ if (needs_build("$dest_stem$O", "$src_stem.c")) {
+ return run(compile_cmd("$dest_stem$O", "$src_stem.c"))
+ or die "compile $src_stem.c failed ($?)\n";
+ }
+ else {
+ return 1;
+ }
+}
+
+sub partial_link {
+ my ($libs, $stem, @objs) = @_;
+
+ if (needs_build("$stem$LOAD_EXT", "$stem$O", @objs)) {
+ return run(partial_link_cmd("$stem$LOAD_EXT", $libs, [ "$stem$O", @objs ]))
+ or die "partial link $stem$LOAD_EXT failed ($?)\n";
+ }
+ else {
+ return 1;
+ }
+}
+
+
+# Local Variables:
+# mode: cperl
+# cperl-indent-level: 4
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4:
More information about the parrot-commits
mailing list