the Fink project is an effort to port
popular Unix programs to Mac OS X
Info2: <<
Package: ann-oct305
Version: 1.0.2
Type: oct (3.0.5), forge (ann), gcc (4.6)
Revision: 4
Maintainer: Alexander Hansen
# unfortunately, Homepage won't do types
Homepage: http://octave.sourceforge.net/
Description: Wrapper to the ANN library for Octave
DescDetail: <<
The Octave-forge ANN package wraps the ANN library, which provides data
structures and functions for computing exact and approximate nearest neighbors
on an arbitrarily high dimensional point set.
<<
License: GPL2
# All octave-forge packages have to have the following BuildDepends:
# liboctave%type_pkg[oct]-gcc%type_pkg[gcc]-dev,
# fftw3,
# ( %type_pkg[oct] = 305 ) hdf5.7-oldapi,
# ( %type_pkg[oct] != 305 ) hdf5.7
#
# Packages which serve only Octave-3.0.5 or only Octave > 3.0.5 need
# not use the conditional, of course.
BuildDepends: <<
liboctave%type_pkg[oct]-gcc%type_pkg[gcc]-dev,
fftw3,
( %type_pkg[oct] = 305 ) hdf5.7-oldapi,
( %type_pkg[oct] != 305 ) hdf5.7
<<
Depends: <<
octave%type_pkg[oct]-interpreter,
gcc%type_pkg[gcc]-shlibs
<<
Conflicts: octave-forge
Source-MD5: 3b383fdec459cf4f66c221e7b698aab0
#### Insert required changes here ####
PatchFile: %{ni}.patch
PatchFile-MD5: a9ca472ae5f690929f403b7de7fa443b
PatchScript: <<
%{default_script}
perl -pi -e 's|\$\(MAKELIB\)|ar rcv|' src/%type_pkg[forge]/src/Makefile
<<
######################################
# Do not change anything from this point down, unless absolutely necessary,
# since the foo-oct%type_pkg[oct] packages are designed to be built/installed
# in the same way.
Source: mirror:sourceforge:octave/%type_raw[forge]-%v.tar.gz
NoSetCPPFLAGS: true
NoSetLDFLAGS: true
SetLIBRARY_PATH: /usr/X11R6/lib:%p/lib
UseMaxBuildJobs: false
BuildAsNobody: false
CompileScript: <<
#!/bin/sh -ev
if [ $UID -ne 0 ]
then
echo "%n cannot be built with --build-as-nobody"
exit 1
fi
export OCTAVE=%p/bin/octave-%type_raw[oct]
%p/share/octave/%type_raw[oct]/scripts/octave-forge-compile.sh %type_raw[forge]-%v
<<
InstallScript: <<
#!/bin/sh -ev
%p/share/octave/%type_raw[oct]/scripts/octave-forge-install.sh %type_raw[forge]-%v %i %b
mkdir -p %i/share/octave/%type_raw[oct]/%type_raw[forge]-%v
# copy template scripts
cp %p/share/octave/%type_raw[oct]/scripts/octave-forge-prerm %p/share/octave/%type_raw[oct]/scripts/octave-forge-postinst %i/share/octave/%type_raw[oct]/%type_raw[forge]-%v
cd %i/share/octave/%type_raw[oct]/%type_raw[forge]-%v
sed -i -e 's/@PKGNAME@/%type_raw[forge]-%v/' octave-forge-postinst
sed -i -e 's/@PKGNAME@/%type_raw[forge]/' octave-forge-prerm
chmod a+x octave-forge*
<<
PostInstScript: <<
if [ -s %p/var/octave/%type_raw[oct]/octave_packages ] && [ -f %p/var/octave/%type_raw[oct]/octave_packages ]
then
%p/share/octave/%type_raw[oct]/%type_raw[forge]-%v/octave-forge-postinst
else
mv %p/share/octave/%type_raw[oct]/packages/%type_raw[forge]-%v/octave_packages %p/var/octave/%type_raw[oct]/octave_packages
fi
<<
PreRmScript: %p/share/octave/%type_raw[oct]/%type_raw[forge]-%v/octave-forge-prerm
DescPackaging: <<
This package:
Rolls its own ANN (1.1.1) library. There's a newer upstream version (1.1.2),
but this package wants stuff that doesn't exist in that version.
ann_wrap.cpp seems to need explicit #includes pointing to the ANN headers, so
we patch those in.
For some reason when this package reads AR from octave_config_info, it gets
mangled so that the system doesn't want to execute it. We simply patch
%b/src/ann/src/Makefile just to use "ar -crv" directly.
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.
<<
<<
diff -Nurd ann-1.0.2/src/ann/bindings/ann_wrap.cpp ann-1.0.2.patched/src/ann/bindings/ann_wrap.cpp
--- ann-1.0.2/src/ann/bindings/ann_wrap.cpp 2009-05-08 09:18:07.000000000 -0400
+++ ann-1.0.2.patched/src/ann/bindings/ann_wrap.cpp 2011-09-23 16:21:57.000000000 -0400
@@ -7,6 +7,10 @@
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
+#include "../include/ANN/ANN.h"
+#include "../include/ANN/ANNperf.h"
+#include "../include/ANN/ANNx.h"
+
#define SWIGOCTAVE
#define SWIG_name_d "ann"