Package: fpprofiler
Version: 20110108
Revision: 7
Description: Profiler for the FreePascal compiler
Source: mirror:sourceforge:fink/%n-%v.tar.bz2
Source-Checksum: SHA256(2bb52d973c3b667e544f272ad0ac8198addd36e8e894d249711f2058f8acea1d)
Depends: fpc (>= 3.0.2)
Recommends: graphviz, fpprofiler-cross
License: GPL

PatchScript: <<
#!/bin/sh -ev
  sed -i.bak 's|FPCallGraph;|FPCallGraph; {$mode objfpc}{$H+}|g' fppview/fpcallgraph.pas
  sed -i.bak 's|{$R \*\.res}||g' fpp/fppremove.pp
  cd fcl-passrc/src/
  patch pscanner.pp ../../patch/pscanner.diff
<<

UseMaxBuildJobs: false

CompileScript: <<
#!/bin/sh -ev

# Yosemite fix
  if [ "$(uname -r | cut -d. -f1)" -ge 14 ]; then export MACOSX_DEPLOYMENT_TARGET=10.9 ; fi

  cd fcl-passrc
  make
  cd ../fpp
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fpp.pp
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fppinsert.pp
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fppremove.pp
  cd ../fppview
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fppview.pp
  cd ../fpprof
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fpprof.pp
<<

InfoTest: <<
  TestScript: <<
    #!/bin/sh -ev
    cd test
# patch the sources
    sed -i.bak 's|runtests;|runtests; {$mode objfpc}{$H+}|g' runtests.pp
    sed -i.bak 's|Crt,|Crt|g'     runtests.pp
    sed -i.bak 's|FileUtil||g'    runtests.pp
    sed -i.bak "s|GetExeExt|''|g" runtests.pp
    sed -i.bak "s|Readln;||g"     runtests.pp
    sed -i.bak "s|fpp |./fpp |g"  runtests.pp
# compile the "master runner".
    fpc runtests.pp
# copy fpp from where it has been built.
    cp ../fpp/fpp .
# run the test.
    ./runtests >runtest.log
#
# Results for each test. All should be TRUE.
#
    grep -i true runtest.log
  <<
  TestSuiteSize: small
<<

InstallScript: <<
#!/bin/sh -ev
# Yosemite fix
  if [ "$(uname -r | cut -d. -f1)" -ge 14 ]; then export MACOSX_DEPLOYMENT_TARGET=10.9 ; fi

  FPC_VERSION=`fpc -iV`
  mkdir -p %i/bin
  install -m 755 fpp/fpp         %i/bin/fpp
  install -m 755 fpp/fppinsert   %i/bin/fppinsert
  install -m 755 fpp/fppremove   %i/bin/fppremove
  install -m 755 fppview/fppview %i/bin/fppview
  mkdir -p           %i/lib/fpc/$FPC_VERSION/units/%m-darwin/fpprof
  cp -r fpprof/*.ppu %i/lib/fpc/$FPC_VERSION/units/%m-darwin/fpprof
  cp -r fpprof/*.o   %i/lib/fpc/$FPC_VERSION/units/%m-darwin/fpprof
<<

DocFiles: docs/COPYING.GPL docs/develop.txt

DescDetail: <<
Compile your program by using fpp as a replacement of fpc. 
This creates a profile file (Default: fpprof.xml), 
from which fppview creates output. Output in the dot language 
can be converted to a graph with the program "dot" from the 
package "graphviz".

More details about options can be obtained with
  fpp -h
and
  fppview -h

Usage Example:

  fpp MyProgram.pp
  fppview --format=graphviz --stat=callgraph >MyProgram.dot
  dot -Tpng MyProgram.dot -o MyProgram.png
  open MyProgram.png

Please check also the home page: http://wiki.lazarus.freepascal.org/FPProfiler
<<

DescPort: <<
  Note: This package installs fpc units and needs to be updated
  with a new version of fpc.

  The following is needed for building without -m. Easy to overlook!
  cd ../fpprof
  fpc -Fu../fpprof -Fu../fcl-passrc/units/* fpprof.pp

<<

Homepage: http://wiki.lazarus.freepascal.org/FPProfiler
Maintainer: Karl-Michael Schindler <karl-michael.schindler@web.de>