Devel-PatchPerl-Plugin-Cygwin
view release on metacpan or search on metacpan
lib/Devel/PatchPerl/Plugin/Cygwin.pm view on Meta::CPAN
+ /* Check if arg is the current volume moint point if not default,
+ * and then use CW_GET_CYGDRIVE_INFO also.
+ */
+ if (!found) {
+ char user[PATH_MAX];
+ char system[PATH_MAX];
+ char user_flags[PATH_MAX];
+ char system_flags[PATH_MAX];
+
+ cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system,
+ user_flags, system_flags);
+
+ if (strlen(user) > 0) {
+ if (strcmp(user,pathname)) {
+ sprintf(flags, "%s,cygdrive,%s", user_flags, user);
+ found++;
+ }
+ } else {
+ if (strcmp(user,pathname)) {
+ sprintf(flags, "%s,cygdrive,%s", system_flags, system);
+ found++;
+ }
+ }
+ }
+ if (found) {
+ ST(0) = sv_2mortal(newSVpv(flags, 0));
+ XSRETURN(1);
+ } else {
+ XSRETURN_UNDEF;
+ }
}
}
@@ -351,6 +534,8 @@
XSRETURN(1);
}
+XS(XS_Cygwin_sync_winenv){ cygwin_internal(CW_SYNC_WINENV); }
+
void
init_os_extras(void)
{
@@ -366,6 +551,7 @@
newXSproto("Cygwin::mount_table", XS_Cygwin_mount_table, file, "");
newXSproto("Cygwin::mount_flags", XS_Cygwin_mount_flags, file, "$");
newXSproto("Cygwin::is_binmount", XS_Cygwin_is_binmount, file, "$");
+ newXS("Cygwin::sync_winenv", XS_Cygwin_sync_winenv, file);
/* Initialize Win32CORE if it has been statically linked. */
handle = dlopen(NULL, RTLD_LAZY);
END
}
sub _patch_cygwin_ld2
{
my @adjust = (
[ qr/^5\.8\.[0-7]$/, sub { $_[0] =~ s/ \|\| \$Is_VMS//; } ],
[ qr/^5\.8\.[0-5]$/, sub {
# cygwin/Makefile.SHs
$_[0] =~ s/\@\@ -22,73/@@ -22,72/;
$_[0] =~ s/-\t\@chmod a\+x ld2\n//;
} ],
[ qr/^5\.8\.[0-2]$/, sub {
# cygwin/Makefile.SHs
$_[0] =~ s/\@\@ -22,72/@@ -22,71/;
$_[0] =~ s/these ones are mandatory/this one is pretty mandatory/;
$_[0] =~ s/-VERSION = '\$version'\n//;
$_[0] =~ s/ -e s,\@VERSION\@,\\\$\{VERSION},g//;
} ],
[ qr/^5\.8\.0$/, sub {
# Makefile.SH
$_[0] =~ s/ pad\$\(OBJ_EXT\)//;
$_[0] =~ s/ opmini\.c//;
$_[0] =~ s/ \$\(obj\) \$\(libs\)/ \$(obj)/;
} ],
);
my $patch = <<'END'; $_->[1]->($patch) for grep { Devel::PatchPerl::_is( $_->[0], $_[0] ) } @adjust; Devel::PatchPerl::_patch($patch);
--- cygwin/Makefile.SHs.orig 2004-09-10 18:30:39.000000000 +0900
+++ cygwin/Makefile.SHs 2008-03-12 05:46:24.000000000 +0900
@@ -3,8 +3,8 @@
# Rerun `sh Makefile.SH; make depend' after making any change.
-# Additional rules supported: libperls.a (for static linking),
-# ld2, perlld (dynamic linking tools)
+# Additional rules supported: libperl.a (for static linking),
+# ld2 and perlld removed
#
#! /bin/sh
@@ -22,73 +22,33 @@
;;
esac
-addtopath=`pwd`
+addtopath=`pwd | sed -e 's/ /\\\ /g'`
$spitshell >>Makefile <<!GROK!THIS!
cygwin.c: cygwin/cygwin.c
\$(LNS) cygwin/cygwin.c
-# shell script feeding perlld to decent perl
-ld2: $& Makefile perlld ${src}/cygwin/ld2.in
- @echo "extracting ld2 (with variable substitutions)"
- @$sed s,@buildpath@,$addtopath,g <${src}/cygwin/ld2.in >ld2
- @chmod a+x ld2
- @echo "installing ld2 into $installbin"
-# install is included in Cygwin distributions, and we make a note of th
-# requirement in the README.cygwin file. However, let's give them
-# a warning.
- @/usr/bin/install -c -m 755 ld2 ${installbin}/ld2
- @if test ! -f ${installbin}/ld2; then \
- echo "*************************************************" ; \
- echo "Make will probably fail in a few more steps." ; \
- echo "When it does, copy \"ld2\" to a directory in" ; \
- echo "your path, other than \".\"." ; \
- echo "\"/usr/local/bin\" or something similar will do." ; \
- echo "Then restart make." ; \
- echo "*************************************************" ; \
- fi
-
-!GROK!THIS!
-
-$spitshell >>Makefile <<!GROK!THIS!
-
-# perlld parameters
-#
-# these ones are mandatory
-DLLWRAP = 'dllwrap'
-VERSION = '$version'
-
-# following are optional.
-WRAPDRIVER = gcc
-DLLTOOL = dlltool
-EXPORT_ALL = 1
-
-# if some of extensions are empty,
-# no corresponding output will be done.
-# most probably, you'd like to have an export library
-DEF_EXT = .def
-EXP_EXT = .exp
-
-perlld: $& Makefile ${src}/cygwin/perlld.in
- @echo "extracting perlld (with variable substitutions)"
- @$sed -e s,@CC@,\${CC}, -e s,@DLLWRAP@,\${DLLWRAP},g \\
- -e s,@WRAPDRIVER@,\${WRAPDRIVER},g -e s,@DLLTOOL@,\${DLLTOOL},g \\
- -e s,@AS@,\${AS},g -e s,@EXPORT_ALL@,\${EXPORT_ALL},g \\
- -e s,@DEF_EXT@,\${DEF_EXT},g -e s,@EXP_EXT@,\${EXP_EXT},g \\
- -e s,@LIB_EXT@,\${LIB_EXT},g -e s,@VERSION@,\${VERSION},g \\
- ${src}/cygwin/perlld.in >perlld
-
!GROK!THIS!
# make sure that all library names are not malformed
libperl=`echo $libperl|sed -e s,\\\..*,,`
-
linklibperl=-l`echo $libperl|sed -e s,^lib,,`
+vers=`echo $version|tr '.' '_'`
+dllname=`echo $libperl|sed -e s,^lib,cyg,``echo $vers|sed -e s,_[0-9]$,,`
+# append "d" suffix to -DDEBUGGING build: cygperl5_10d.dll
+case $config_args in
+ *DEBUGGING*)
+ dllname="${dllname}"d
+ ;;
+esac
lib/Devel/PatchPerl/Plugin/Cygwin.pm view on Meta::CPAN
true)
$spitshell >>Makefile <<'!NO!SUBS!'
- $(LD) -o $@ $(SHRPLDFLAGS) perl$(OBJ_EXT) $(obj) $(libs)
+ $(LD) -o $@ $(SHRPLDFLAGS) $(obj) $(libs)
!NO!SUBS!
case "$osname" in
aix)
@@ -565,7 +565,7 @@
*)
$spitshell >>Makefile <<'!NO!SUBS!'
rm -f $(LIBPERL)
- $(AR) rcu $(LIBPERL) perl$(OBJ_EXT) $(obj)
+ $(AR) rcu $(LIBPERL) $(obj)
@$(ranlib) $(LIBPERL)
!NO!SUBS!
;;
@@ -590,7 +590,7 @@
miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
$(CC) -o miniperl $(CLDFLAGS) \
`echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
- miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
+ miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
$(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
!NO!SUBS!
;;
@@ -598,7 +598,7 @@
$spitshell >>Makefile <<'!NO!SUBS!'
miniperl: $& miniperlmain$(OBJ_EXT) $(LIBPERL) opmini$(OBJ_EXT)
$(CC) -o miniperl `echo $(obj) | sed 's/ op$(OBJ_EXT) / /'` \
- miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) perl$(OBJ_EXT) $(libs)
+ miniperlmain$(OBJ_EXT) opmini$(OBJ_EXT) $(libs)
$(LDLIBPTH) ./miniperl -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
!NO!SUBS!
;;
END
if($_[0] =~ /^5\.8\.[1-8]$/) {
my @adjust = (
[ qr/^5\.8\.[1-7]/, sub { $_[0] =~ s/ \|\| \$Is_VMS//; } ],
[ qr/^5\.8\.[1-4]/, sub {
$_[0] =~ s/\@\@ -260,40/@@ -260,39/;
$_[0] =~ s/-\t\t\$packlist->.*\n//;
} ],
);
my $patch = <<'END'; $_->[1]->($patch) for grep { Devel::PatchPerl::_is( $_->[0], $_[0] ) } @adjust; Devel::PatchPerl::_patch($patch);
--- installperl.orig 2006-01-29 00:35:28.000000000 +0900
+++ installperl 2014-05-12 02:41:30.833722700 +0900
@@ -260,40 +260,9 @@
if ($Is_Cygwin) {
$perldll = $libperl;
- my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/;
+ my $v_e_r_s = substr($ver,0,-2); $v_e_r_s =~ tr/./_/;
$perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/;
$perldll =~ s/^lib/cyg/;
- if ($Config{useshrplib} eq 'true') {
- # install ld2 and perlld as well
- foreach ('ld2', 'perlld') {
- safe_unlink("$installbin/$_");
- copy("$_", "$installbin/$_");
- chmod(0755, "$installbin/$_");
- $packlist->{"$installbin/$_"} = { type => 'file' };
- };
- open (LD2, ">$installbin/ld2");
- print LD2 <<SHELL;
-#!/bin/sh
-#
-# ld wrapper, passes all args to perlld;
-#
-for trythis in $installbin/perl
-do
- if [ -x \$trythis ]
- then
- \$trythis $installbin/perlld "\$\@"
- exit \$?
- fi
-done
-# hard luck!
-echo I see no perl executable around there
-echo perl is required to build dynamic libraries
-echo look if the path to perl in /bin/ld2 is correct
-exit 1
-SHELL
- close LD2;
- chmod(0755, "$installbin/ld2");
- };
} else {
$perldll = 'perl58.' . $dlext;
}
@@ -376,6 +345,7 @@
# Install library files.
my ($do_installarchlib, $do_installprivlib) = (0, 0);
+my $vershort = $Is_Cygwin ? substr($ver,0,-2) : $ver;
mkpath($installprivlib, $verbose, 0777);
mkpath($installarchlib, $verbose, 0777);
@@ -385,7 +355,7 @@
if (chdir "lib") {
$do_installarchlib = ! samepath($installarchlib, '.');
$do_installprivlib = ! samepath($installprivlib, '.');
- $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$ver/);
+ $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
if ($do_installarchlib || $do_installprivlib) {
find(\&installlib, '.');
@@ -589,7 +559,7 @@
# ($installprivlib/pods for cygwin).
my $pod = ($Is_Cygwin || $Is_Darwin || $Is_VMS) ? 'pods' : 'pod';
-if ( !$versiononly || ($installprivlib =~ m/\Q$ver/)) {
+if ( !$versiononly || ($installprivlib =~ m/\Q$vershort/)) {
mkpath("${installprivlib}/$pod", $verbose, 0777);
# If Perl 5.003's perldiag.pod is there, rename it.
END
} else {
Devel::PatchPerl::_patch(<<'END');
--- installperl.orig 2002-07-17 03:57:32.000000000 +0900
+++ installperl 2014-05-12 11:10:17.032674700 +0900
@@ -234,29 +234,9 @@
if ($Is_Cygwin) {
$perldll = $libperl;
- my $v_e_r_s = $ver; $v_e_r_s =~ tr/./_/;
+ my $v_e_r_s = substr($ver,0,-2); $v_e_r_s =~ tr/./_/;
$perldll =~ s/(\..*)?$/$v_e_r_s.$dlext/;
$perldll =~ s/^lib/cyg/;
- if ($Config{useshrplib} eq 'true') {
- # install ld2 and perlld as well
- foreach ('ld2', 'perlld') {
- safe_unlink("$installbin/$_");
- copy("$_", "$installbin/$_");
- chmod(0755, "$installbin/$_");
- };
- {
- open (LD2, ">$installbin/ld2");
- print LD2 "#!/bin/sh\n#\n# ld wrapper, passes all args to perlld;\n#\n"
- . "for trythis in $installbin/perl\ndo\n if [ -x \$trythis ]\n"
- . " then\n \$trythis $installbin/perlld \"\$\@\"\n"
- . " exit \$?\n fi\ndone\n# hard luck!\necho i see no perl"
- . " executable around there\necho perl is required to build "
- . "dynamic libraries\necho look if the path to perl in /bin/ld2"
- . " is correct\nexit 1\n";
- close LD2;
- };
- chmod(0755, "$installbin/ld2");
- };
} else {
$perldll = 'perl58.' . $dlext;
}
@@ -331,6 +311,7 @@
# Install library files.
my ($do_installarchlib, $do_installprivlib) = (0, 0);
+my $vershort = $Is_Cygwin ? substr($ver,0,-2) : $ver;
mkpath($installprivlib, $verbose, 0777);
mkpath($installarchlib, $verbose, 0777);
@@ -340,7 +321,7 @@
if (chdir "lib") {
$do_installarchlib = ! samepath($installarchlib, '.');
$do_installprivlib = ! samepath($installprivlib, '.');
- $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$ver/);
+ $do_installprivlib = 0 if $versiononly && !($installprivlib =~ m/\Q$vershort/);
if ($do_installarchlib || $do_installprivlib) {
find(\&installlib, '.');
END
}
}
sub _patch_cygwin_GNU_SOURCE
{
# Override Devel::PatchPerl::Hints until it is fixed
Devel::PatchPerl::_patch(<<'END') if Devel::PatchPerl::Hints->hint_file("cygwin") =~ /ccflags="\$ccflags -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__"/;
--- hints/cygwin.sh.orig 2018-05-16 17:14:35.085980800 +0900
+++ hints/cygwin.sh 2018-05-16 18:32:34.356348000 +0900
@@ -31,7 +31,7 @@
man3ext='3pm'
test -z "$use64bitint" && use64bitint='define'
test -z "$useithreads" && useithreads='define'
-ccflags="$ccflags -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__"
+ccflags="$ccflags -DPERL_USE_SAFE_PUTENV -U__STRICT_ANSI__ -D_GNU_SOURCE"
# - otherwise i686-cygwin
archname='cygwin'
END
}
sub _patch_cygwin_PATH_quote
{
my @adjust = (
[ [
qr/^5\.8\.[0-9]$/,
qr/^5\.10\.[01]$/,
], sub {
$_[0] =~ s|\@\@ -1,3 \+1,12 @@|@@ -1,4 +1,13 @@\n #! /bin/sh|;
} ],
);
my $patch = <<'END'; $_->[1]->($patch) for grep { Devel::PatchPerl::_is( $_->[0], $_[0] ) } @adjust; Devel::PatchPerl::_patch($patch);
--- Makefile.SH.orig 2013-03-05 00:16:21.000000000 +0900
+++ Makefile.SH 2018-05-17 14:35:26.914781400 +0900
@@ -1,3 +1,12 @@
+# quote() - Creates a shell literal
+# Usage: echo "...` quote "..." `..."
+quote() {
( run in 1.350 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )