# fss-0002
# Note: on foreign systems, I had to manually compile perl "make" to avoid a segmentation fault
# to manually do this I had to export PATH=${TO}bin and export LD_LIBRARY_PATH=${TO}lib in a self-contained terminal
# once perl was compiled, I copied over the appropriate files and skipped the perl installation step in the installer
# I added "PATH=${TO}bin LD_LIBRARY_PATH=${TO}lib" to the configure and make lines in an attempt to automate this manual change
#
# -fstack-protector is causing perl to fail to compile

main:
  sed -i -e "s|/lib/libc.so.6|${TO}lib/libc.so.0|g" hints/linux.sh
  sed -i -e "s|\$file{'/usr/include/errno.h'} = 1;|\$file{'${TO}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 '${TO}include/errno.h' ?|" ext/Errno/Errno_pm.PL
  sed -i -e "s|'/usr/include/errno.h' : '/usr/local/include/errno.h';|'${TO}include/errno.h' : '/usr/local/include/errno.h';|" ext/Errno/Errno_pm.PL
  sed -i -e 's|\-fstack-protector||g' Configure Porting/config.sh
  ./Configure -des -Dprefix=$TO -Dstatic_ext='Data/Dumper Fcntl IO' -Uoptimize="$CFLAGS" -Doptimize="$CFLAGS" -Dbinexp="${TO}bin" -Dloclibpth="${TO}lib" -Dlocincpth="${TO}include" -Uusemymalloc -Dusethreads="n" PATH=${TO}bin LD_LIBRARY_PATH=${TO}lib
  if [[ $glibc_host == "yes" ]] ; then make PATH=${TO}bin LD_LIBRARY_PATH=${TO}lib OPTIMIZE="" ; else make OPTIMIZE="" ; fi
  if [[ $glibc_host == "yes" ]] ; then make PATH=${TO}bin LD_LIBRARY_PATH=${TO}lib OPTIMIZE="" install ; else make OPTIMIZE="" install ; fi
