cvsuser 04/10/12 02:00:30
Modified: config/auto gmp.pl
config/gen/makefiles dynclasses.in root.in
config/gen/platform/darwin dl.c
config/init/hints darwin.pl
t/library parrotlib.t
t/pmc nci.t
Log:
[perl #31927] [PATCH] share v. load tweaks for Makefile, etc.
Here is a patch with a few more fixes w.r.t. shared libs v. runtime
loadable libs, mostly for the benefit of Mac OS X, plus a few
miscellaneous related fixes.
config/auto/gmp.pl:
add /sw/lib to ldflags if gmp is from Fink, so that 'make shared'
works in that case
config/gen/makefiles/dynclasses.in:
remove .o files upon 'make clean'
config/gen/makefiles/root.in:
give LIBNCI_SO the LOAD_EXT instead of the SHARE_EXT
get TEST_PROG_SO to like the shared libparrot
have 'make clean' also do 'make clean' in dynclasses
use LD_LOAD_FLAGS for LIBNCI_SO
config/init/hints/darwin.pl:
set ${load_ext} to ".bundle" rather than ".so" on Mac OS X
set ${ld} to "c++" so that shared libparrot will link on Mac OS X
(since ICU has C++ inside)
t/library/parrotlib.t:
use $PConfig{load_ext} rather than $PConfig{share_ext} for libnci
t/pmc/nci.t:
use $PConfig{load_ext} rather than $PConfig{share_ext} for libnci
[perl #31928] [PATCH] fix warning in config/gen/platform/darwin/dl.c
This patch makes scan_paths() copy the passed-in string, since strsep
will modify it and ultimately this (seemingly) would chew up a couple
of environment variables; this also gets rid of a compiler warning
about casting away the constness of libpath, which we shouldn't have
been doing (since in fact it was being modified).
Courtesy of Jeff Clites <[EMAIL PROTECTED]>
Revision Changes Path
1.3 +2 -1 parrot/config/auto/gmp.pl
Index: gmp.pl
===================================================================
RCS file: /cvs/public/parrot/config/auto/gmp.pl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- gmp.pl 8 Jul 2004 06:00:50 -0000 1.2
+++ gmp.pl 12 Oct 2004 09:00:15 -0000 1.3
@@ -1,5 +1,5 @@
# Copyright: 2001-2004 The Perl Foundation. All Rights Reserved.
-# $Id: gmp.pl,v 1.2 2004/07/08 06:00:50 leo Exp $
+# $Id: gmp.pl,v 1.3 2004/10/12 09:00:15 leo Exp $
=head1 NAME
@@ -41,6 +41,7 @@
if($osname =~ /darwin/) {
if( -f "/sw/include/gmp.h") {
Configure::Data->add(' ', 'linkflags', '-L/sw/lib');
+ Configure::Data->add(' ', 'ldflags', '-L/sw/lib');
Configure::Data->add(' ', 'ccflags', '-I/sw/include');
}
}
1.8 +2 -1 parrot/config/gen/makefiles/dynclasses.in
Index: dynclasses.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/dynclasses.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -r1.7 -r1.8
--- dynclasses.in 8 Oct 2004 07:08:31 -0000 1.7
+++ dynclasses.in 12 Oct 2004 09:00:16 -0000 1.8
@@ -2,6 +2,7 @@
RM_F = ${rm_f}
LOAD_EXT = ${load_ext}
DESTDIR = ${build_dir}${slash}runtime${slash}parrot${slash}dynext
+O = ${o}
# add your dynamic pmcs here
@@ -19,7 +20,7 @@
$(BUILD) copy --destination=$(DESTDIR) $(PMCS)
clean :
- $(RM_F) *.c *.h *$(LOAD_EXT) *.dump lib-*
+ $(RM_F) *.c *.h *$(LOAD_EXT) *.dump lib-* *$(O)
realclean: clean
$(RM_F) Makefile build.pl
1.254 +5 -4 parrot/config/gen/makefiles/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles/root.in,v
retrieving revision 1.253
retrieving revision 1.254
diff -u -w -r1.253 -r1.254
--- root.in 12 Oct 2004 08:12:29 -0000 1.253
+++ root.in 12 Oct 2004 09:00:16 -0000 1.254
@@ -1,4 +1,4 @@
-# $Id: root.in,v 1.253 2004/10/12 08:12:29 leo Exp $
+# $Id: root.in,v 1.254 2004/10/12 09:00:16 leo Exp $
###############################################################################
#
@@ -431,7 +431,7 @@
# dynamic extensions
DYNEXT_DIR = runtime/parrot/dynext
-LIBNCI_SO = $(DYNEXT_DIR)/libnci$(SHARE_EXT)
+LIBNCI_SO = $(DYNEXT_DIR)/libnci$(LOAD_EXT)
###############################################################################
#
@@ -631,7 +631,7 @@
$(LD) $(LD_SHARE_FLAGS) $(LDFLAGS) $(LD_OUT)blib/lib/libparrot$(SHARE_EXT)
$(O_FILES) $(C_LIBS) $(LIBICUCORE) $(LIBICUDATA)
$(TEST_PROG_SO) : $(PARROT_MAIN)$(O) blib/lib/libparrot$(SHARE_EXT)
lib/Parrot/OpLib/core.pm
- $(LINK) $(LINKFLAGS) $(LD_OUT)$(TEST_PROG) $(PARROT_MAIN)$(O) $(LIBPARROT)
$(C_LIBS)
+ $(LINK) $(LINKFLAGS) $(LD_OUT)$(TEST_PROG) $(PARROT_MAIN)$(O) -Lblib/lib
-lparrot $(C_LIBS)
#
# Parrot Debugger
@@ -1110,6 +1110,7 @@
examples/assembly/mops${exe} examples/assembly/mops.c \
examples/assembly/mops$(O) examples/assembly/mops.pbc \
examples/mops/mops$(O) examples/mops/mops${exe}
+ $(MAKE_C) dynclasses clean
progclean :
$(RM_F) $(O_FILES) \
@@ -1261,7 +1262,7 @@
# libnci.so used by t/pmc/nci.t
$(LIBNCI_SO): $(SRC)/nci_test$(O)
- $(LD) $(LD_SHARE_FLAGS) ${ncilib_link_extra} $(LDFLAGS) \
+ $(LD) $(LD_LOAD_FLAGS) ${ncilib_link_extra} $(LDFLAGS) \
$(LD_OUT)$@ $(SRC)/nci_test$(O)
# vim ctags
1.5 +24 -17 parrot/config/gen/platform/darwin/dl.c
Index: dl.c
===================================================================
RCS file: /cvs/public/parrot/config/gen/platform/darwin/dl.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- dl.c 31 Aug 2004 16:54:22 -0000 1.4
+++ dl.c 12 Oct 2004 09:00:21 -0000 1.5
@@ -12,25 +12,32 @@
*/
/* Simple routine to walk a colon separated list of directories in a string
- and check for a file in each one, returning the first match. */
+ and check for a file in each one, returning the first match.
+ Note that this returns a static buffer, and so is not thread-safe. */
static const char *
scan_paths(const char *filename, const char *libpath)
{
static char buf[PATH_MAX];
struct stat st;
+ char *path_list;
const char *path;
if(!libpath)
return NULL;
- path = strsep((char**)&libpath, ":");
+ path_list = strdup(libpath);
+
+ path = strsep(&path_list, ":");
while(path) {
snprintf(buf, PATH_MAX, "%s/%s", path, filename);
- if(stat(buf, &st) == 0)
+ if(stat(buf, &st) == 0) {
+ free(path_list);
return buf;
- path = strsep((char**)&libpath, ":");
}
+ path = strsep(&path_list, ":");
+ }
+ free(path_list);
return NULL;
}
1.14 +2 -1 parrot/config/init/hints/darwin.pl
Index: darwin.pl
===================================================================
RCS file: /cvs/public/parrot/config/init/hints/darwin.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -r1.13 -r1.14
--- darwin.pl 8 Oct 2004 13:24:35 -0000 1.13
+++ darwin.pl 12 Oct 2004 09:00:23 -0000 1.14
@@ -20,8 +20,9 @@
ccwarn => "-Wno-shadow",
libs => $libs,
share_ext => '.dylib',
- load_ext => '.so',
+ load_ext => '.bundle',
link => 'c++',
+ ld => 'c++',
ld_share_flags => '-dynamiclib',
ld_load_flags => '-bundle -undefined suppress',
);
1.6 +4 -4 parrot/t/library/parrotlib.t
Index: parrotlib.t
===================================================================
RCS file: /cvs/public/parrot/t/library/parrotlib.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -w -r1.5 -r1.6
--- parrotlib.t 8 Oct 2004 13:24:37 -0000 1.5
+++ parrotlib.t 12 Oct 2004 09:00:24 -0000 1.6
@@ -1,5 +1,5 @@
# Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.
-# $Id: parrotlib.t,v 1.5 2004/10/08 13:24:37 leo Exp $
+# $Id: parrotlib.t,v 1.6 2004/10/12 09:00:24 leo Exp $
=head1 NAME
@@ -89,16 +89,16 @@
output_is( << "END_CODE", << "END_OUT", 'dynext_location' );
$template_top
location_sub = find_global "_parrotlib", "dynext_location"
- location = location_sub( 'libnci', '$PConfig{share_ext}' )
+ location = location_sub( 'libnci', '$PConfig{load_ext}' )
$template_bottom
END_CODE
-runtime/parrot/dynext/libnci$PConfig{share_ext}
+runtime/parrot/dynext/libnci$PConfig{load_ext}
END_OUT
output_is( << "END_CODE", << 'END_OUT', 'dynext_location, non-existent' );
$template_top
location_sub = find_global "_parrotlib", "imcc_compile_file_location"
- location = location_sub( 'nonexistent', '$PConfig{share_ext}' )
+ location = location_sub( 'nonexistent', '$PConfig{load_ext}' )
$template_bottom
END_CODE
1.55 +4 -4 parrot/t/pmc/nci.t
Index: nci.t
===================================================================
RCS file: /cvs/public/parrot/t/pmc/nci.t,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -w -r1.54 -r1.55
--- nci.t 8 Oct 2004 10:21:29 -0000 1.54
+++ nci.t 12 Oct 2004 09:00:26 -0000 1.55
@@ -1,7 +1,7 @@
#! perl -w
# Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
-# $Id: nci.t,v 1.54 2004/10/08 10:21:29 leo Exp $
+# $Id: nci.t,v 1.55 2004/10/12 09:00:26 leo Exp $
=head1 NAME
@@ -28,8 +28,8 @@
use Parrot::Config;
SKIP: {
-unless ( -e "runtime/parrot/dynext/libnci" . $PConfig{share_ext} ) {
- skip( "Please make libnci$PConfig{share_ext}",
+unless ( -e "runtime/parrot/dynext/libnci" . $PConfig{load_ext} ) {
+ skip( "Please make libnci$PConfig{load_ext}",
Test::Builder->expected_tests() );
}
@@ -110,7 +110,7 @@
print "\n"
.end
CODE
-libnci$PConfig{share_ext} was successfully loaded
+libnci$PConfig{load_ext} was successfully loaded
OUTPUT