#!/bin/sh

function mycp {

  if [ ! -r $2 ] ; then
    cp $1 $2
  else
    echo "$2 already exist"
  fi
}

echo 
echo "*** Patch: cnf-clang16.patch"
# ${PREFIX} mycp "../" "../.org"
# ${PREFIX} patch "../" "cnf-clang16.patch"

echo 
echo "*** Patch: cnf-configure_func.sh.patch"
# ${PREFIX} mycp "../" "../.org"
# ${PREFIX} patch "../" "cnf-configure_func.sh.patch"

echo 
echo "*** Patch: cnf-configure_path.sh.patch"
# ${PREFIX} mycp "../" "../.org"
# ${PREFIX} patch "../" "cnf-configure_path.sh.patch"

echo 
echo "*** Patch: create-placeholder-in-empty-sitearch-dir.patch"
 ${PREFIX} mycp "../installperl" "../installperl.org"
 ${PREFIX} patch "../installperl" "create-placeholder-in-empty-sitearch-dir.patch"

echo 
echo "*** Patch: file-spec-unix.pm.patch"
 ${PREFIX} mycp ".././dist/PathTools/lib/File/Spec/Unix.pm" ".././dist/PathTools/lib/File/Spec/Unix.pm.org"
 ${PREFIX} patch ".././dist/PathTools/lib/File/Spec/Unix.pm" "file-spec-unix.pm.patch"

echo 
echo "*** Patch: no-sudo.patch"
 ${PREFIX} mycp "../cpan/CPAN/lib/CPAN/FirstTime.pm" "../cpan/CPAN/lib/CPAN/FirstTime.pm.org"
 ${PREFIX} patch "../cpan/CPAN/lib/CPAN/FirstTime.pm" "no-sudo.patch"

echo 
echo "*** Patch: perlio.c.patch"
 ${PREFIX} mycp ".././perlio.c" ".././perlio.c.org"
 ${PREFIX} patch ".././perlio.c" "perlio.c.patch"

