diff options
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/local.mk | 5 | ||||
-rw-r--r-- | gnu/packages/astronomy.scm | 55 | ||||
-rw-r--r-- | gnu/packages/patches/xplanet-1.3.1-cxx11-eof.patch | 154 | ||||
-rw-r--r-- | gnu/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch | 16 | ||||
-rw-r--r-- | gnu/packages/patches/xplanet-1.3.1-libimage_gif.c.patch | 54 | ||||
-rw-r--r-- | gnu/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch | 15 |
6 files changed, 299 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk index 713d97da86..42dbf61af1 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -28,6 +28,7 @@ # Copyright © 2019 Amin Bandali <bandali@gnu.org> # Copyright © 2020 Brendan Tildesley <mail@brendan.scot> # Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> +# Copyright © 2020 R Veera Kumar <vkor@vkten.in> # # This file is part of GNU Guix. # @@ -1532,6 +1533,10 @@ dist_patch_DATA = \ %D%/packages/patches/xmoto-utf8.patch \ %D%/packages/patches/xmoto-remove-glext.patch \ %D%/packages/patches/xmoto-reproducible.patch \ + %D%/packages/patches/xplanet-1.3.1-cxx11-eof.patch \ + %D%/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch \ + %D%/packages/patches/xplanet-1.3.1-libimage_gif.c.patch \ + %D%/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch \ %D%/packages/patches/xsane-fix-memory-leak.patch \ %D%/packages/patches/xsane-fix-pdf-floats.patch \ %D%/packages/patches/xsane-fix-snprintf-buffer-length.patch \ diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm index 3bb236fde9..ec90eba974 100644 --- a/gnu/packages/astronomy.scm +++ b/gnu/packages/astronomy.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018, 2019 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2019 by Amar Singh <nly@disroot.org> +;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in> ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,9 +26,11 @@ #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix utils) + #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages image) #:use-module (gnu packages compression) + #:use-module (gnu packages fontutils) #:use-module (gnu packages gettext) #:use-module (gnu packages version-control) #:use-module (gnu packages pkg-config) @@ -41,6 +44,8 @@ #:use-module (gnu packages gtk) #:use-module (gnu packages gnome) #:use-module (gnu packages maths) + #:use-module (gnu packages netpbm) + #:use-module (gnu packages xorg) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) #:use-module (srfi srfi-1)) @@ -289,3 +294,53 @@ Mechanics, Astrometry and Astrodynamics library.") (license (list license:lgpl2.0+ license:gpl2+)))) ; examples/transforms.c & lntest/*.c +(define-public xplanet + (package + (name "xplanet") + (version "1.3.1") + (source + (origin + (method url-fetch) + (uri + (string-append + "mirror://sourceforge/xplanet/xplanet/" + version "/xplanet-" version ".tar.gz")) + (sha256 + (base32 "1rzc1alph03j67lrr66499zl0wqndiipmj99nqgvh9xzm1qdb023")) + (patches + (search-patches + "xplanet-1.3.1-cxx11-eof.patch" + "xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch" + "xplanet-1.3.1-libimage_gif.c.patch" + "xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch")))) + (build-system gnu-build-system) + (native-inputs + `(("pkg-config" ,pkg-config))) + (inputs + `(("libx11" ,libx11) + ("libxscrnsaver" ,libxscrnsaver) + ("libice" ,libice) + ("freetype" ,freetype) + ("pango" ,pango) + ("giflib" ,giflib) + ("libjpeg", libjpeg) + ("libpng" ,libpng) + ("libtiff" ,libtiff) + ("netpbm" ,netpbm) + ("zlib" ,zlib))) + (arguments + `(#:configure-flags + (let ((netpbm (assoc-ref %build-inputs "netpbm"))) + (append (list + ;; Give correct path for pnm.h header to configure script + (string-append "CPPFLAGS=-I" netpbm "/include/netpbm") + ;; no nasa jpl cspice support + "--without-cspice" ))))) + (home-page "http://xplanet.sourceforge.net/") + (synopsis "Planetary body renderer") + (description + "Xplanet renders an image of a planet into an X window or file. +All of the major planets and most satellites can be drawn and different map +projections are also supported, including azimuthal, hemisphere, Lambert, +Mercator, Mollweide, Peters, polyconic, orthographic and rectangular.") + (license license:gpl2+))) diff --git a/gnu/packages/patches/xplanet-1.3.1-cxx11-eof.patch b/gnu/packages/patches/xplanet-1.3.1-cxx11-eof.patch new file mode 100644 index 0000000000..b4d5850f75 --- /dev/null +++ b/gnu/packages/patches/xplanet-1.3.1-cxx11-eof.patch @@ -0,0 +1,154 @@ +Author: Eric Bavier Date: 2020-01-13 +Url: https://notabug.org/bavier/guix-bavier/raw/master/bavier/patches/ ++xplanet-cxx11-eof.patch + +diff --git a/src/libannotate/addArcs.cpp b/src/libannotate/addArcs.cpp +index 2ee06c0..4fdb343 100644 +--- a/src/libannotate/addArcs.cpp ++++ b/src/libannotate/addArcs.cpp +@@ -258,7 +258,7 @@ addArcs(PlanetProperties *planetProperties, Planet *planet, + { + ifstream inFile(arcFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline (line, MAX_LINE_LENGTH, '\n').eof()) + readArcFile(line, planet, view, projection, + planetProperties, annotationMap); + +@@ -292,7 +292,7 @@ addArcs(View *view, multimap<double, Annotation *> &annotationMap) + { + ifstream inFile(arcFile.c_str()); + char *line = new char[256]; +- while (inFile.getline (line, 256, '\n') != NULL) ++ while (!inFile.getline (line, 256, '\n').eof()) + readArcFile(line, NULL, view, NULL, NULL, annotationMap); + + inFile.close(); +diff --git a/src/libannotate/addMarkers.cpp b/src/libannotate/addMarkers.cpp +index dde51c1..b641e6a 100644 +--- a/src/libannotate/addMarkers.cpp ++++ b/src/libannotate/addMarkers.cpp +@@ -429,7 +429,7 @@ addMarkers(PlanetProperties *planetProperties, Planet *planet, + { + ifstream inFile(markerFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline (line, MAX_LINE_LENGTH, '\n').eof()) + { + unsigned char color[3]; + memcpy(color, planetProperties->MarkerColor(), 3); +@@ -475,7 +475,7 @@ addMarkers(View *view, const int width, const int height, + { + ifstream inFile(markerFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline (line, MAX_LINE_LENGTH, '\n').eof()) + { + unsigned char color[3]; + memcpy(color, options->Color(), 3); +diff --git a/src/libannotate/addSatellites.cpp b/src/libannotate/addSatellites.cpp +index 2634339..6d9d378 100644 +--- a/src/libannotate/addSatellites.cpp ++++ b/src/libannotate/addSatellites.cpp +@@ -488,10 +488,10 @@ loadSatelliteVector(PlanetProperties *planetProperties) + { + ifstream inFile(tleFile.c_str()); + char lines[3][80]; +- while (inFile.getline(lines[0], 80) != NULL) ++ while (!inFile.getline(lines[0], 80).eof()) + { +- if ((inFile.getline(lines[1], 80) == NULL) +- || (inFile.getline(lines[2], 80) == NULL)) ++ if ((inFile.getline(lines[1], 80).eof()) ++ || (inFile.getline(lines[2], 80).eof())) + { + ostringstream errStr; + errStr << "Malformed TLE file (" << tleFile << ")?\n"; +@@ -542,7 +542,7 @@ addSatellites(PlanetProperties *planetProperties, Planet *planet, + { + ifstream inFile(satFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline (line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline (line, MAX_LINE_LENGTH, '\n').eof()) + readSatelliteFile(line, planet, view, projection, + planetProperties, annotationMap); + +diff --git a/src/libannotate/addSpiceObjects.cpp b/src/libannotate/addSpiceObjects.cpp +index 67b752c..eeadf6e 100644 +--- a/src/libannotate/addSpiceObjects.cpp ++++ b/src/libannotate/addSpiceObjects.cpp +@@ -524,7 +524,7 @@ processSpiceKernels(const bool load) + { + ifstream inFile(kernelFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + { + int ii = 0; + while (isDelimiter(line[ii])) +@@ -576,7 +576,7 @@ addSpiceObjects(map<double, Planet *> &planetsFromSunMap, + { + ifstream inFile(spiceFile.c_str()); + char *line = new char[MAX_LINE_LENGTH]; +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + readSpiceFile(line, planetsFromSunMap, view, projection, + annotationMap); + inFile.close(); +diff --git a/src/libmultiple/RayleighScattering.cpp b/src/libmultiple/RayleighScattering.cpp +index d885173..1be8ece 100644 +--- a/src/libmultiple/RayleighScattering.cpp ++++ b/src/libmultiple/RayleighScattering.cpp +@@ -369,7 +369,7 @@ RayleighScattering::readConfigFile(string configFile) + + diskTemplate_.clear(); + limbTemplate_.clear(); +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + { + int i = 0; + while (isDelimiter(line[i])) +@@ -439,7 +439,7 @@ RayleighScattering::readBlock(ifstream &inFile, + values.clear(); + + char line[MAX_LINE_LENGTH]; +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + { + int i = 0; + while (isDelimiter(line[i])) +@@ -470,7 +470,7 @@ RayleighScattering::readValue(ifstream &inFile, + double &value) + { + char line[MAX_LINE_LENGTH]; +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + { + int i = 0; + while (isDelimiter(line[i])) +diff --git a/src/libmultiple/drawStars.cpp b/src/libmultiple/drawStars.cpp +index ff07c49..aabdfed 100644 +--- a/src/libmultiple/drawStars.cpp ++++ b/src/libmultiple/drawStars.cpp +@@ -41,7 +41,7 @@ drawStars(DisplayBase *display, View *view) + ifstream inFile(starMap.c_str()); + + char line[MAX_LINE_LENGTH]; +- while (inFile.getline(line, MAX_LINE_LENGTH, '\n') != NULL) ++ while (!inFile.getline(line, MAX_LINE_LENGTH, '\n').eof()) + { + if (line[0] == '#') continue; + +diff --git a/src/readConfig.cpp b/src/readConfig.cpp +index cc1964f..4650527 100644 +--- a/src/readConfig.cpp ++++ b/src/readConfig.cpp +@@ -550,7 +550,7 @@ readConfigFile(string configFile, PlanetProperties *planetProperties[]) + + ifstream inFile(configFile.c_str()); + char *line = new char[256]; +- while (inFile.getline(line, 256, '\n') != NULL) ++ while (!inFile.getline(line, 256, '\n').eof()) + readConfig(line, planetProperties); + + // This condition will only be true if [default] is the only diff --git a/gnu/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch b/gnu/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch new file mode 100644 index 0000000000..bf52b0ca27 --- /dev/null +++ b/gnu/packages/patches/xplanet-1.3.1-libdisplay_DisplayOutput.cpp.patch @@ -0,0 +1,16 @@ +Origin: $NetBSD: patch-src_libdisplay_DisplayOutput.cpp,v 1.1 2019/11/16 17:36:28 ng0 Exp $ + +Modified by: R Veera Kumar <vkor@vkten.in> 2020-03-28; change to patch -p1 + +diff -uNr xplanet-1.3.1/src/libdisplay/DisplayOutput.cpp xplanet-1.3.1.new/src/libdisplay/DisplayOutput.cpp +--- xplanet-1.3.1/src/libdisplay/DisplayOutput.cpp 2013-02-17 01:07:47.000000000 +0530 ++++ xplanet-1.3.1.new/src/libdisplay/DisplayOutput.cpp 2020-03-28 22:08:44.432499170 +0530 +@@ -51,7 +51,7 @@ + string outputFilename = options->OutputBase(); + int startIndex = options->OutputStartIndex(); + int stopIndex = options->NumTimes() + startIndex - 1; +- if (stopIndex > 1) ++ if (stopIndex > 0) + { + const int digits = (int) (log10((double) stopIndex) + 1); + char buffer[64]; diff --git a/gnu/packages/patches/xplanet-1.3.1-libimage_gif.c.patch b/gnu/packages/patches/xplanet-1.3.1-libimage_gif.c.patch new file mode 100644 index 0000000000..58efc906dc --- /dev/null +++ b/gnu/packages/patches/xplanet-1.3.1-libimage_gif.c.patch @@ -0,0 +1,54 @@ +Origin: $NetBSD: patch-src_libimage_gif.c,v 1.4 2019/11/16 17:36:28 ng0 Exp $ + +Modified by: R Veera Kumar <vkor@vkten.in> 2020-03-28; change to patch -p1 + +diff -uNr xplanet-1.3.1/src/libimage/gif.c xplanet-1.3.1.new/src/libimage/gif.c +--- xplanet-1.3.1/src/libimage/gif.c 2013-02-17 01:07:47.000000000 +0530 ++++ xplanet-1.3.1.new/src/libimage/gif.c 2020-03-28 22:15:24.444309199 +0530 +@@ -21,7 +21,7 @@ + #include <stdio.h> + #include <stdlib.h> + #include <string.h> +- ++#include <stdbool.h> + #include <gif_lib.h> + + /* +@@ -178,8 +178,12 @@ + *BufferP++ = ColorMapEntry->Blue; + } + } +- ++ ++#if GIFLIB_MAJOR >= 5 ++ if (DGifCloseFile(GifFile, NULL) == GIF_ERROR) { ++#else + if (DGifCloseFile(GifFile) == GIF_ERROR) { ++#endif + return(0); + } + +@@ -493,7 +497,11 @@ + static void QuitGifError(GifFileType *GifFile) + { + fprintf(stderr, "Error writing GIF file\n"); ++#if GIFLIB_MAJOR >= 5 ++ if (GifFile != NULL) EGifCloseFile(GifFile, NULL); ++#else + if (GifFile != NULL) EGifCloseFile(GifFile); ++#endif + } + + int +@@ -589,7 +597,11 @@ + Ptr += width; + } + ++#if GIFLIB_MAJOR >= 5 ++ if (EGifCloseFile(GifFile, NULL) == GIF_ERROR) ++#else + if (EGifCloseFile(GifFile) == GIF_ERROR) ++#endif + + { + QuitGifError(GifFile); diff --git a/gnu/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch b/gnu/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch new file mode 100644 index 0000000000..a47623fa00 --- /dev/null +++ b/gnu/packages/patches/xplanet-1.3.1-xpUtil-Add2017LeapSecond.cpp.patch @@ -0,0 +1,15 @@ +$NetBSD: patch-src_xpUtil-Add2017LeapSecond.cpp,v 1.1 2019/11/16 17:36:28 ng0 Exp $ + +Modified by: R Veera Kumar <vkor@vkten.in> 2020-03-28; change to patch -p1 + +diff -uNr xplanet-1.3.1/src/xpUtil.cpp xplanet-1.3.1.new/src/xpUtil.cpp +--- xplanet-1.3.1/src/xpUtil.cpp 2016-03-12 08:36:47.000000000 +0530 ++++ xplanet-1.3.1.new/src/xpUtil.cpp 2020-03-28 22:19:10.629891166 +0530 +@@ -434,6 +434,7 @@ + if (jd >= toJulian(2009, 1, 1, 0, 0, 0)) delta_at++; // 34 + if (jd >= toJulian(2012, 7, 1, 0, 0, 0)) delta_at++; // 35 + if (jd >= toJulian(2015, 7, 1, 0, 0, 0)) delta_at++; // 36 ++ if (jd >= toJulian(2017, 1, 1, 0, 0, 0)) delta_at++; // 37 + + const double J2000 = toJulian(2000, 1, 1, 12, 0, 0); + const double m = m0 + m1 * (jd - J2000) * 86400; |