Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 298564 - [EBUILD] sci-astronomy/AA+ library
Summary: [EBUILD] sci-astronomy/AA+ library
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Default Assignee for New Packages
URL: http://www.naughter.com/aa.html
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-12-27 17:43 UTC by Hugo Mildenberger
Modified: 2011-08-06 18:45 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix some compilation warnings (fix-AATest.cpp-printf-format-warnings.patch,3.33 KB, patch)
2009-12-27 17:50 UTC, Hugo Mildenberger
Details | Diff
add an install target to CMakeList.txt (add-install-target.patch,703 bytes, patch)
2009-12-27 17:52 UTC, Hugo Mildenberger
Details | Diff
Output of AA+-1.39 test program (test.output,728 bytes, text/plain)
2009-12-27 17:55 UTC, Hugo Mildenberger
Details
AA+ ebuild (AA+-1.39.ebuild,789 bytes, text/plain)
2009-12-27 17:57 UTC, Hugo Mildenberger
Details
Revised version of AA+-1.39.ebuild (AA+-1.39.ebuild,1.11 KB, text/plain)
2009-12-29 15:04 UTC, Hugo Mildenberger
Details
Copyright and license for AA+ library (AA+-1.39-license,632 bytes, text/plain)
2009-12-29 15:09 UTC, Hugo Mildenberger
Details
Replacement for a/ 214329: add an install target to CMakeList.txt (AA+-1.39-add-install-and-test-target.patch,2.23 KB, patch)
2009-12-29 15:12 UTC, Hugo Mildenberger
Details | Diff
Renamed, but else identical version of a/ 214328: Fix some compilation warnings (AA+-1.39-fix-AATest.cpp-printf-format-warnings.patch,3.33 KB, patch)
2009-12-29 15:16 UTC, Hugo Mildenberger
Details | Diff
Output of AATest program as in a/ 214330, in patch format (AA+-1.39-Test.output.patch,933 bytes, patch)
2009-12-29 15:21 UTC, Hugo Mildenberger
Details | Diff
Test driver, supporting make test or "FEATURE=test" (AA+-1.39-compare-with-previous-output.sh.patch,305 bytes, patch)
2009-12-29 15:26 UTC, Hugo Mildenberger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hugo Mildenberger 2009-12-27 17:43:04 UTC
AA+ is widely regarded as a reference implementation of Jean Meeus' "Astronomical Algorithms" (see: http://en.wikipedia.org/wiki/Jean_Meeus)

The only major problem with this ebuild is that the author of the AA+ library says he can't afford the time for also providing a source archive containing a revision number. But he proposed that file could be hosted somewhere else, provided the site would include a reference to his distribution page named above.

The ebuild was tested on hardened ~x68 and ~amd64. It provides both a static and shared library and supports FEATURES=test. 


# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
inherit base cmake-utils

DESCRIPTION="A class framework for Computational Astronomy based on
Jean Meeus' Astronomical Algorithms"
HOMEPAGE="http://www.naughter.com/aa.html"
SRC_URI="http://www.naughter.com/download/aaplus.zip"

SLOT="0"
LICENSE="GPL-3"
KEYWORDS="~x86 ~amd64"
IUSE=""
DEPEND=""
PATCHES=("${FILESDIR}/${PV}/*.patch")

src_unpack() {
	mkdir "${S}" && cd "${S}" && unpack ${A} || die
}

src_test() {
	local my_program="${CMAKE_BUILD_DIR}/bin/Test"
	local my_reference="${FILESDIR}/${PV}/test.output"
	ebegin   "Comparing output of ${my_program} with ${my_reference}"\
		  && "${my_program}" | diff -u  "${my_reference}" - \
		  && eend  || die
}
Comment 1 Hugo Mildenberger 2009-12-27 17:44:29 UTC
--- CMakeLists.txt.orig	2006-11-29 14:57:06.000000000 +0100
+++ CMakeLists.txt	2009-12-27 18:39:20.319176165 +0100
@@ -146,7 +146,14 @@
 
 #-----------------------------------------------------------------------------
 # Libraries.
