Skip to content

Instantly share code, notes, and snippets.

@dex4er
Last active January 2, 2016 18:19
Show Gist options
  • Save dex4er/8342867 to your computer and use it in GitHub Desktop.
Save dex4er/8342867 to your computer and use it in GitHub Desktop.
Perl on Android
diff --git a/dist/Cwd/Cwd.pm b/dist/Cwd/Cwd.pm
index 8886c67..cf64dbe 100644
--- a/dist/Cwd/Cwd.pm
+++ b/dist/Cwd/Cwd.pm
@@ -370,7 +370,9 @@ sub _backtick_pwd {
# Since some ports may predefine cwd internally (e.g., NT)
# we take care not to override an existing definition for cwd().
-unless ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
+unless ($METHOD_MAP{$^O}{cwd} or (defined &cwd && &cwd ne '')) {
+ *cwd = \&getcwd;
+} elsif ($METHOD_MAP{$^O}{cwd} or defined &cwd) {
# The pwd command is not available in some chroot(2)'ed environments
my $sep = $Config::Config{path_sep} || ':';
my $os = $^O; # Protect $^O from tainting
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index b707911..c16513a 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -138,7 +138,9 @@ sub get_files {
) {
# Some Linuxes have weird errno.hs which generate
# no #file or #line directives
- my $linux_errno_h = -e '/usr/include/errno.h' ?
+ my $usrinc = $Config{usrinc};
+ my $linux_errno_h = -e "$usrinc/errno.h" ?
+ "$usrinc/errno.h" : -e '/usr/include/errno.h' ?
'/usr/include/errno.h' : '/usr/local/include/errno.h';
$file{$linux_errno_h} = 1;
} elsif ($^O eq 'haiku') {
diff --git a/pp_sys.c b/pp_sys.c
index 04ccddb..10addb9 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3889,7 +3889,7 @@ nope:
PP(pp_telldir)
{
-#if defined(HAS_TELLDIR) || defined(telldir)
+#if defined(HAS_TELLDIR) && defined(telldir)
dVAR; dSP; dTARGET;
/* XXX does _anyone_ need this? --AD 2/20/1998 */
/* XXX netbsd still seemed to.
diff --git a/sv.c b/sv.c
index 5f3fad3..9e29f0b 100644
--- a/sv.c
+++ b/sv.c
@@ -11583,7 +11583,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
{
DIR *ret;
-#ifdef HAS_FCHDIR
+#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR)
DIR *pwd;
const Direntry_t *dirent;
char smallbuf[256];
@@ -11603,7 +11603,7 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
if (ret)
return ret;
-#ifdef HAS_FCHDIR
+#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR)
PERL_UNUSED_ARG(param);
bash Configure -Uafs -Ud_csh -Duseshrplib -Dusethreads -Ui_db -Ui_gdbm -Ui_ndbm -Ui_dbm -Ui_sdbm -Duseopcode -Dman1dir=none -Dman3dir=none -Dsiteman1=none -Dsiteman3=none -Dvendorman1=none -Dvendorman3=none -des -Uinstallusrbinperl -Ud_getservent_r -Ud_getpwnam_r -Ud_getpwuid_r -Ud_getpwent -Dlibs='-ldl -lm -lc' -Dlibc=/system/lib/libc.so -Dlibpth='/system/lib /data/data/com.pdaxrom.cctools/root/cctools/lib' -Dusrinc=/data/data/com.pdaxrom.cctools/root/cctools/arm-linux-androideabi/include -Dprefix=/data/perl -Dperladmin=dexter@cpan.org
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment