Index: Portfile
===================================================================
--- Portfile	(revision 151571)
+++ Portfile	(working copy)
@@ -31,10 +31,10 @@
 # - revision
 # - rmd160 sha256
 set perl5.versions_info {
-    5.16 3 2 f25fdd72449156a7cbe989e8bd339fdba1afabc0  bb7bc735e6813b177dcfccd480defcde7eddefa173b5967eac11babd1bfa98e8
-    5.18 4 1 d97181a98f7acc80125b0d2a182a6a2cd7542ceb  1fb4d27b75cd244e849f253320260efe1750641aaff4a18ce0d67556ff1b96a5
-    5.20 3 0 499846a1c92e00dd357cb782bc14787b8cd47051  1b40068166c242e34a536836286e70b78410602a80615143301e52aa2901493b
-    5.22 2 0 203afca8995ca426db0af48b78eb606b5d24011a  f2322b9b04fe0cdbca9fe755360da04892cb6483d44959457cfebc0bcddc8058
+    5.16 3 3 f25fdd72449156a7cbe989e8bd339fdba1afabc0  bb7bc735e6813b177dcfccd480defcde7eddefa173b5967eac11babd1bfa98e8
+    5.18 4 2 d97181a98f7acc80125b0d2a182a6a2cd7542ceb  1fb4d27b75cd244e849f253320260efe1750641aaff4a18ce0d67556ff1b96a5
+    5.20 3 1 499846a1c92e00dd357cb782bc14787b8cd47051  1b40068166c242e34a536836286e70b78410602a80615143301e52aa2901493b
+    5.22 2 1 203afca8995ca426db0af48b78eb606b5d24011a  f2322b9b04fe0cdbca9fe755360da04892cb6483d44959457cfebc0bcddc8058
     5.24 0 0 756bf07069e91eabe3dac3a47aec5097d48f8963  62328a53d157e8153b33e137594155f6f8b64418f7f9238210feb809585290e0
 }
 #   5.22 3-RC3 0 24f508e342cb824d96254e91ffd35b09ed740382  9074ac008f11aa5ea3df91a646fa8c23fec37923c729e06a8bc54be4fa710d07
@@ -67,9 +67,20 @@
 
         # TODO: revise patch naming scheme
         patchfiles          ${perl5.major}/clean-up-paths.patch \
-                            ${perl5.major}/avoid-no-cpp-precomp-PR38913.patch \
-                            ${perl5.major}/fix-ld-modification.patch
+                            ${perl5.major}/avoid-no-cpp-precomp-PR38913.patch
 
+        # Prevent build from picking up the bind9 port's static libbind, which
+        # duplicates symbols from /usr/lib/libdl (r10638).
+        patchfiles-append   ${perl5.major}/avoid-bind9-linking.patch
+
+        # Prevent miniperl linking from accidentally finding our libstdc++
+        # https://trac.macports.org/ticket/36438
+        patchfiles-append   ${perl5.major}/fix-miniperl-linking-PR36438.patch
+
+        # Install perl and modules under 5.x rather than 5.x.y
+        # https://trac.macports.org/ticket/43480
+        patchfiles-append   ${perl5.major}/install-under-short-version-PR43480.patch
+
         if {${perl5.major} == 5.16} {
             patchfiles-append \
                             ${perl5.major}/use-stdbool.patch
@@ -77,31 +88,25 @@
             # and https://rt.perl.org/Public/Bug/Display.html?id=121714.
             patchfiles-append \
                             ${perl5.major}/fix-cxx-dNOOP-PR43150.patch
-        } else {
-            patchfiles-append \
-                            ${perl5.major}/install-under-short-version-PR43480.patch \
         }
         if {${perl5.major} >= 5.22} {
-            # failed test
+            # Failed test
             # https://trac.macports.org/ticket/51327
             patchfiles-append \
                             ${perl5.major}/patch-dist-IO-t-cachepropagate-unix.t.diff
         }
         if {${perl5.major} == 5.24} {
-            # build error on Sierra (maybe also relevant for other perl versions?)
+            # Prevent build error on Sierra
             # https://trac.macports.org/ticket/52012
             patchfiles-append \
                             ${perl5.major}/patch-dist-Time-HiRes-HiRes.xs.diff
+        } else {
+            # Do not compile for 10.3/10.4
+            # https://trac.macports.org/ticket/51980
+            patchfiles-append \
+                            ${perl5.major}/remove-10.3-target-PR126360.patch
         }
 
