From cb597c229b74a07773571af2596f27bc14e3056f Mon Sep 17 00:00:00 2001 From: Timothée Jourde Date: Mon, 18 Jun 2018 00:11:28 +0200 Subject: openspace: init at 0.11.1 This adds a new package: OpenSpace, an open source astrovisualization project, and one of its dependencies: SOIL (Simple OpenGL Image Library). This kind of works for me, but please note that this build is not very usable for now. This is a first attempt. Also, Linux doesn't seem to be well supported upstream, hence the various patches (I will open an issue upstream to discuss them). Squashed commits: openspace: fetch upstream glm "patch" openspace: add missing dependency (libXxf86vm) soil: mesa -> mesa_noglu --- .../science/astronomy/openspace/assets.patch | 100 +++++++++++++++++++++ .../science/astronomy/openspace/config.patch | 49 ++++++++++ .../science/astronomy/openspace/constexpr.patch | 91 +++++++++++++++++++ .../science/astronomy/openspace/default.nix | 89 ++++++++++++++++++ .../science/astronomy/openspace/vrpn.patch | 13 +++ 5 files changed, 342 insertions(+) create mode 100644 pkgs/applications/science/astronomy/openspace/assets.patch create mode 100644 pkgs/applications/science/astronomy/openspace/config.patch create mode 100644 pkgs/applications/science/astronomy/openspace/constexpr.patch create mode 100644 pkgs/applications/science/astronomy/openspace/default.nix create mode 100644 pkgs/applications/science/astronomy/openspace/vrpn.patch (limited to 'pkgs/applications/science') diff --git a/pkgs/applications/science/astronomy/openspace/assets.patch b/pkgs/applications/science/astronomy/openspace/assets.patch new file mode 100644 index 000000000000..38c17ad4593a --- /dev/null +++ b/pkgs/applications/science/astronomy/openspace/assets.patch @@ -0,0 +1,100 @@ +diff --git a/data/assets/scene/solarsystem/planets/jupiter/jup310.asset b/data/assets/scene/solarsystem/planets/jupiter/jup310.asset +index c15f6d9..1f8ddaf 100755 +--- a/data/assets/scene/solarsystem/planets/jupiter/jup310.asset ++++ b/data/assets/scene/solarsystem/planets/jupiter/jup310.asset +@@ -1,8 +1,8 @@ +-local Kernels = asset.syncedResource({ +- Name = "Jupiter Spice Kernels (jup310)", +- Type = "TorrentSynchronization", +- Identifier = "jup310", +- Magnet = "magnet:?xt=urn:btih:E8B7D7E136DE1C6249158B254BFC8B9ECE2A0539&dn=jup310.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" +-}) ++-- local Kernels = asset.syncedResource({ ++-- Name = "Jupiter Spice Kernels (jup310)", ++-- Type = "TorrentSynchronization", ++-- Identifier = "jup310", ++-- Magnet = "magnet:?xt=urn:btih:E8B7D7E136DE1C6249158B254BFC8B9ECE2A0539&dn=jup310.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" ++-- }) + +-asset.export("Kernels", Kernels .. '/jup310.bsp') ++-- asset.export("Kernels", Kernels .. '/jup310.bsp') +diff --git a/data/assets/scene/solarsystem/planets/mars/mar097.asset b/data/assets/scene/solarsystem/planets/mars/mar097.asset +index e77d67d..8d738a6 100755 +--- a/data/assets/scene/solarsystem/planets/mars/mar097.asset ++++ b/data/assets/scene/solarsystem/planets/mars/mar097.asset +@@ -1,8 +1,8 @@ +-local Kernels = asset.syncedResource({ +- Name = "Mars Spice Kernels", +- Type = "TorrentSynchronization", +- Identifier = "mat097", +- Magnet = "magnet:?xt=urn:btih:308F326B9AF864294D73042FBBED33B17291E27E&dn=mar097.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" +-}) ++-- local Kernels = asset.syncedResource({ ++-- Name = "Mars Spice Kernels", ++-- Type = "TorrentSynchronization", ++-- Identifier = "mat097", ++-- Magnet = "magnet:?xt=urn:btih:308F326B9AF864294D73042FBBED33B17291E27E&dn=mar097.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" ++-- }) + +-asset.export("Kernels", Kernels .. '/mar097.bsp') ++-- asset.export("Kernels", Kernels .. '/mar097.bsp') +diff --git a/data/assets/scene/solarsystem/planets/neptune/nep081.asset b/data/assets/scene/solarsystem/planets/neptune/nep081.asset +index e9c49ce..cfb5fac 100755 +--- a/data/assets/scene/solarsystem/planets/neptune/nep081.asset ++++ b/data/assets/scene/solarsystem/planets/neptune/nep081.asset +@@ -1,8 +1,8 @@ +-local Kernels = asset.syncedResource({ +- Name = "Neptune Spice Kernels (nep081)", +- Type = "TorrentSynchronization", +- Identifier = "nep081", +- Magnet = "magnet:?xt=urn:btih:A6079CF8D4BF3B6BB38F4F9F633CB7724FF91693&dn=nep081.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" +-}) ++-- local Kernels = asset.syncedResource({ ++-- Name = "Neptune Spice Kernels (nep081)", ++-- Type = "TorrentSynchronization", ++-- Identifier = "nep081", ++-- Magnet = "magnet:?xt=urn:btih:A6079CF8D4BF3B6BB38F4F9F633CB7724FF91693&dn=nep081.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" ++-- }) + +-asset.export("Kernels", Kernels .. '/nep081.bsp') ++-- asset.export("Kernels", Kernels .. '/nep081.bsp') +diff --git a/data/assets/scene/solarsystem/planets/saturn/sat375.asset b/data/assets/scene/solarsystem/planets/saturn/sat375.asset +index a55f2ed..f904b3c 100755 +--- a/data/assets/scene/solarsystem/planets/saturn/sat375.asset ++++ b/data/assets/scene/solarsystem/planets/saturn/sat375.asset +@@ -1,8 +1,8 @@ +-local Kernels = asset.syncedResource({ +- Name = "Saturn Spice Kernels (sat375)", +- Type = "TorrentSynchronization", +- Identifier = "sat375", +- Magnet = "magnet:?xt=urn:btih:79083d2069df389e65d7688bb326c7aaf1953845&dn=sat375.bsp" +-}) ++-- local Kernels = asset.syncedResource({ ++-- Name = "Saturn Spice Kernels (sat375)", ++-- Type = "TorrentSynchronization", ++-- Identifier = "sat375", ++-- Magnet = "magnet:?xt=urn:btih:79083d2069df389e65d7688bb326c7aaf1953845&dn=sat375.bsp" ++-- }) + +-asset.export("Kernels", Kernels .. '/sat375.bsp') ++-- asset.export("Kernels", Kernels .. '/sat375.bsp') +diff --git a/data/assets/scene/solarsystem/planets/uranus/ura111.asset b/data/assets/scene/solarsystem/planets/uranus/ura111.asset +index 665d059..8f95f34 100755 +--- a/data/assets/scene/solarsystem/planets/uranus/ura111.asset ++++ b/data/assets/scene/solarsystem/planets/uranus/ura111.asset +@@ -1,8 +1,8 @@ +-local Kernels = asset.syncedResource({ +- Name = "Uranus Spice Kernels (ura111)", +- Type = "TorrentSynchronization", +- Identifier = "ura111", +- Magnet = "magnet:?xt=urn:btih:26C4903D1A12AE439480F31B45BAEB5781D2B305&dn=ura111.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" +-}) ++-- local Kernels = asset.syncedResource({ ++-- Name = "Uranus Spice Kernels (ura111)", ++-- Type = "TorrentSynchronization", ++-- Identifier = "ura111", ++-- Magnet = "magnet:?xt=urn:btih:26C4903D1A12AE439480F31B45BAEB5781D2B305&dn=ura111.bsp&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.ccc.de%3a80%2fannounce" ++-- }) + +-asset.export("Kernels", Kernels .. '/ura111.bsp') ++-- asset.export("Kernels", Kernels .. '/ura111.bsp') diff --git a/pkgs/applications/science/astronomy/openspace/config.patch b/pkgs/applications/science/astronomy/openspace/config.patch new file mode 100644 index 000000000000..826edea09071 --- /dev/null +++ b/pkgs/applications/science/astronomy/openspace/config.patch @@ -0,0 +1,49 @@ +diff --git a/openspace.cfg b/openspace.cfg +index c86830b..e7f89d9 100755 +--- a/openspace.cfg ++++ b/openspace.cfg +@@ -2,18 +2,21 @@ + -- require('scripts/configuration_helper.lua') + -- which defines helper functions useful to customize the configuration + ++userdir = os.getenv("HOME") .. "/.openspace/" ++os.execute("mkdir -p " .. userdir) ++ + return { + -- Determines which SGCT configuration file is loaded, that is, if there rendering + -- occurs in a single window, a fisheye projection, or a dome cluster system + + -- A regular 1280x720 window +- SGCTConfig = sgct.config.single{}, ++ -- SGCTConfig = sgct.config.single{}, + + -- A regular 1920x1080 window + -- SGCTConfig = sgct.config.single{1920, 1080}, + + -- A windowed 1920x1080 fullscreen +- -- SGCTConfig = sgct.config.single{1920, 1080, border=false, windowPos={0,0}, shared=true, name="WV_OBS_SPOUT1"}, ++ SGCTConfig = sgct.config.single{1920, 1080, border=false, windowPos={0,0}, shared=true, name="WV_OBS_SPOUT1"}, + + -- A 1k fisheye rendering + -- SGCTConfig = sgct.config.fisheye{1024, 1024}, +@@ -53,15 +56,15 @@ return { + TASKS = "${DATA}/tasks", + WEB = "${DATA}/web", + +- CACHE = "${BASE}/cache", ++ CACHE = userdir .. "cache", + CONFIG = "${BASE}/config", +- DOCUMENTATION = "${BASE}/documentation", +- LOGS = "${BASE}/logs", ++ DOCUMENTATION = userdir .. "documentation", ++ LOGS = userdir .. "logs", + MODULES = "${BASE}/modules", + SCRIPTS = "${BASE}/scripts", + SHADERS = "${BASE}/shaders", +- SYNC = "${BASE}/sync", +- TESTDIR = "${BASE}/tests" ++ SYNC = userdir .. "sync", ++ TESTDIR = userdir .. "tests" + }, + Fonts = { + Mono = "${FONTS}/Bitstream-Vera-Sans-Mono/VeraMono.ttf", diff --git a/pkgs/applications/science/astronomy/openspace/constexpr.patch b/pkgs/applications/science/astronomy/openspace/constexpr.patch new file mode 100644 index 000000000000..d9fc91d7c277 --- /dev/null +++ b/pkgs/applications/science/astronomy/openspace/constexpr.patch @@ -0,0 +1,91 @@ +diff --git a/include/openspace/util/distanceconversion.h b/include/openspace/util/distanceconversion.h +index 80a3a96..7059752 100755 +--- a/include/openspace/util/distanceconversion.h ++++ b/include/openspace/util/distanceconversion.h +@@ -159,24 +159,34 @@ constexpr const char* nameForDistanceUnit(DistanceUnit unit, bool pluralForm = f + } + + constexpr DistanceUnit distanceUnitFromString(const char* unitName) { ++ int result = -1; ++ + int i = 0; + for (const char* val : DistanceUnitNamesSingular) { + if (ghoul::equal(unitName, val)) { +- return static_cast(i); ++ result = i; ++ break; + } + ++i; + } + +- i = 0; +- for (const char* val : DistanceUnitNamesPlural) { +- if (ghoul::equal(unitName, val)) { +- return static_cast(i); ++ if (result == -1) { ++ i = 0; ++ for (const char* val : DistanceUnitNamesPlural) { ++ if (ghoul::equal(unitName, val)) { ++ result = i; ++ break; ++ } ++ ++i; + } +- ++i; + } + +- ghoul_assert(false, "Unit name is not a valid name"); +- throw ghoul::MissingCaseException(); ++ if (result != -1) ++ return static_cast(result); ++ else { ++ ghoul_assert(false, "Unit name is not a valid name"); ++ throw ghoul::MissingCaseException(); ++ } + } + + +diff --git a/include/openspace/util/timeconversion.h b/include/openspace/util/timeconversion.h +index a36c92a..699bca9 100755 +--- a/include/openspace/util/timeconversion.h ++++ b/include/openspace/util/timeconversion.h +@@ -142,23 +142,32 @@ constexpr const char* nameForTimeUnit(TimeUnit unit, bool pluralForm = false) { + } + + constexpr TimeUnit timeUnitFromString(const char* unitName) { ++ int result = -1; ++ + int i = 0; + for (const char* val : TimeUnitNamesSingular) { + if (ghoul::equal(unitName, val)) { +- return static_cast(i); ++ result = i; ++ break; + } + ++i; + } + +- i = 0; +- for (const char* val : TimeUnitNamesPlural) { +- if (ghoul::equal(unitName, val)) { +- return static_cast(i); ++ if (result == -1) { ++ i = 0; ++ for (const char* val : TimeUnitNamesPlural) { ++ if (ghoul::equal(unitName, val)) { ++ result = i; ++ break; ++ } ++ ++i; + } +- ++i; + } + +- throw ghoul::MissingCaseException(); ++ if (result != -1) ++ return static_cast(result); ++ else ++ throw ghoul::MissingCaseException(); + } + + std::pair simplifyTime(double seconds, diff --git a/pkgs/applications/science/astronomy/openspace/default.nix b/pkgs/applications/science/astronomy/openspace/default.nix new file mode 100644 index 000000000000..ee3a71cf1813 --- /dev/null +++ b/pkgs/applications/science/astronomy/openspace/default.nix @@ -0,0 +1,89 @@ +{ stdenv, fetchFromGitHub, fetchurl, makeWrapper, cmake +, curl, boost, gdal, glew, soil +, libX11, libXi, libXxf86vm, libXcursor, libXrandr, libXinerama }: + +stdenv.mkDerivation rec { + version = "0.11.1"; + name = "openspace-${version}"; + + src = fetchFromGitHub { + owner = "OpenSpace"; + repo = "OpenSpace"; + rev = "a65eea61a1b8807ce3d69e9925e75f8e3dfb085d"; + sha256 = "0msqixf30r0d41xmfmzkdfw6w9jkx2ph5clq8xiwrg1jc3z9q7nv"; + fetchSubmodules = true; + }; + + buildInputs = [ + makeWrapper cmake + curl boost gdal glew soil + libX11 libXi libXxf86vm libXcursor libXrandr libXinerama + ]; + + glmPlatformH = fetchurl { + url = "https://raw.githubusercontent.com/g-truc/glm/dd48b56e44d699a022c69155c8672caacafd9e8a/glm/simd/platform.h"; + sha256 = "0y91hlbgn5va7ijg5mz823gqkq9hqxl00lwmdwnf8q2g086rplzw"; + }; + + # See + prePatch = '' + cp ${glmPlatformH} ext/sgct/include/glm/simd/platform.h + cp ${glmPlatformH} ext/ghoul/ext/glm/glm/simd/platform.h + ''; + + patches = [ + # See + ./vrpn.patch + + ./constexpr.patch + ./config.patch + + # WARNING: This patch disables some slow torrents in a very dirty way. + ./assets.patch + ]; + + bundle = "$out/usr/share/openspace"; + + preConfigure = '' + cmakeFlagsArray=( + $cmakeFlagsArray + "-DCMAKE_BUILD_TYPE=" + "-DCMAKE_INSTALL_PREFIX=${bundle}" + ) + ''; + + preInstall = '' + mkdir -p $out/bin + mkdir -p ${bundle} + ''; + + postInstall = '' + cp ext/spice/libSpice.so ${bundle}/lib + cp ext/ghoul/ext/lua/libLua.so ${bundle}/lib + ''; + + postFixup = '' + for bin in ${bundle}/bin/* + do + rpath=$(patchelf --print-rpath $bin) + patchelf --set-rpath $rpath:${bundle}/lib $bin + + name=$(basename $bin) + makeWrapper $bin $out/bin/$name --run "cd ${bundle}" + done + ''; + + meta = { + description = "Open-source astrovisualization project"; + longDescription = '' + OpenSpace is open source interactive data visualization software + designed to visualize the entire known universe and portray our + ongoing efforts to investigate the cosmos. + + WARNING: This build is not very usable for now. + ''; + homepage = https://www.openspaceproject.com/; + license = stdenv.lib.licenses.mit; + platforms = stdenv.lib.platforms.linux; + }; +} diff --git a/pkgs/applications/science/astronomy/openspace/vrpn.patch b/pkgs/applications/science/astronomy/openspace/vrpn.patch new file mode 100644 index 000000000000..9386d0257b7f --- /dev/null +++ b/pkgs/applications/science/astronomy/openspace/vrpn.patch @@ -0,0 +1,13 @@ +diff --git a/ext/sgct/src/deps/vrpn/vrpn_Connection.C b/ext/sgct/src/deps/vrpn/vrpn_Connection.C +index d6ffdc5..f90a2b2 100755 +--- a/ext/sgct/src/deps/vrpn/vrpn_Connection.C ++++ b/ext/sgct/src/deps/vrpn/vrpn_Connection.C +@@ -2489,7 +2489,7 @@ static int vrpn_start_server(const char *machine, char *server_name, char *args, + #if defined(sparc) || defined(FreeBSD) || defined(_AIX) || defined(__ANDROID__) + int status; // doesn't exist on sparc_solaris or FreeBSD + #else +- union wait status; ++ int status; + #endif + + /* Check to see if they called back yet. */ -- cgit 1.4.1