-ADD_LIBRARY(aaplus ${SRCS_LIB} ${INCS})
+ADD_LIBRARY(aaplus-static STATIC ${SRCS_LIB} ${INCS})
+SET_TARGET_PROPERTIES(aaplus-static PROPERTIES OUTPUT_NAME "aaplus")
 
-TARGET_LINK_LIBRARIES(Test aaplus)
+ADD_LIBRARY(aaplus-shared SHARED ${SRCS_LIB} ${INCS})
+SET_TARGET_PROPERTIES(aaplus-shared PROPERTIES OUTPUT_NAME "aaplus")
+
+install(TARGETS aaplus-shared aaplus-static 
+		DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
+
+TARGET_LINK_LIBRARIES(Test aaplus-static)
 
Comment 2 Hugo Mildenberger 2009-12-27 17:45:48 UTC
--- AATest.cpp.orig	2009-11-24 17:37:52.000000000 +0100
+++ AATest.cpp	2009-12-27 14:31:27.000000000 +0100
@@ -680,19 +680,19 @@
     long Minutes;
     double Sec;
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Venus rise for Boston for UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Venus rise for Boston for UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
     double transitJD = (JD2 + (RiseTransitSetTime.Transit / 24.00));
     rtsDate = CAADate(transitJD, true);
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Venus transit for Boston for UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Venus transit for Boston for UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
     double setJD = (JD2 + (RiseTransitSetTime.Set / 24.00));
     rtsDate = CAADate(setJD, true);
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Venus set for Boston UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Venus set for Boston UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
   }
   else
   {
-    printf("Venus does not rise, transit or set for Boston for UTC %d/%d/%d\n", Year, Month, Day);
+    printf("Venus does not rise, transit or set for Boston for UTC %ld/%ld/%ld\n", Year, Month, Day);
   }
 
   
@@ -716,19 +716,19 @@
     long Minutes;
     double Sec;
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Moon rise for Palamor Observatory for UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Moon rise for Palamor Observatory for UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
     double transitJD = (JD2 + (RiseTransitSetTime.Transit / 24.00));
     rtsDate = CAADate(transitJD, true);
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Moon transit for Palamor Observatory for UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Moon transit for Palamor Observatory for UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
     double setJD = (JD2 + (RiseTransitSetTime.Set / 24.00));
     rtsDate = CAADate(setJD, true);
     rtsDate.Get(Year, Month, Day, Hours, Minutes, Sec);
-    printf("Moon set for Palamor Observatory for UTC %d/%d/%d occurs at %02d:%02d:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
+    printf("Moon set for Palamor Observatory for UTC %ld/%ld/%ld occurs at %02ld:%02ld:%02d\n", Year, Month, Day, Hours, Minutes, static_cast<int>(Sec));
   }
   else
   {
-    printf("Moon for Palamor Observatory does not rise, transit or set for UTC %d/%d/%d\n", Year, Month, Day);
+    printf("Moon for Palamor Observatory does not rise, transit or set for UTC %ld/%ld/%ld\n", Year, Month, Day);
   }
 
   double Kpp = CAAPlanetaryPhenomena::K(1993.75, CAAPlanetaryPhenomena::MERCURY, CAAPlanetaryPhenomena::INFERIOR_CONJUNCTION);
Comment 3 Hugo Mildenberger 2009-12-27 17:48:27 UTC
This is the output of the Test program, used for a simple regression test, to be placed into test.output:

Doing date tests on year -4000
Doing date tests on year -3000
Doing date tests on year -2000
Doing date tests on year -1000
Doing date tests on year 0
Doing date tests on year 1000
Julian Day monotonic bug with date 1582/10/15
Doing date tests on year 2000
Doing date tests on year 3000
Doing date tests on year 4000
Date tests completed
Venus rise for Boston for UTC 1988/3/20 occurs at 12:25:25
Venus transit for Boston for UTC 1988/3/20 occurs at 19:40:30
Venus set for Boston UTC 1988/3/20 occurs at 02:54:39
Moon rise for Palamor Observatory for UTC 2009/8/11 occurs at 04:53:21
Moon transit for Palamor Observatory for UTC 2009/8/11 occurs at 11:35:39
Moon set for Palamor Observatory for UTC 2009/8/11 occurs at 18:26:22
 