-        # Prevent build from picking up the bind9 port's static libbind, which
-        # duplicates symbols from /usr/lib/libdl (r10638).
-        patchfiles-append   ${perl5.major}/avoid-bind9-linking.patch
-
-        # Prevent miniperl linking from accidentally finding our libstdc++
-        # (#36438).
-        patchfiles-append   ${perl5.major}/fix-miniperl-linking-PR36438.patch
-
         post-patch {
             reinplace -W ${worksrcpath} "s|__PREFIX__|${prefix}|g" \
                     Configure Makefile.SH
@@ -134,22 +139,11 @@
                             -Dvendorman3dir='${prefix}/share/perl${perl5.major}/man/man3' \
                             -Dpager='/usr/bin/less -sR' \
                             -Dperlpath="${perl5.bin}" \
-                            -Dstartperl="#!${perl5.bin}"
-        # flags with -A should be used for all versions of perl,
-        # but for the time being we wanted to avoid rebuilding (revbumping) old perl version
-        # so changing the flags is scheduled for later
-        if {${version} > 5.22} {
-            configure.post_args-append \
-                            {-Acppflags="$CPPFLAGS"} \
-                            {-Accflags="$CFLAGS"} \
-                            {-Aldflags="$LDFLAGS"} \
-        } else {
-            configure.post_args-append \
+                            -Dstartperl="#!${perl5.bin}" \
                             {-Dcppflags="$CPPFLAGS"} \
                             {-Dccflags="$CFLAGS"} \
                             {-Dldflags="$LDFLAGS"} \
                             {-Dld="env MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET $CC"}
-        }
 
         if {[variant_isset universal]} {
             post-configure {
Index: files/5.16/avoid-bind9-linking.patch
===================================================================
--- files/5.16/avoid-bind9-linking.patch	(revision 151570)
+++ files/5.16/avoid-bind9-linking.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -315,6 +315,8 @@ i_dbm=undef;
+@@ -317,7 +317,7 @@ i_dbm=undef;
+ # Configure doesn't detect ranlib on Tiger properly.
  # NeilW says this should be acceptable on all darwin versions.
  ranlib='ranlib'
- 
+-
 +libswanted="$(echo $libswanted | sed -e 's/bind //' -e 's/ bind//')"
-+
  ##
  # Build process
  ##
Index: files/5.16/avoid-no-cpp-precomp-PR38913.patch
===================================================================
--- files/5.16/avoid-no-cpp-precomp-PR38913.patch	(revision 151570)
+++ files/5.16/avoid-no-cpp-precomp-PR38913.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -129,8 +129,6 @@ esac
+@@ -129,7 +129,7 @@ esac
  
  # Avoid Apple's cpp precompiler, better for extensions
  if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
 -    cppflags="${cppflags} -no-cpp-precomp"
--
++
+ 
      # This is necessary because perl's build system doesn't
      # apply cppflags to cc compile lines as it should.
-     ccflags="${ccflags} ${cppflags}"
Index: files/5.16/clean-up-paths.patch
===================================================================
--- files/5.16/clean-up-paths.patch	(revision 151570)
+++ files/5.16/clean-up-paths.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: Configure
-===================================================================
 --- Configure.orig
 +++ Configure
 @@ -106,8 +106,8 @@ if test -d c:/. || ( uname -a | grep -i 
Index: files/5.16/fix-ld-modification.patch
===================================================================
--- files/5.16/fix-ld-modification.patch	(revision 151570)
+++ files/5.16/fix-ld-modification.patch	(nonexistent)
@@ -1,21 +0,0 @@
-Index: hints/darwin.sh
-===================================================================
---- hints/darwin.sh.orig
-+++ hints/darwin.sh
-@@ -141,7 +141,6 @@ esac
- 
- # Shared library extension is .dylib.
- # Bundle extension is .bundle.
--ld='cc';
- so='dylib';
- dlext='bundle';
- usedl='define';
-@@ -182,7 +181,7 @@ case "$osvers" in
- *) 
-    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
-    case "$ld" in
--       *MACOSX_DEVELOPMENT_TARGET*) ;;
-+       *MACOSX_DEPLOYMENT_TARGET*) ;;
-        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
-    esac
-    ;;
Index: files/5.16/fix-miniperl-linking-PR36438.patch
===================================================================
--- files/5.16/fix-miniperl-linking-PR36438.patch	(revision 151570)
+++ files/5.16/fix-miniperl-linking-PR36438.patch	(working copy)
@@ -1,14 +1,11 @@
-Index: Makefile.SH
-===================================================================
 --- Makefile.SH.orig
 +++ Makefile.SH
-@@ -860,7 +860,8 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -860,7 +860,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  $(MINIPERL_EXE): $& $(mini_obj)
  	-@rm -f miniperl.xok
 -	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
-+	unset LIBRARY_PATH && \
-+	$(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
++	unset LIBRARY_PATH && $(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(mini_obj) $(libs)
  	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
  !NO!SUBS!
Index: files/5.16/install-under-short-version-PR43480.patch
===================================================================
--- files/5.16/install-under-short-version-PR43480.patch	(revision 151570)
+++ files/5.16/install-under-short-version-PR43480.patch	(working copy)
@@ -1,3 +1,4 @@
+https://trac.macports.org/ticket/43480
 --- Configure.orig
 +++ Configure
 @@ -4132,6 +4132,8 @@ dos|vms)
Index: files/5.16/remove-10.3-target-PR126360.patch
===================================================================
--- files/5.16/remove-10.3-target-PR126360.patch	(nonexistent)
+++ files/5.16/remove-10.3-target-PR126360.patch	(working copy)
@@ -0,0 +1,148 @@
+https://trac.macports.org/ticket/51980
+https://rt.perl.org/Ticket/Display.html?id=126360
+https://rt.perl.org/Ticket/Display.html?id=128980
+http://perl5.git.perl.org/perl.git/commit/53d1d41c81e1de9cc6416dcae828c13d4c5a470a
+
+--- hints/darwin.sh.orig
++++ hints/darwin.sh
+@@ -143,7 +143,7 @@ esac
+ 
+ # Shared library extension is .dylib.
+ # Bundle extension is .bundle.
+-ld='cc';
++
+ so='dylib';
+ dlext='bundle';
+ usedl='define';
+@@ -167,28 +167,125 @@ case "$ccdlflags" in		# If passed in from command line, presume user knows best
+ ;;
+ esac
+ 
++# From http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mk/platform/Darwin.mk
++#
++# OS, Kernel, Xcode Version
++# Note that Xcode gets updates on older systems sometimes.
++# pkgsrc generally expects that the most up-to-date xcode available for
++# an OS version is installed
++#
++# Codename        OS      Kernel  Xcode
++# Cheetah         10.0.x  1.3.1
++# Puma            10.1    1.4.1
++#                 10.1.x  5.x.y
++# Jaguar          10.2.x  6.x.y
++# Panther         10.3.x  7.x.y
++# Tiger           10.4.x  8.x.y   2.x (gcc 4.0, 4.0.1 from 2.2)
++# Leopard         10.5.x  9.x.y   3.x (gcc 4.0.1, 4.0.1 and 4.2.1 from 3.1)
++# Snow Leopard    10.6.x  10.x.y  3.2+ (gcc 4.0.1 and 4.2.1)
++# Lion            10.7.x  11.x.y  4.1 (llvm gcc 4.2.1)
++# Mountain Lion   10.8.x  12.x.y  4.5 (llvm gcc 4.2.1)
++# Mavericks       10.9.x  13.x.y  6 (llvm clang 6.0)
++# Yosemite        10.10.x 14.x.y  6 (llvm clang 6.0)
++# El Capitan      10.11.x 15.x.y  7 (llvm clang 7.0)
++
++# MACOSX_DEPLOYMENT_TARGET selects the minimum OS level we want to support
++#
++# It is needed for OS releases before 10.6.
++#
++# https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
++#
++# If it is set, we also propagate its value to ccflags and ldflags
++# using the -mmacosx-version-min flag.  If it is not set, we use
++# the OS X release as the min value for the flag.
++
++# Adds "-mmacosx-version-min=$2" to "$1" unless it already is there.
++add_macosx_version_min () {
++  local v
++  eval "v=\$$1"
++  case " $v " in
++  *"-mmacosx-version-min"*)
++     echo "NOT adding -mmacosx-version-min=$2 to $1 ($v)" >&4
++     ;;
++  *) echo "Adding -mmacosx-version-min=$2 to $1" >&4
++     eval "$1='$v -mmacosx-version-min=$2'"
++     ;;
++  esac
++}
++
+ # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
+ # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
+-case "$osvers" in
+-1.[0-3].*)
++case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
++1.[0-3].*) # OS X 10.0.x
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-1.*)
++1.*)       # OS X 10.1
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-[2-6].*)
++[2-6].*)   # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly)
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-*) 
++[7-9].*)   # OS X 10.3.x - 10.5.x
+    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+    case "$ld" in
+-       *MACOSX_DEVELOPMENT_TARGET*) ;;
++       *MACOSX_DEPLOYMENT_TARGET*) ;;
+        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
+    esac
+    ;;
++*)        # OS X 10.6.x - current
++   # The MACOSX_DEPLOYMENT_TARGET is not needed,
++   # but the -mmacosx-version-min option is always used.
++
++   # We now use MACOSX_DEPLOYMENT_TARGET, if set, as an override by
++   # capturing its value and adding it to the flags.
++    case "$MACOSX_DEPLOYMENT_TARGET" in
++    10.*)
++      add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET
++      add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET
++      ;;
++    '')
++      # Empty MACOSX_DEPLOYMENT_TARGET is okay.
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
++***
++*** Please either set it to 10.something, or to empty.
++
++EOM
++      exit 1
++      ;;
++    esac
++
++    # Keep the prodvers leading whitespace (Configure magic).
++    # Cannot use $osvers here since that is the kernel version.
++    # sw_vers output                 what we want
++    # "ProductVersion:    10.10.5"   "10.10"
++    # "ProductVersion:    10.11"     "10.11"
++        prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'`
++    case "$prodvers" in
++    10.*)
++      add_macosx_version_min ccflags $prodvers
++      add_macosx_version_min ldflags $prodvers
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected product version $prodvers.
++***
++*** Try running sw_vers and see what its ProductVersion says.
++
++EOM
++      exit 1
++    esac
++
++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
++   ;;
+ esac
++
+ ldlibpthname='DYLD_LIBRARY_PATH';
+ 
+ # useshrplib=true results in much slower startup times.
Index: files/5.16/use-stdbool.patch
===================================================================
--- files/5.16/use-stdbool.patch	(revision 151570)
+++ files/5.16/use-stdbool.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: handy.h
-===================================================================
 --- handy.h.orig
 +++ handy.h
 @@ -77,41 +77,8 @@ Null SV pointer. (No longer available wh
Index: files/5.18/avoid-bind9-linking.patch
===================================================================
--- files/5.18/avoid-bind9-linking.patch	(revision 151570)
+++ files/5.18/avoid-bind9-linking.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -315,6 +315,8 @@ i_dbm=undef;
+@@ -317,7 +317,7 @@ i_dbm=undef;
+ # Configure doesn't detect ranlib on Tiger properly.
  # NeilW says this should be acceptable on all darwin versions.
  ranlib='ranlib'
- 
+-
 +libswanted="$(echo $libswanted | sed -e 's/bind //' -e 's/ bind//')"
-+
  ##
  # Build process
  ##
Index: files/5.18/avoid-no-cpp-precomp-PR38913.patch
===================================================================
--- files/5.18/avoid-no-cpp-precomp-PR38913.patch	(revision 151570)
+++ files/5.18/avoid-no-cpp-precomp-PR38913.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -129,8 +129,6 @@ esac
+@@ -129,7 +129,7 @@ esac
  
  # Avoid Apple's cpp precompiler, better for extensions
  if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
 -    cppflags="${cppflags} -no-cpp-precomp"
--
++
+ 
      # This is necessary because perl's build system doesn't
      # apply cppflags to cc compile lines as it should.
-     ccflags="${ccflags} ${cppflags}"
Index: files/5.18/clean-up-paths.patch
===================================================================
--- files/5.18/clean-up-paths.patch	(revision 151570)
+++ files/5.18/clean-up-paths.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: Configure
-===================================================================
 --- Configure.orig
 +++ Configure
 @@ -106,8 +106,8 @@ if test -d c:/. || ( uname -a | grep -i 
Index: files/5.18/fix-ld-modification.patch
===================================================================
--- files/5.18/fix-ld-modification.patch	(revision 151570)
+++ files/5.18/fix-ld-modification.patch	(nonexistent)
@@ -1,21 +0,0 @@
-Index: hints/darwin.sh
-===================================================================
---- hints/darwin.sh.orig
-+++ hints/darwin.sh
-@@ -141,7 +141,6 @@ esac
- 
- # Shared library extension is .dylib.
- # Bundle extension is .bundle.
--ld='cc';
- so='dylib';
- dlext='bundle';
- usedl='define';
-@@ -182,7 +181,7 @@ case "$osvers" in
- *) 
-    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
-    case "$ld" in
--       *MACOSX_DEVELOPMENT_TARGET*) ;;
-+       *MACOSX_DEPLOYMENT_TARGET*) ;;
-        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
-    esac
-    ;;
Index: files/5.18/fix-miniperl-linking-PR36438.patch
===================================================================
--- files/5.18/fix-miniperl-linking-PR36438.patch	(revision 151570)
+++ files/5.18/fix-miniperl-linking-PR36438.patch	(working copy)
@@ -1,14 +1,11 @@
-Index: Makefile.SH
-===================================================================
 --- Makefile.SH.orig
 +++ Makefile.SH
