# fss-0002

main:
  sed -i -e "s|/lib/libc.so.6|/lib/libc.so.0|g" hints/linux.sh
  sed -i -e "s|\$file{'/usr/include/errno.h'} = 1;|\$file{'${TC}include/errno.h'} = 1;|" ext/Errno/Errno_pm.PL
  sed -i -e "s|my \$linux_errno_h = -e '/usr/include/errno.h' ?|my \$linux_errno_h = -e '${TC}include/errno.h' ?|" ext/Errno/Errno_pm.PL
  sed -i -e "s|'/usr/include/errno.h' : '/usr/local/include/errno.h';|'${TC}include/errno.h' : '/usr/local/include/errno.h';|" ext/Errno/Errno_pm.PL
  ./configure.gnu --prefix=/ -Duseshrplib="true" -Dstatic_ext='Data/Dumper IO Fcntl POSIX' -Dpager="less -isR" -Uoptimize="$CFLAGS" -Doptimize="$CFLAGS" -Dbinexp="/bin" -Dloclibpth="/lib" -Dlocincpth="${TC}include" -Uusemymalloc -Dusethreads="y"
  sed -i -e '/<command-line>/d' makefile */{m,M}akefile
  make OPTIMIZE="" depend
  sed -i -e '/<command-line>/d' makefile */{m,M}akefile
  make OPTIMIZE=""
  make install
  cp -v libperl.so /lib/
  chgrp e_perl -R /bin/perl /bin/{cpanp,cpanp-run-perl,cpan,cpan2dist,shasum,ptar,ptardiff,c2ph,dprofpp,enc2xs,find2perl,h2ph,h2xs,instmodsh,libnetcfg,piconv,pl2pm,pod2*,pod*,prove,psed,splain,pstruct,s2p,xsubpp,a2p} /bin/perl{,ivp} /lib/perl5 /lib/libperl.so
  chgrp e_perl /bin/cpan
  chmod o-rx -R /bin/perl /bin/{cpanp,cpanp-run-perl,cpan,cpan2dist,shasum,ptar,ptardiff,c2ph,dprofpp,enc2xs,find2perl,h2ph,h2xs,instmodsh,libnetcfg,piconv,pl2pm,pod2*,pod*,prove,psed,splain,pstruct,s2p,xsubpp,a2p} /bin/perl{,ivp} /lib/perl5 /lib/libperl.so
  chmod o-rx /bin/cpan
  mv -v /bin/{config_data,corelist} ${TC}bin/
  rm -Rf /bin/perl{$version,bug,doc,thanks}

# This is for removing perl from the system while still maintaining the legacy build systems like make and autoconf
toolchain:
  sed -i -e "s|/lib/libc.so.6|/lib/libc.so.0|g" hints/linux.sh
  sed -i -e "s|\$file{'/usr/include/errno.h'} = 1;|\$file{'${TC}include/errno.h'} = 1;|" ext/Errno/Errno_pm.PL
  sed -i -e "s|my \$linux_errno_h = -e '/usr/include/errno.h' ?|my \$linux_errno_h = -e '${TC}include/errno.h' ?|" ext/Errno/Errno_pm.PL
  sed -i -e "s|'/usr/include/errno.h' : '/usr/local/include/errno.h';|'${TC}include/errno.h' : '/usr/local/include/errno.h';|" ext/Errno/Errno_pm.PL
  ./configure.gnu --prefix=/toolchain/ -Duseshrplib="true" -Dstatic_ext='Data/Dumper IO Fcntl POSIX' -Dpager="less -isR" -Uoptimize="$CFLAGS" -Doptimize="$CFLAGS" -Dbinexp="/bin" -Dloclibpth="/lib" -Dlocincpth="${TC}include" -Uusemymalloc -Dusethreads="y"
  sed -i -e '/<command-line>/d' makefile */{m,M}akefile
  make OPTIMIZE="" depend
  sed -i -e '/<command-line>/d' makefile */{m,M}akefile
  make OPTIMIZE=""
  make install
  cp -v libperl.so ${TC}lib/
  rm -Rf ${TC}bin/perl{$version,bug,doc}