Comment 4 Hugo Mildenberger 2009-12-27 17:50:48 UTC
Created attachment 214328 [details, diff]
Fix some compilation warnings 

The contents of this file was already listed above
Comment 5 Hugo Mildenberger 2009-12-27 17:52:59 UTC
Created attachment 214329 [details, diff]
add an install target to CMakeList.txt

The contents of this file was already listed above, also attached for convenience
Comment 6 Hugo Mildenberger 2009-12-27 17:55:11 UTC
Created attachment 214330 [details]
Output of AA+-1.39 test program

The contents of this file was already listed above. Also attached here for convenience
Comment 7 Hugo Mildenberger 2009-12-27 17:57:10 UTC
Created attachment 214333 [details]
AA+ ebuild

Contents was already listed, also attached for convenience
Comment 8 Hugo Mildenberger 2009-12-29 15:04:02 UTC
Created attachment 214545 [details]
Revised version of AA+-1.39.ebuild

Fixed several problems with the original ebuild:

1.) License is NOT GPL-3 ... (see attached file AA+-license)
2.) Support for make check target
3.) Support shlib version 
4.) Install AA+ headers in usr/include/AA+/
4.) Install html documentation 
5.) Install an example
Comment 9 Hugo Mildenberger 2009-12-29 15:09:01 UTC
Created attachment 214546 [details]
Copyright and license for AA+ library

Contents:

Copyright (c) 2003 - 2009 by PJ Naughter (Web: www.naughter.com, Email: pjna@naughter.com)
 
All rights reserved.

Copyright / Usage Details:

You are allowed to include the source code in any product (commercial, shareware, freeware or otherwise) when your product is released in binary form. You are allowed to modify the source code in any way you want except you cannot modify the copyright details at the top of each module. If you want to distribute source code with your application, then you are only allowed to distribute versions released by the author. This is to maintain a single distribution point for the source code.
Comment 10 Hugo Mildenberger 2009-12-29 15:12:16 UTC
Created attachment 214547 [details, diff]
Replacement for a/ 214329: add an install target to CMakeList.txt
Comment 11 Hugo Mildenberger 2009-12-29 15:16:00 UTC
Created attachment 214549 [details, diff]
Renamed, but else identical version of a/ 214328: Fix some compilation warnings
Comment 12 Hugo Mildenberger 2009-12-29 15:21:26 UTC
Created attachment 214551 [details, diff]
Output of AATest program as in a/ 214330, in patch format
Comment 13 Hugo Mildenberger 2009-12-29 15:26:50 UTC
Created attachment 214552 [details, diff]
Test driver, supporting make test or "FEATURE=test" 

Contents:

diff -u --new-file tests/compare-with-previous-output.sh tests/compare-with-previous-output.sh
--- tests/compare-with-previous-output.sh       1970-01-01 01:00:00.000000000 +0100
+++ tests/compare-with-previous-output.sh       2009-12-28 16:12:02.000000000 +0100
@@ -0,0 +1,2 @@
+#!/bin/sh
+"${1}" | diff -u "${2}" -
Comment 14 Hugo Mildenberger 2009-12-29 15:30:40 UTC
Comment on attachment 214547 [details, diff]
Replacement for a/ 214329: add an install target to CMakeList.txt

Contents of attachment 214547 [details, diff]:
--- CMakeLists.txt.orig	2006-11-29 14:57:06.000000000 +0100
+++ CMakeLists.txt	2009-12-29 12:22:23.000000000 +0100
@@ -1,5 +1,5 @@
+cmake_minimum_required(VERSION 2.8)
 PROJECT (AstronomicalAlgorithms)
-
 #-----------------------------------------------------------------------------
 # Output directories.
 SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin CACHE PATH
@@ -108,6 +108,7 @@
   AAMoonPerigeeApogee.h
   AAMoonPhases.h
   AAMoslemCalendar.h
+  AANearParabolic.h
   AANeptune.h
   AANodes.h
   AANutation.h