-@@ -870,7 +870,8 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -870,7 +870,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  $(MINIPERL_EXE): $& $(mini_obj)
  	-@rm -f miniperl.xok
 -	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
-+	unset LIBRARY_PATH && \
-+	$(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
++	unset LIBRARY_PATH && $(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(mini_obj) $(libs)
  	$(LDLIBPTH) $(RUN) ./miniperl$(HOST_EXE_EXT) -w -Ilib -MExporter -e '<?>' || $(MAKE) minitest
  !NO!SUBS!
Index: files/5.18/install-under-short-version-PR43480.patch
===================================================================
--- files/5.18/install-under-short-version-PR43480.patch	(revision 151570)
+++ files/5.18/install-under-short-version-PR43480.patch	(working copy)
@@ -1,3 +1,4 @@
+https://trac.macports.org/ticket/43480
 --- Configure.orig
 +++ Configure
 @@ -4132,6 +4132,8 @@ dos|vms)
Index: files/5.18/remove-10.3-target-PR126360.patch
===================================================================
--- files/5.18/remove-10.3-target-PR126360.patch	(nonexistent)
+++ files/5.18/remove-10.3-target-PR126360.patch	(working copy)
@@ -0,0 +1,148 @@
+https://trac.macports.org/ticket/51980
+https://rt.perl.org/Ticket/Display.html?id=126360
+https://rt.perl.org/Ticket/Display.html?id=128980
+http://perl5.git.perl.org/perl.git/commit/53d1d41c81e1de9cc6416dcae828c13d4c5a470a
+
+--- hints/darwin.sh.orig
++++ hints/darwin.sh
+@@ -143,7 +143,7 @@ esac
+ 
+ # Shared library extension is .dylib.
+ # Bundle extension is .bundle.
+-ld='cc';
++
+ so='dylib';
+ dlext='bundle';
+ usedl='define';
+@@ -167,28 +167,125 @@ case "$ccdlflags" in		# If passed in from command line, presume user knows best
+ ;;
+ esac
+ 
++# From http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mk/platform/Darwin.mk
++#
++# OS, Kernel, Xcode Version
++# Note that Xcode gets updates on older systems sometimes.
++# pkgsrc generally expects that the most up-to-date xcode available for
++# an OS version is installed
++#
++# Codename        OS      Kernel  Xcode
++# Cheetah         10.0.x  1.3.1
++# Puma            10.1    1.4.1
++#                 10.1.x  5.x.y
++# Jaguar          10.2.x  6.x.y
++# Panther         10.3.x  7.x.y
++# Tiger           10.4.x  8.x.y   2.x (gcc 4.0, 4.0.1 from 2.2)
++# Leopard         10.5.x  9.x.y   3.x (gcc 4.0.1, 4.0.1 and 4.2.1 from 3.1)
++# Snow Leopard    10.6.x  10.x.y  3.2+ (gcc 4.0.1 and 4.2.1)
++# Lion            10.7.x  11.x.y  4.1 (llvm gcc 4.2.1)
++# Mountain Lion   10.8.x  12.x.y  4.5 (llvm gcc 4.2.1)
++# Mavericks       10.9.x  13.x.y  6 (llvm clang 6.0)
++# Yosemite        10.10.x 14.x.y  6 (llvm clang 6.0)
++# El Capitan      10.11.x 15.x.y  7 (llvm clang 7.0)
++
++# MACOSX_DEPLOYMENT_TARGET selects the minimum OS level we want to support
++#
++# It is needed for OS releases before 10.6.
++#
++# https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
++#
++# If it is set, we also propagate its value to ccflags and ldflags
++# using the -mmacosx-version-min flag.  If it is not set, we use
++# the OS X release as the min value for the flag.
++
++# Adds "-mmacosx-version-min=$2" to "$1" unless it already is there.
++add_macosx_version_min () {
++  local v
++  eval "v=\$$1"
++  case " $v " in
++  *"-mmacosx-version-min"*)
++     echo "NOT adding -mmacosx-version-min=$2 to $1 ($v)" >&4
++     ;;
++  *) echo "Adding -mmacosx-version-min=$2 to $1" >&4
++     eval "$1='$v -mmacosx-version-min=$2'"
++     ;;
++  esac
++}
++
+ # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
+ # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
+-case "$osvers" in
+-1.[0-3].*)
++case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
++1.[0-3].*) # OS X 10.0.x
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-1.*)
++1.*)       # OS X 10.1
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-[2-6].*)
++[2-6].*)   # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly)
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-*) 
++[7-9].*)   # OS X 10.3.x - 10.5.x
+    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+    case "$ld" in
+-       *MACOSX_DEVELOPMENT_TARGET*) ;;
++       *MACOSX_DEPLOYMENT_TARGET*) ;;
+        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
+    esac
+    ;;
++*)        # OS X 10.6.x - current
++   # The MACOSX_DEPLOYMENT_TARGET is not needed,
++   # but the -mmacosx-version-min option is always used.
++
++   # We now use MACOSX_DEPLOYMENT_TARGET, if set, as an override by
++   # capturing its value and adding it to the flags.
++    case "$MACOSX_DEPLOYMENT_TARGET" in
++    10.*)
++      add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET
++      add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET
++      ;;
++    '')
++      # Empty MACOSX_DEPLOYMENT_TARGET is okay.
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
++***
++*** Please either set it to 10.something, or to empty.
++
++EOM
++      exit 1
++      ;;
++    esac
++
++    # Keep the prodvers leading whitespace (Configure magic).
++    # Cannot use $osvers here since that is the kernel version.
++    # sw_vers output                 what we want
++    # "ProductVersion:    10.10.5"   "10.10"
++    # "ProductVersion:    10.11"     "10.11"
++        prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'`
++    case "$prodvers" in
++    10.*)
++      add_macosx_version_min ccflags $prodvers
++      add_macosx_version_min ldflags $prodvers
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected product version $prodvers.
++***
++*** Try running sw_vers and see what its ProductVersion says.
++
++EOM
++      exit 1
++    esac
++
++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
++   ;;
+ esac
++
+ ldlibpthname='DYLD_LIBRARY_PATH';
+ 
+ # useshrplib=true results in much slower startup times.
Index: files/5.20/avoid-bind9-linking.patch
===================================================================
--- files/5.20/avoid-bind9-linking.patch	(revision 151570)
+++ files/5.20/avoid-bind9-linking.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -327,6 +327,8 @@ i_dbm=undef;
+@@ -330,7 +330,7 @@ i_dbm=undef;
+ # Configure doesn't detect ranlib on Tiger properly.
  # NeilW says this should be acceptable on all darwin versions.
  ranlib='ranlib'
