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
This commit is contained in:
Timothée Jourde 2018-06-18 00:11:28 +02:00
parent bf6974648e
commit cb597c229b
7 changed files with 374 additions and 0 deletions

View File

@ -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')

View File

@ -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",

View File

@ -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<DistanceUnit>(i);
+ result = i;
+ break;
}
++i;
}
- i = 0;
- for (const char* val : DistanceUnitNamesPlural) {
- if (ghoul::equal(unitName, val)) {
- return static_cast<DistanceUnit>(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<DistanceUnit>(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<TimeUnit>(i);
+ result = i;
+ break;
}
++i;
}
- i = 0;
- for (const char* val : TimeUnitNamesPlural) {
- if (ghoul::equal(unitName, val)) {
- return static_cast<TimeUnit>(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<TimeUnit>(result);
+ else
+ throw ghoul::MissingCaseException();
}
std::pair<double, std::string> simplifyTime(double seconds,

View File

@ -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 <https://github.com/g-truc/glm/issues/726>
prePatch = ''
cp ${glmPlatformH} ext/sgct/include/glm/simd/platform.h
cp ${glmPlatformH} ext/ghoul/ext/glm/glm/simd/platform.h
'';
patches = [
# See <https://github.com/opensgct/sgct/issues/13>
./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;
};
}

View File

@ -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. */

View File

@ -0,0 +1,28 @@
{ stdenv, fetchurl, unzip, mesa_noglu, libX11 }:
stdenv.mkDerivation rec {
name = "soil";
src = fetchurl {
url = "http://www.lonesock.net/files/soil.zip";
sha256 = "00gpwp9dldzhsdhksjvmbhsd2ialraqbv6v6dpikdmpncj6mnc52";
};
buildInputs = [ unzip mesa_noglu libX11 ];
sourceRoot = "Simple OpenGL Image Library/projects/makefile";
preBuild = "mkdir obj";
preInstall = "mkdir -p $out/lib $out/include";
makeFlags = [ "LOCAL=$(out)" ];
meta = {
description = "Simple OpenGL Image Library";
longDescription = ''
SOIL is a tiny C library used primarily for uploading textures
into OpenGL.
'';
homepage = https://www.lonesock.net/soil.html;
license = stdenv.lib.licenses.publicDomain;
platforms = stdenv.lib.platforms.linux;
};
}

View File

@ -11687,6 +11687,8 @@ with pkgs;
sofia_sip = callPackage ../development/libraries/sofia-sip { };
soil = callPackage ../development/libraries/soil { };
sonic = callPackage ../development/libraries/sonic { };
soprano = callPackage ../development/libraries/soprano { };
@ -20637,6 +20639,8 @@ with pkgs;
spyder = pythonPackages.spyder;
openspace = callPackage ../applications/science/astronomy/openspace { };
stellarium = libsForQt5.callPackage ../applications/science/astronomy/stellarium { };
tulip = callPackage ../applications/science/misc/tulip {