@@ -143,10 +144,48 @@
 # Executables.
 #-----------------------------------------------------------------------------
 ADD_EXECUTABLE(Test ${SRCS} )
+ADD_EXECUTABLE(Test-shared ${SRCS} )
 
 #-----------------------------------------------------------------------------
 # Libraries.
-ADD_LIBRARY(aaplus ${SRCS_LIB} ${INCS})
+#Versioning
+
+ADD_LIBRARY(aaplus-static STATIC ${SRCS_LIB} ${INCS})
+SET_TARGET_PROPERTIES(aaplus-static PROPERTIES OUTPUT_NAME "aaplus")
+
+ADD_LIBRARY(aaplus-shared SHARED ${SRCS_LIB} ${INCS})
+IF( WIN32 )
+	SET_TARGET_PROPERTIES( aaplus-shared PROPERTIES
+			       OUTPUT_NAME "aaplus-${VERSION}"
+			       VERSION ${VERSION} )
+ELSE()
+	SET_TARGET_PROPERTIES( aaplus-shared PROPERTIES
+			       OUTPUT_NAME "aaplus"
+			       VERSION ${VERSION}
+			       SOVERSION ${VERSION} )
+ENDIF()
+
+
 
-TARGET_LINK_LIBRARIES(Test aaplus)
+TARGET_LINK_LIBRARIES(Test aaplus-static)
+TARGET_LINK_LIBRARIES(Test-shared aaplus-shared)
+
+install(TARGETS aaplus-shared aaplus-static 
+	DESTINATION "${CMAKE_INSTALL_PREFIX}/lib" )
+
+set( AAP_HEADERS ${INCS} "AA+.h")
+list( REMOVE_ITEM AAP_HEADERS "stdafx.h")
+install(FILES  ${AAP_HEADERS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/AA+")
+
+
+enable_testing()
+add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+add_dependencies(check Test Test-shared)
+add_test(NAME compare-Test-output-with-previous-Test-output-static
+	  COMMAND sh "${CMAKE_SOURCE_DIR}/tests/compare-with-previous-output.sh"
+	  $<TARGET_FILE:Test> "${CMAKE_SOURCE_DIR}/tests/Test.output")
+add_test(NAME compare-Test-output-with-previous-Test-output-shared
+	 COMMAND sh "${CMAKE_SOURCE_DIR}/tests/compare-with-previous-output.sh"
+	 $<TARGET_FILE:Test-shared> "${CMAKE_SOURCE_DIR}/tests/Test.output")
 
+#
Comment 15 Hugo Mildenberger 2009-12-29 15:33:18 UTC
Comment on attachment 214545 [details]
Revised version of AA+-1.39.ebuild

Contents of Attachment 214545 [details]:

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
EAPI="2"
inherit base cmake-utils

DESCRIPTION="A class framework for Computational Astronomy based on
Jean Meeus' Astronomical Algorithms"
HOMEPAGE="http://www.naughter.com/aa.html"
SRC_URI="http://www.naughter.com/download/aaplus.zip"

SLOT="0"
LICENSE="AA+"
KEYWORDS="~x86 ~amd64"
IUSE="debug +doc +examples"
DEPEND=""

PATCHES=("${FILESDIR}/${P}-add-install-and-test-target.patch"
		 "${FILESDIR}/${P}-fix-AATest.cpp-printf-format-warnings.patch"
		 "${FILESDIR}/${P}-compare-with-previous-output.sh.patch"
		 "${FILESDIR}/${P}-Test.output.patch")

src_unpack() {
	mkdir -p "${S}" && cd "${S}" && unpack ${A} || die
}

src_configure() {
	local mycmakeargs="-DVERSION=${PV}"
	cmake-utils_src_configure

}

src_install() {
	use doc && dohtml "${S}/AA+.htm"
	use examples && dodoc "${S}/AATest.cpp" \
				 && sed -r -i\
						-e 's:^#include[[:blank:]]+"stdafx.h"://\0:'\
						-e 's:"AA[+].h":"AA+/AA+.h":'\
						-e 's:<stdio.h>:<cstdio>:'\
						"${D}/usr/share/doc/${PF}/AATest.cpp"

	cmake-utils_src_install
}