- 
+-
 +libswanted="$(echo $libswanted | sed -e 's/bind //' -e 's/ bind//')"
-+
  ##
  # Build process
  ##
Index: files/5.20/avoid-no-cpp-precomp-PR38913.patch
===================================================================
--- files/5.20/avoid-no-cpp-precomp-PR38913.patch	(revision 151570)
+++ files/5.20/avoid-no-cpp-precomp-PR38913.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -129,8 +129,6 @@ esac
+@@ -131,7 +131,7 @@ esac
  
  # Avoid Apple's cpp precompiler, better for extensions
  if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
 -    cppflags="${cppflags} -no-cpp-precomp"
--
++
+ 
      # This is necessary because perl's build system doesn't
      # apply cppflags to cc compile lines as it should.
-     ccflags="${ccflags} ${cppflags}"
Index: files/5.20/clean-up-paths.patch
===================================================================
--- files/5.20/clean-up-paths.patch	(revision 151570)
+++ files/5.20/clean-up-paths.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: Configure
-===================================================================
 --- Configure.orig
 +++ Configure
 @@ -106,8 +106,8 @@ if test -d c:/. || ( uname -a | grep -i 
Index: files/5.20/fix-ld-modification.patch
===================================================================
--- files/5.20/fix-ld-modification.patch	(revision 151570)
+++ files/5.20/fix-ld-modification.patch	(nonexistent)
@@ -1,13 +0,0 @@
-Index: hints/darwin.sh
-===================================================================
---- hints/darwin.sh.orig
-+++ hints/darwin.sh
-@@ -193,7 +193,7 @@ case "$osvers" in
- *) 
-    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
-    case "$ld" in
--       *MACOSX_DEVELOPMENT_TARGET*) ;;
-+       *MACOSX_DEPLOYMENT_TARGET*) ;;
-        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
-    esac
-    ;;
Index: files/5.20/fix-miniperl-linking-PR36438.patch
===================================================================
--- files/5.20/fix-miniperl-linking-PR36438.patch	(revision 151570)
+++ files/5.20/fix-miniperl-linking-PR36438.patch	(working copy)
@@ -1,14 +1,11 @@
-Index: Makefile.SH
-===================================================================
 --- Makefile.SH.orig
 +++ Makefile.SH
