Info2: <<
Package: tsa-oct%type_pkg[oct]
Version: 4.2.7
Type: oct (3.8.2), forge (tsa), gcc (5)
Revision: 2

Maintainer: Alexander Hansen <alexkhansen@users.sourceforge.net>
# unfortunately, Homepage won't do types
Homepage:  http://octave.sourceforge.net/tsa/index.html 
Description: Time series analysis package for Octave
DescDetail: <<
The package contains functions utilizing stochastic concepts and maximum
entropy methods for time series analysis.

It provides the following additional functions:
Univariate (stationary) analysis:
        acovf
        acorf
        biacovf
        bispec
        durlev
        lattice
        rmle
        pacf
        parcor
        invest0
        invest1
        selmo
        selmo2
        histo
        histo2
        histo3
        hup
        ucp
        y2res
        ar_spa
        detrend
        flix
Multivariate stationary analysis:
        mvar
        mvfilter
        mvfreqz
        arfit2
        histo4
Adaptive (time-varying) analysis:
        aar
        aarmam
        adim
        amarma
        mvaar
Conversions between forms:
        ac2poly
        ac2rc
        ar2rc
        rc2ar
        poly2ac
        poly2ar
        poly2rc
        rc2ac
        rc2poly
        ar2poly
Utility functions:
        arcext
        sinvest1
        sbispec
        flag_implicit_samplerate
Test suites:
        tsademo
        bisdemo
        invfdemo
<<
License: GPL3+

BuildDepends: <<
  liboctave%type_pkg[oct]-dev,
  fink-octave-scripts (>= 0.3.0-1),
  gcc%type_pkg[gcc]-compiler,
  fftw3,
  hdf5.9
<<
Depends: octave%type_pkg[oct]-interpreter
Conflicts: octave-forge, octave-forge-%type_raw[forge] (<< 4.0.0-999)
Replaces: octave-forge-%type_raw[forge] (<< 4.0.0-999)	

Source: mirror:sourceforge:octave/%type_raw[forge]-%v.tar.gz
Source-Checksum: SHA256(48c22265ed0962c09ef7c1777628afc5d9a206089c674b7b9727a0c5a545b229)
SourceDirectory: %type_pkg[forge]

PatchFile: %{Ni}.patch
PatchFile-MD5: 925ad2f68465df508014b144e1fca31c

PatchScript: <<
	#!/bin/sh -ev
	sed 	-e 's|@FINKPREFIX@|%p|g' \
			-e 's|@GCC@|%type_raw[gcc]|g' \
				%{PatchFile} | patch -p1
	# create temporary oct-cc and oct-cxx scripts pointing to gcc4x
	mkdir bin
	ln -s %p/bin/gcc-fsf-%type_raw[gcc] bin/oct-cc 
	ln -s %p/bin/g++-fsf-%type_raw[gcc] bin/oct-cxx
	chmod a+x bin/oct*
	export PATH="%b/bin:$PATH"
	perl -pi -e 's,(-lgomp),-L%p/lib/gcc%type_raw[gcc]/lib \1,g' src/Makefile
	# Use tweaked header to allow use of gcc49.
	perl -p -e 's/#include "mexproto.h"//' %p/include/octave-%type_raw[oct]/octave/mex.h > src/mex.h
	perl -pi -e "s/(extern \"C\")/#include \"mexproto.h\"\n\1/" src/mex.h
<<

NoSetCPPFLAGS: true
NoSetLDFLAGS: true
UseMaxBuildJobs: false
BuildAsNobody: false

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

export PATH="%b/bin:$PATH"

pkgsrc=%type_raw[forge]
%p/share/fink-octave-scripts/octave-forge-patch.sh %type_raw[forge] %v %type_raw[oct] %b %i $pkgsrc
./octave-forge-compile.sh
<<

InstallScript: ./octave-forge-install.sh
PostInstScript:  %p/share/octave/%type_raw[oct]/%type_raw[forge]/octave-forge-postinst.sh
PreRmScript: %p/share/octave/%type_raw[oct]/%type_raw[forge]/octave-forge-prerm.sh

DescPackaging: <<
This package:
Wants libgomp, so we'll use that from gcc49.  
Use a local copy of the header to avoid the following build failure:

/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib: In function 'long long int std::abs(long long int)':
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:174:20: error: declaration of C function 'long long int std::abs(long long int)' conflicts with
   abs(long long __x) { return __builtin_llabs (__x); }
                    ^
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:166:3: error: previous declaration 'long int std::abs(long int)' here
   abs(long __i) { return __builtin_labs(__i); }
   ^
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib: In function '__int128 std::abs(__int128)':
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:179:19: error: declaration of C function '__int128 std::abs(__int128)' conflicts with
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
                   ^
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:174:3: error: previous declaration 'long long int std::abs(long long int)' here
   abs(long long __x) { return __builtin_llabs (__x); }
   ^
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:179:19: error: declaration of C function '__int128 std::abs(__int128)' conflicts with
   abs(__int128 __x) { return __x >= 0 ? __x : -__x; }
                   ^
/sw/lib/gcc4.8/include/c++/4.8.0/cstdlib:166:3: error: previous declaration 'long int std::abs(long int)' here
   abs(long __i) { return __builtin_labs(__i); }

Common for all octave-forge packages:
We read in postinst and prerm template scripts installed by octaveN and modify
them to use the name of this package because Octave's package manager can't 
cope with non-literal arguments.

The Type: forge (pkgname) is used to minimize what needs to be changed when
using this .info file as a template.
<<
DescPort: <<
Clean out mex files for Windows which were included for some reason.
<<
<<