diff --git a/.gitignore b/.gitignore index 053389a..653eaf0 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,8 @@ qrc_*.cpp ui_*.h tags .session.vim - +*-stamp +debian/*.log +debian/files +debian/*.substvars +debian/paysages3d diff --git a/Makefile b/Makefile index e3308d6..84543ee 100644 --- a/Makefile +++ b/Makefile @@ -50,4 +50,20 @@ profile: opannotate --source --output-dir=annotated ${BUILDPATH}/libpaysages.so --base-dirs=. --search-dirs=lib_paysages opreport -l ${BUILDPATH}/libpaysages.so -c -g | less +install:release + mkdir -p ${DESTDIR}/usr/bin + mkdir -p ${DESTDIR}/usr/lib + mkdir -p ${DESTDIR}/usr/share/paysages3d + cp build/release/paysages-qt ${DESTDIR}/usr/bin/paysages3d + cp build/release/libpaysages_exploring.so ${DESTDIR}/usr/lib/ + cp build/release/libpaysages_rendering.so ${DESTDIR}/usr/lib/ + cp data/.paysages_data ${DESTDIR}/usr/share/paysages3d/ + cp -r data/i18n ${DESTDIR}/usr/share/paysages3d/ + cp -r data/images ${DESTDIR}/usr/share/paysages3d/ + cp cache/*.cache ${DESTDIR}/usr/share/paysages3d/ + +deb: + DEBFULLNAME="Michael Lemaire" DEBEMAIL=paysages@thunderk.net dch -i -p -u low -D stable + debuild -b -us -uc + .PHONY:all clean release diff --git a/TODO b/TODO index aa162f1..0167dfb 100644 --- a/TODO +++ b/TODO @@ -10,7 +10,8 @@ Technology Preview 2 : => Displacement on 3d explorer and previews. => Optimize ray marching (for tracing and shadows), using base terrain and displacement power. - Fix rendering when inside a cloud layer, with other upper or lower layers. -- Compress and ship bruneton cache data. +- Create deb and rpm packages, and windows installer. + => Compress and ship bruneton cache data. - Translations. Technlogy Preview 3 : diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..9c50916 --- /dev/null +++ b/debian/README @@ -0,0 +1,6 @@ +The Debian Package paysages3d +---------------------------- + +Comments regarding the Package + + -- Michael Lemaire Sun, 16 Jun 2013 09:36:17 +0200 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..67f424f --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +paysages3d (0.2-1) stable; urgency=low + + * Beta 2 release. + + -- Sun, 16 Jun 2013 09:42:45 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..5d78d81 --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: paysages3d +Section: graphics +Priority: extra +Maintainer: Michael Lemaire +Build-Depends: debhelper (>= 5) +Standards-Version: 3.7.3 + +Package: paysages3d +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, libglib2.0-0, libqt5core5, libqt5gui5, libqt5opengl5, libdevil1c2 +Description: Paysages 3D is a landscape synthesizer and renderer + Paysages 3D is a work-in-progress 3D software, allowing to model, preview, and render vast natural sceneries, with ground, sky, clouds... diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..bb30297 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,29 @@ +This package was debianized by Michael Lemaire on +Sun, 16 Jun 2013 09:36:17 +0200. + +Copyright: + + Copyright (C) 2013 Michael Lemaire + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this package; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +On Debian systems, the complete text of the GNU General +Public License can be found in `/usr/share/common-licenses/GPL'. + +The Debian packaging is (C) 2013, Michael Lemaire and +is licensed under the GPL, see above. + diff --git a/debian/dirs b/debian/dirs new file mode 100644 index 0000000..bec1a16 --- /dev/null +++ b/debian/dirs @@ -0,0 +1 @@ +usr/share/paysages3d diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..2999b46 --- /dev/null +++ b/debian/rules @@ -0,0 +1,84 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + + + +CFLAGS = -Wall -g + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +configure: configure-stamp +configure-stamp: + dh_testdir + touch configure-stamp + + +build: build-stamp + +build-stamp: configure-stamp + dh_testdir + $(MAKE) + touch $@ + +clean: + dh_testdir + dh_testroot + rm -f build-stamp configure-stamp + -$(MAKE) "DESTDIR=$(CURDIR)/debian/paysages3d" clean + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + $(MAKE) "DESTDIR=$(CURDIR)/debian/paysages3d" install + +binary-indep: build install + +binary-arch: build install + dh_testdir + dh_testroot + dh_installchangelogs +# dh_installdocs +# dh_installexamples + dh_install +# dh_installmenu +# dh_installdebconf +# dh_installlogrotate +# dh_installemacsen +# dh_installpam +# dh_installmime +# dh_pysupport +# dh_installinit +# dh_installcron +# dh_installinfo +# dh_installman debian/*.1 + dh_link + dh_strip + dh_compress + dh_fixperms +# dh_perl +# dh_makeshlibs + dh_installdeb + dh_shlibdeps + dh_gencontrol + dh_md5sums + dh_builddeb + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install configure + diff --git a/src/editing/common/mainwindow.cpp b/src/editing/common/mainwindow.cpp index 6597607..38c1b09 100644 --- a/src/editing/common/mainwindow.cpp +++ b/src/editing/common/mainwindow.cpp @@ -43,7 +43,7 @@ int main(int argc, char** argv) QTranslator qtTranslator; QTranslator myTranslator; - if (myTranslator.load("paysages_" + QLocale::system().name(), "./data/i18n")) + if (myTranslator.load("paysages_" + QLocale::system().name(), "./data/i18n") || myTranslator.load("paysages_" + QLocale::system().name(), "/usr/share/paysages3d/i18n")) { app.installTranslator(&myTranslator); diff --git a/src/editing/tools.h b/src/editing/tools.h index 3c5104e..634ac9a 100644 --- a/src/editing/tools.h +++ b/src/editing/tools.h @@ -16,7 +16,15 @@ static inline QColor colorToQColor(Color color) static inline QString getDataPath(QString path) { - return QDir("./data").absoluteFilePath(path); + QFile datafile(QDir("/usr/share/paysages3d/").absoluteFilePath(path)); + if (datafile.exists()) + { + return datafile.fileName(); + } + else + { + return QDir("./data").absoluteFilePath(path); + } } QString getHumanMemory(qint64 memused); diff --git a/src/rendering/Makefile b/src/rendering/Makefile index e45b569..215c885 100644 --- a/src/rendering/Makefile +++ b/src/rendering/Makefile @@ -8,10 +8,10 @@ LIBS += glib-2.0 gthread-2.0 IL ILU CC_FLAGS += -DHAVE_GLIB=1 CC_LDFLAGS += -shared -CHECK_OPENCL = $(shell pkg-config --modversion --silence-errors OpenCL) -ifneq (,${CHECK_OPENCL}) - LIBS += OpenCL - CC_FLAGS += -DHAVE_OPENCL=1 -endif +#CHECK_OPENCL = $(shell pkg-config --modversion --silence-errors OpenCL) +#ifneq (,${CHECK_OPENCL}) +# LIBS += OpenCL +# CC_FLAGS += -DHAVE_OPENCL=1 +#endif include ../common_post.mk diff --git a/src/rendering/tools/cache.c b/src/rendering/tools/cache.c index f0d64d3..468ddcd 100644 --- a/src/rendering/tools/cache.c +++ b/src/rendering/tools/cache.c @@ -6,6 +6,7 @@ struct CacheFile { + char* datapath; char* filepath; }; @@ -14,8 +15,10 @@ CacheFile* cacheFileCreateAccessor(const char* module, const char* ext, const ch CacheFile* result; result = (CacheFile*)malloc(sizeof(CacheFile)); + result->datapath = malloc(sizeof(char) * 501); result->filepath = malloc(sizeof(char) * 501); + snprintf(result->datapath, 500, "/usr/share/paysages3d/%s-%s-%d-%d-%d-%d-%d.%s", module, tag1, tag2, tag3, tag4, tag5, tag6, ext); snprintf(result->filepath, 500, "./cache/%s-%s-%d-%d-%d-%d-%d.%s", module, tag1, tag2, tag3, tag4, tag5, tag6, ext); return result; @@ -23,6 +26,7 @@ CacheFile* cacheFileCreateAccessor(const char* module, const char* ext, const ch void cacheFileDeleteAccessor(CacheFile* cache) { + free(cache->datapath); free(cache->filepath); free(cache); } @@ -37,7 +41,16 @@ int cacheFileIsReadable(CacheFile* cache) } else { - return 0; + FILE* f = fopen(cache->datapath, "rb"); + if (f) + { + fclose(f); + return 1; + } + else + { + return 0; + } } } @@ -59,5 +72,14 @@ int cacheFileIsWritable(CacheFile* cache) const char* cacheFileGetPath(CacheFile* cache) { - return cache->filepath; + FILE* f = fopen(cache->filepath, "rb"); + if (f) + { + fclose(f); + return cache->filepath; + } + else + { + return cache->datapath; + } } diff --git a/src/rendering/tools/data.c b/src/rendering/tools/data.c index 859abe7..abd596c 100644 --- a/src/rendering/tools/data.c +++ b/src/rendering/tools/data.c @@ -30,5 +30,5 @@ static int _tryDataPath(const char* path) int dataInit() { - return _tryDataPath("./data"); + return _tryDataPath("./data") || _tryDataPath("/usr/share/paysages3d"); }