-@@ -914,7 +914,8 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -914,7 +914,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl
  	-@rm -f miniperl.xok
 -	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
-+	unset LIBRARY_PATH && \
-+	$(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
++	unset LIBRARY_PATH && $(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(mini_obj) $(libs)
  	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
  	$(MINIPERL) -f write_buildcustomize.pl
Index: files/5.20/remove-10.3-target-PR126360.patch
===================================================================
--- files/5.20/remove-10.3-target-PR126360.patch	(nonexistent)
+++ files/5.20/remove-10.3-target-PR126360.patch	(working copy)
@@ -0,0 +1,139 @@
+https://trac.macports.org/ticket/51980
+https://rt.perl.org/Ticket/Display.html?id=126360
+https://rt.perl.org/Ticket/Display.html?id=128980
+http://perl5.git.perl.org/perl.git/commit/53d1d41c81e1de9cc6416dcae828c13d4c5a470a
+
+--- hints/darwin.sh.orig
++++ hints/darwin.sh
+@@ -180,28 +180,125 @@ case "$ld" in
+         ;;
+ esac
+ 
++# From http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mk/platform/Darwin.mk
++#
++# OS, Kernel, Xcode Version
++# Note that Xcode gets updates on older systems sometimes.
++# pkgsrc generally expects that the most up-to-date xcode available for
++# an OS version is installed
++#
++# Codename        OS      Kernel  Xcode
++# Cheetah         10.0.x  1.3.1
++# Puma            10.1    1.4.1
++#                 10.1.x  5.x.y
++# Jaguar          10.2.x  6.x.y
++# Panther         10.3.x  7.x.y
++# Tiger           10.4.x  8.x.y   2.x (gcc 4.0, 4.0.1 from 2.2)
++# Leopard         10.5.x  9.x.y   3.x (gcc 4.0.1, 4.0.1 and 4.2.1 from 3.1)
++# Snow Leopard    10.6.x  10.x.y  3.2+ (gcc 4.0.1 and 4.2.1)
++# Lion            10.7.x  11.x.y  4.1 (llvm gcc 4.2.1)
++# Mountain Lion   10.8.x  12.x.y  4.5 (llvm gcc 4.2.1)
++# Mavericks       10.9.x  13.x.y  6 (llvm clang 6.0)
++# Yosemite        10.10.x 14.x.y  6 (llvm clang 6.0)
++# El Capitan      10.11.x 15.x.y  7 (llvm clang 7.0)
++
++# MACOSX_DEPLOYMENT_TARGET selects the minimum OS level we want to support
++#
++# It is needed for OS releases before 10.6.
++#
++# https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
++#
++# If it is set, we also propagate its value to ccflags and ldflags
++# using the -mmacosx-version-min flag.  If it is not set, we use
++# the OS X release as the min value for the flag.
++
++# Adds "-mmacosx-version-min=$2" to "$1" unless it already is there.
++add_macosx_version_min () {
++  local v
++  eval "v=\$$1"
++  case " $v " in
++  *"-mmacosx-version-min"*)
++     echo "NOT adding -mmacosx-version-min=$2 to $1 ($v)" >&4
++     ;;
++  *) echo "Adding -mmacosx-version-min=$2 to $1" >&4
++     eval "$1='$v -mmacosx-version-min=$2'"
++     ;;
++  esac
++}
++
+ # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
+ # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
+-case "$osvers" in
+-1.[0-3].*)
++case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
++1.[0-3].*) # OS X 10.0.x
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-1.*)
++1.*)       # OS X 10.1
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-[2-6].*)
++[2-6].*)   # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly)
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-*) 
++[7-9].*)   # OS X 10.3.x - 10.5.x
+    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+    case "$ld" in
+-       *MACOSX_DEVELOPMENT_TARGET*) ;;
++       *MACOSX_DEPLOYMENT_TARGET*) ;;
+        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
+    esac
+    ;;
++*)        # OS X 10.6.x - current
++   # The MACOSX_DEPLOYMENT_TARGET is not needed,
++   # but the -mmacosx-version-min option is always used.
++
++   # We now use MACOSX_DEPLOYMENT_TARGET, if set, as an override by
++   # capturing its value and adding it to the flags.
++    case "$MACOSX_DEPLOYMENT_TARGET" in
++    10.*)
++      add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET
++      add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET
++      ;;
++    '')
++      # Empty MACOSX_DEPLOYMENT_TARGET is okay.
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
++***
++*** Please either set it to 10.something, or to empty.
++
++EOM
++      exit 1
++      ;;
++    esac
++
++    # Keep the prodvers leading whitespace (Configure magic).
++    # Cannot use $osvers here since that is the kernel version.
++    # sw_vers output                 what we want
++    # "ProductVersion:    10.10.5"   "10.10"
++    # "ProductVersion:    10.11"     "10.11"
++        prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'`
++    case "$prodvers" in
++    10.*)
++      add_macosx_version_min ccflags $prodvers
++      add_macosx_version_min ldflags $prodvers
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected product version $prodvers.
++***
++*** Try running sw_vers and see what its ProductVersion says.
++
++EOM
++      exit 1
++    esac
++
++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
++   ;;
+ esac
++
+ ldlibpthname='DYLD_LIBRARY_PATH';
+ 
+ # useshrplib=true results in much slower startup times.
Index: files/5.22/avoid-bind9-linking.patch
===================================================================
--- files/5.22/avoid-bind9-linking.patch	(revision 151570)
+++ files/5.22/avoid-bind9-linking.patch	(working copy)
@@ -2,16 +2,14 @@
 	loclibpth="$loclibpth /opt/local/lib/libgcc" ;;
 which is new in 5.22 needs some special "treatment".
 
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -337,6 +337,8 @@ i_dbm=undef;
+@@ -338,7 +338,7 @@ i_dbm=undef;
+ # Configure doesn't detect ranlib on Tiger properly.
  # NeilW says this should be acceptable on all darwin versions.
  ranlib='ranlib'
