Skip to content

Commit

Permalink
Remove platform restrictions, fix build on SunOS.
Browse files Browse the repository at this point in the history
  • Loading branch information
fhajny committed Sep 30, 2014
1 parent 3db8296 commit 5a59821
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 8 deletions.
21 changes: 13 additions & 8 deletions ann/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@
#

DISTNAME= ann_1.1.2
PKGNAME= ann-1.1.2
PKGNAME= ${DISTNAME:S/_/-/}
CATEGORIES= math
MASTER_SITES= http://www.cs.umd.edu/~mount/ANN/Files/1.1.2/
MASTER_SITES= http://www.cs.umd.edu/~mount/ANN/Files/${PKGVERSION_NOREV}/

MAINTAINER= jihbed.research@gmail.com
HOMEPAGE= http://www.cs.umd.edu/~mount/ANN
COMMENT= Library for Approximate Nearest Neighbor Searching
LICENSE= gnu-lgpl-v2.1

USE_TOOLS+= gmake pax
USE_LANGUAGES= c++
USE_TOOLS+= gmake pax
USE_LANGUAGES= c c++

INSTALLATION_DIRS= bin lib share/doc/ann
.include "../../mk/bsd.prefs.mk"

ONLY_FOR_PLATFORM= NetBSD-*-* Linux-*-*
.if ${OPSYS} == "SunOS"
BUILD_TARGET= sunos5-g++
.elif ${OPSYS} == "Darwin"
BUILD_TARGET= macosx-g++
.else
BUILD_TARGET= linux-g++
.endif

do-build:
cd ${WRKSRC} && ${GMAKE} linux-g++
INSTALLATION_DIRS= bin lib share/doc/ann

do-install:
${INSTALL_PROGRAM} ${WRKSRC}/bin/ann2fig ${DESTDIR}${PREFIX}/bin/
Expand Down
2 changes: 2 additions & 0 deletions ann/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ $NetBSD$
SHA1 (ann_1.1.2.tar.gz) = 27ec04d55e244380ade3706a9b71c3d631e2ff1a
RMD160 (ann_1.1.2.tar.gz) = 1b76b2f5c25c83c6d52a1a1e19e5b058ccf929d0
Size (ann_1.1.2.tar.gz) = 590517 bytes
SHA1 (patch-src_kd__split.cpp) = 9048954f70e93f14628ea6a5d6126304ab022af7
SHA1 (patch-test_ann__test.cpp) = a19ced3772c6576d28c0eeaf8ad7c3a9b4eb7770
32 changes: 32 additions & 0 deletions ann/patches/patch-src_kd__split.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
$NetBSD$

Rename reserved symbol.
--- src/kd_split.cpp.orig 2010-01-28 04:40:01.000000000 +0000
+++ src/kd_split.cpp
@@ -31,7 +31,7 @@
// Constants
//----------------------------------------------------------------------

-const double ERR = 0.001; // a small value
+const double ANN_ERR = 0.001; // a small value
const double FS_ASPECT_RATIO = 3.0; // maximum allowed aspect ratio
// in fair split. Must be >= 2.

@@ -95,7 +95,7 @@ void midpt_split(
ANNcoord max_spread = -1; // find long side with most spread
for (d = 0; d < dim; d++) {
// is it among longest?
- if (double(bnds.hi[d] - bnds.lo[d]) >= (1-ERR)*max_length) {
+ if (double(bnds.hi[d] - bnds.lo[d]) >= (1-ANN_ERR)*max_length) {
// compute its spread
ANNcoord spr = annSpread(pa, pidx, n, d);
if (spr > max_spread) { // is it max so far?
@@ -165,7 +165,7 @@ void sl_midpt_split(
ANNcoord max_spread = -1; // find long side with most spread
for (d = 0; d < dim; d++) {
// is it among longest?
- if ((bnds.hi[d] - bnds.lo[d]) >= (1-ERR)*max_length) {
+ if ((bnds.hi[d] - bnds.lo[d]) >= (1-ANN_ERR)*max_length) {
// compute its spread
ANNcoord spr = annSpread(pa, pidx, n, d);
if (spr > max_spread) { // is it max so far?
23 changes: 23 additions & 0 deletions ann/patches/patch-test_ann__test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
$NetBSD$

Rename reserved symbol.
--- test/ann_test.cpp.orig 2010-01-28 04:40:01.000000000 +0000
+++ test/ann_test.cpp
@@ -281,7 +281,7 @@ using namespace std; // make std:: a
//------------------------------------------------------------------------

const int STRING_LEN = 500; // max string length
-const double ERR = 0.00001; // epsilon (for float compares)
+const double ANN_ERR = 0.00001; // epsilon (for float compares)
const double RND_OFF = 5E-16; // double round-off error

//------------------------------------------------------------------------
@@ -1502,7 +1502,7 @@ void doValidation() // perform vali
// reported i-th smallest
double rept_dist = ANN_ROOT(curr_apx_dst[j]);
// better than optimum?
- if (rept_dist < true_dist*(1-ERR)) {
+ if (rept_dist < true_dist*(1-ANN_ERR)) {
Error("INTERNAL ERROR: True nearest neighbor incorrect",
ANNabort);
}

0 comments on commit 5a59821

Please sign in to comment.