Building PDL with it’s own perl

Everything to sit in /Applications/PDL/…

1) Build perl 5.22

[perl-5.22.1] % ./Configure -de -Dprefix=/Applications/PDL

make
make test
sudo make install

- All OK!

(Perl built on OS X 10.10, works fine on 10.9 & 10.11! Does not work on 10.7)

2) Installed EU::F77 v1.19

3) Reinstalled libpng 

(v1.2.8) into /usr/local and removed dynamic files

4) Ditto zlib

5) pgplot in to /Applications/PDL/pgplot

- Use gfortran_gcc.conf in sys_darwin
- edit src/grgfil.f to swap /usr/local/pgplot to /Applications/PDL/pgplot
- use hacked version of xwdriv.c to look in /Applications/PDL/pgplot for pgxwin_server

(note hacked files including makefile in pgplot_hacks/ directory)

cd /usr/local/include
cp png.h pngconf.h zconf.h zlib.h /Applications/PDL/pgplot
cd /Applications/PDL/pgplot
/Users/karl/Dropbox/Software/SciPDL-Yosemite/tmp/pgplotsrc/makemake /Users/karl/Dropbox/Software/SciPDL-Yosemite/tmp/pgplotsrc darwin gfortran_gcc

- Edit makefile to remove libpgplot.so build (.so no longer works for dynamic anyway), also replace -lpng with -lpng12 to make sure it links with the write (non-system) version. 

(Note the GIF and PPM drivers do not appear to work, for a while - went through and weeded out old and bad drivers!).

6) Installed Astro-FITS-CFITSIO-1.10 and Astro-FITS-Header-3.07
(latter required Module::Build which I installed with cpan shell)

7) Install Term-ReadLine-Gnu module

(I prefer this over Term::ReadLine::Perl)

First I build GNU libreadline v5.1 statically but do not install it - to make sure I do not screw up the system version with the same name:

./configure --prefix=/Users/karl/Downloads/tmp1
make
make install-static

(this installs in to /Users/kgb/Downloads/tmp1)

Then I build/install Term-ReadLine-Gnu v1.28

perl Makefile.PL  --includedir=/Users/karl/Downloads/tmp1/include --libdir=/Users/karl/Downloads/tmp1/lib
make
make test
make install

8) Misc perl modules installed with CPAN (so including prerequisites) needed by PDL:
Parse-RecDescent-1.967013
Inline-0.80
Devel-CheckLib-1.05
Convert-UU
File-Map-0.64
Inline-C-0.76
Module-Compile-0.35
Test-Deep-1.120
Test-Exception-0.43

9)  Install numerical/astro libs

Install GSL  v1.16

./configure --disable-shared prefix=/Applications/PDL
make
make check.
make install

(Note v1.16 is the last v1.x version, versions >=2 give PDL compilation errors)

Install cfitsio v3.03

./configure prefix=/Applications/PDL
make
# Run test progs
sudo make install

10)  Install PDL 2.015

perl Makefile.PL --libdir=/Applications/PDL/lib --includedir=/Applications/PDL/include
make
make test
make install

alternate test run:
/Applications/PDL/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t

10)  Install PDL::FFTW3

Install FFTW v3.3.4: 

(Beware IRAF may interfere with this -e.g. it sets the F77 environment variable)

setenv F77 gfortran  
./configure prefix=/Applications/PDL
make
make check.
make install

Then rinse and repeating adding --enable-single to configure to get the single precision library too!

Edit Makefile.PL of PDL::FFTW3 to remove Alien::FFTW3 and pkg-config stuff and just point it to /Applications/PDL/lib
Key lines:

$libs = "-L/Applications/PDL/lib -lfftw3 -lfftw3f";
$descriptor{INC} .= "-I/Applications/PDL/include";

(An alternative technique would be to use Alien::FFTW3 but that would require me to install pig-config and teach it about looking in /Applications/PDL/lib…)

Helper Apps 

“pdl [here]” and “pdl [home]” are Applescripts to open PDL in terminal in current Finder Window / home directory

Note after replacing the default “applet.icns” file in each bundle, need to resign to avoid getting “damaged” errors:

[~] % codesign -f -s "Karl Glazebrook" /Applications/PDL/pdl\ \[here\].app 
/Applications/PDL/pdl [here].app: replacing existing signature
[~] % codesign -f -s "Karl Glazebrook" /Applications/PDL/pdl\ \[home\].app 
/Applications/PDL/pdl [home].app: replacing existing signature
[~] % 

(as per hint at http://apple.stackexchange.com/questions/158861/how-to-set-a-custom-icon-inside-a-signed-apple-script-application)

hope this works!

Making the DMG

Use the ‘DMG Background’  pic.

Do everything using the shell script

go_dmg

This runs the utility create-dmg with the right parameters. (This comes from https://github.com/andreyvit/create-dmg)

Note the folder /Users/karl/SciPDL-dist is created as a working directory.