- 
+-
 +libswanted="$(echo $libswanted | sed -e 's/bind //' -e 's/ bind//')"
-+
  # Catch MacPorts gcc/g++ extra libdir
  case "$($cc -v 2>&1)" in
  *"MacPorts gcc"*) loclibpth="$loclibpth /opt/local/lib/libgcc" ;;
Index: files/5.22/avoid-no-cpp-precomp-PR38913.patch
===================================================================
--- files/5.22/avoid-no-cpp-precomp-PR38913.patch	(revision 151570)
+++ files/5.22/avoid-no-cpp-precomp-PR38913.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -137,8 +137,6 @@ esac
+@@ -137,7 +137,7 @@ esac
  
  # Avoid Apple's cpp precompiler, better for extensions
  if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
 -    cppflags="${cppflags} -no-cpp-precomp"
--
++
+ 
      # This is necessary because perl's build system doesn't
      # apply cppflags to cc compile lines as it should.
-     ccflags="${ccflags} ${cppflags}"
Index: files/5.22/clean-up-paths.patch
===================================================================
--- files/5.22/clean-up-paths.patch	(revision 151570)
+++ files/5.22/clean-up-paths.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: Configure
-===================================================================
 --- Configure.orig
 +++ Configure
 @@ -108,8 +108,8 @@ if test -d c:/. || ( uname -a | grep -i 
@@ -13,7 +11,7 @@
  paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
  paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
  paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
-@@ -1404,7 +1404,7 @@ archobjs=''
+@@ -1405,7 +1405,7 @@ archobjs=''
  archname=''
  : Possible local include directories to search.
  : Set locincpth to "" in a hint file to defeat local include searches.
@@ -22,7 +20,7 @@
  locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
  :
  : no include file wanted by default
-@@ -1418,12 +1418,12 @@ libnames=''
+@@ -1419,12 +1419,12 @@ libnames=''
  : change the next line if compiling for Xenix/286 on Xenix/386
  xlibpth='/usr/lib/386 /lib/386'
  : Possible local library directories to search.
Index: files/5.22/fix-ld-modification.patch
===================================================================
--- files/5.22/fix-ld-modification.patch	(revision 151570)
+++ files/5.22/fix-ld-modification.patch	(nonexistent)
@@ -1,13 +0,0 @@
-Index: hints/darwin.sh
-===================================================================
---- hints/darwin.sh.orig
-+++ hints/darwin.sh
-@@ -203,7 +203,7 @@ case "$osvers" in
-    # https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
-    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
-    case "$ld" in
--       *MACOSX_DEVELOPMENT_TARGET*) ;;
-+       *MACOSX_DEPLOYMENT_TARGET*) ;;
-        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
-    esac
-    ;;
Index: files/5.22/fix-miniperl-linking-PR36438.patch
===================================================================
--- files/5.22/fix-miniperl-linking-PR36438.patch	(revision 151570)
+++ files/5.22/fix-miniperl-linking-PR36438.patch	(working copy)
@@ -1,14 +1,11 @@
-Index: Makefile.SH
-===================================================================
 --- Makefile.SH.orig
 +++ Makefile.SH
-@@ -905,7 +905,8 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -908,7 +908,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(mini_obj) write_buildcustomize.pl
  	-@rm -f miniperl.xok
 -	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
-+	unset LIBRARY_PATH && \
-+	$(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
++	unset LIBRARY_PATH && $(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(mini_obj) $(libs)
  	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
  	$(MINIPERL) -f write_buildcustomize.pl
Index: files/5.22/install-under-short-version-PR43480.patch
===================================================================
--- files/5.22/install-under-short-version-PR43480.patch	(revision 151570)
+++ files/5.22/install-under-short-version-PR43480.patch	(working copy)
@@ -19,7 +19,7 @@
  *)	 set dflt privlib lib/$version ;;
  esac
  eval $prefixit
-@@ -7490,7 +7494,7 @@ siteprefixexp="$ansexp"
+@@ -7492,7 +7492,7 @@ siteprefixexp="$ansexp"
  prog=`echo $package | $sed 's/-*[0-9.]*$//'`
  case "$sitelib" in
  '') case "$installstyle" in
Index: files/5.22/remove-10.3-target-PR126360.patch
===================================================================
--- files/5.22/remove-10.3-target-PR126360.patch	(nonexistent)
+++ files/5.22/remove-10.3-target-PR126360.patch	(working copy)
@@ -0,0 +1,142 @@
+https://trac.macports.org/ticket/51980
+https://rt.perl.org/Ticket/Display.html?id=126360
+https://rt.perl.org/Ticket/Display.html?id=128980
+http://perl5.git.perl.org/perl.git/commit/53d1d41c81e1de9cc6416dcae828c13d4c5a470a
+
+--- hints/darwin.sh.orig
++++ hints/darwin.sh
+@@ -186,30 +186,125 @@ case "$ld" in
+         ;;
+ esac
+ 
++# From http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/mk/platform/Darwin.mk
++#
++# OS, Kernel, Xcode Version
++# Note that Xcode gets updates on older systems sometimes.
++# pkgsrc generally expects that the most up-to-date xcode available for
++# an OS version is installed
++#
++# Codename        OS      Kernel  Xcode
++# Cheetah         10.0.x  1.3.1
++# Puma            10.1    1.4.1
++#                 10.1.x  5.x.y
++# Jaguar          10.2.x  6.x.y
++# Panther         10.3.x  7.x.y
++# Tiger           10.4.x  8.x.y   2.x (gcc 4.0, 4.0.1 from 2.2)
++# Leopard         10.5.x  9.x.y   3.x (gcc 4.0.1, 4.0.1 and 4.2.1 from 3.1)
++# Snow Leopard    10.6.x  10.x.y  3.2+ (gcc 4.0.1 and 4.2.1)
++# Lion            10.7.x  11.x.y  4.1 (llvm gcc 4.2.1)
++# Mountain Lion   10.8.x  12.x.y  4.5 (llvm gcc 4.2.1)
++# Mavericks       10.9.x  13.x.y  6 (llvm clang 6.0)
++# Yosemite        10.10.x 14.x.y  6 (llvm clang 6.0)
++# El Capitan      10.11.x 15.x.y  7 (llvm clang 7.0)
++
++# MACOSX_DEPLOYMENT_TARGET selects the minimum OS level we want to support
++#
++# It is needed for OS releases before 10.6.
++#
++# https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
++#
++# If it is set, we also propagate its value to ccflags and ldflags
++# using the -mmacosx-version-min flag.  If it is not set, we use
++# the OS X release as the min value for the flag.
++
++# Adds "-mmacosx-version-min=$2" to "$1" unless it already is there.
++add_macosx_version_min () {
++  local v
++  eval "v=\$$1"
++  case " $v " in
++  *"-mmacosx-version-min"*)
++     echo "NOT adding -mmacosx-version-min=$2 to $1 ($v)" >&4
++     ;;
++  *) echo "Adding -mmacosx-version-min=$2 to $1" >&4
++     eval "$1='$v -mmacosx-version-min=$2'"
++     ;;
++  esac
++}
++
+ # Perl bundles do not expect two-level namespace, added in Darwin 1.4.
+ # But starting from perl 5.8.1/Darwin 7 the default is the two-level.
+-case "$osvers" in
+-1.[0-3].*)
++case "$osvers" in  # Note: osvers is the kernel version, not the 10.x
++1.[0-3].*) # OS X 10.0.x
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-1.*)
++1.*)       # OS X 10.1
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-[2-6].*)
++[2-6].*)   # OS X 10.1.x - 10.2.x (though [2-4] never existed publicly)
+    ldflags="${ldflags} -flat_namespace"
+    lddlflags="${ldflags} -bundle -undefined suppress"
+    ;;
+-*) 
+-   # MACOSX_DEPLOYMENT_TARGET selects the minimum OS level we want to support
+-   # https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html
++[7-9].*)   # OS X 10.3.x - 10.5.x
+    lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
+    case "$ld" in
+-       *MACOSX_DEVELOPMENT_TARGET*) ;;
++       *MACOSX_DEPLOYMENT_TARGET*) ;;
+        *) ld="env MACOSX_DEPLOYMENT_TARGET=10.3 ${ld}" ;;
+    esac
+    ;;
++*)        # OS X 10.6.x - current
++   # The MACOSX_DEPLOYMENT_TARGET is not needed,
++   # but the -mmacosx-version-min option is always used.
++
++   # We now use MACOSX_DEPLOYMENT_TARGET, if set, as an override by
++   # capturing its value and adding it to the flags.
++    case "$MACOSX_DEPLOYMENT_TARGET" in
++    10.*)
++      add_macosx_version_min ccflags $MACOSX_DEPLOYMENT_TARGET
++      add_macosx_version_min ldflags $MACOSX_DEPLOYMENT_TARGET
++      ;;
++    '')
++      # Empty MACOSX_DEPLOYMENT_TARGET is okay.
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
++***
++*** Please either set it to 10.something, or to empty.
++
++EOM
++      exit 1
++      ;;
++    esac
++
++    # Keep the prodvers leading whitespace (Configure magic).
++    # Cannot use $osvers here since that is the kernel version.
++    # sw_vers output                 what we want
++    # "ProductVersion:    10.10.5"   "10.10"
++    # "ProductVersion:    10.11"     "10.11"
++        prodvers=`sw_vers|awk '/^ProductVersion:/{print $2}'|awk -F. '{print $1"."$2}'`
++    case "$prodvers" in
++    10.*)
++      add_macosx_version_min ccflags $prodvers
++      add_macosx_version_min ldflags $prodvers
++      ;;
++    *)
++      cat <<EOM >&4
++
++*** Unexpected product version $prodvers.
++***
++*** Try running sw_vers and see what its ProductVersion says.
++
++EOM
++      exit 1
++    esac
++
++   lddlflags="${ldflags} -bundle -undefined dynamic_lookup"
++   ;;
+ esac
++
+ ldlibpthname='DYLD_LIBRARY_PATH';
+ 
+ # useshrplib=true results in much slower startup times.
+
Index: files/5.24/avoid-bind9-linking.patch
===================================================================
--- files/5.24/avoid-bind9-linking.patch	(revision 151570)
+++ files/5.24/avoid-bind9-linking.patch	(working copy)
@@ -2,16 +2,14 @@
 	loclibpth="$loclibpth /opt/local/lib/libgcc" ;;
 which is new in 5.22 needs some special "treatment".
 
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -482,6 +482,8 @@ i_dbm=undef;
+@@ -483,7 +483,7 @@ i_dbm=undef;
+ # Configure doesn't detect ranlib on Tiger properly.
  # NeilW says this should be acceptable on all darwin versions.
  ranlib='ranlib'
- 
+-
 +libswanted="$(echo $libswanted | sed -e 's/bind //' -e 's/ bind//')"
-+
  # Catch MacPorts gcc/g++ extra libdir
  case "$($cc -v 2>&1)" in
  *"MacPorts gcc"*) loclibpth="$loclibpth /opt/local/lib/libgcc" ;;
Index: files/5.24/avoid-no-cpp-precomp-PR38913.patch
===================================================================
--- files/5.24/avoid-no-cpp-precomp-PR38913.patch	(revision 151570)
+++ files/5.24/avoid-no-cpp-precomp-PR38913.patch	(working copy)
@@ -1,13 +1,11 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
-@@ -137,8 +137,6 @@ esac
+@@ -137,7 +137,7 @@ esac
  
  # Avoid Apple's cpp precompiler, better for extensions
  if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
 -    cppflags="${cppflags} -no-cpp-precomp"
--
++
+ 
      # This is necessary because perl's build system doesn't
      # apply cppflags to cc compile lines as it should.
-     ccflags="${ccflags} ${cppflags}"
Index: files/5.24/clean-up-paths.patch
===================================================================
--- files/5.24/clean-up-paths.patch	(revision 151570)
+++ files/5.24/clean-up-paths.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: Configure
-===================================================================
 --- Configure.orig
 +++ Configure
 @@ -111,8 +111,8 @@ if test -d c:/. || ( uname -a | grep -i 
Index: files/5.24/fix-ld-modification.patch
===================================================================
--- files/5.24/fix-ld-modification.patch	(revision 151570)
+++ files/5.24/fix-ld-modification.patch	(working copy)
@@ -1,5 +1,3 @@
-Index: hints/darwin.sh
-===================================================================
 --- hints/darwin.sh.orig
 +++ hints/darwin.sh
 @@ -292,7 +292,7 @@ case "$osvers" in
Index: files/5.24/fix-miniperl-linking-PR36438.patch
===================================================================
--- files/5.24/fix-miniperl-linking-PR36438.patch	(revision 151570)
+++ files/5.24/fix-miniperl-linking-PR36438.patch	(working copy)
@@ -1,14 +1,11 @@
-Index: Makefile.SH
-===================================================================
 --- Makefile.SH.orig
 +++ Makefile.SH
-@@ -964,7 +964,8 @@ NAMESPACEFLAGS = -force_flat_namespace
+@@ -964,7 +964,7 @@ NAMESPACEFLAGS = -force_flat_namespace
  		$spitshell >>$Makefile <<'!NO!SUBS!'
  lib/buildcustomize.pl: $& $(miniperl_objs) write_buildcustomize.pl
  	-@rm -f miniperl.xok
 -	$(CC) $(CLDFLAGS) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
-+	unset LIBRARY_PATH && \
-+	$(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
++	unset LIBRARY_PATH && $(CC) $(subst -L__PREFIX__/lib,,$(CLDFLAGS)) $(NAMESPACEFLAGS) -o $(MINIPERL_EXE) \
  	    $(miniperl_objs) $(libs)
  	$(LDLIBPTH) ./miniperl$(HOST_EXE_EXT) -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl.  Please run make minitest; exit 1'
  	$(MINIPERL) -f write_buildcustomize.pl
