Description: Debian-specific build files.
Forwarded: not-needed
Author: Filip Strömbäck <filip@fprg.se>
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,49 @@
+# DESTDIR is the destination directory
+
+# Where to locate shared Storm files.
+STORM_SHARED := $(DESTDIR)/usr/lib/storm
+
+# To have a local .mymake configuration file
+export HOME = $(shell pwd)/debian
+MM := mymake -d INFO
+
+MM_CONFIG := dist nostatic nobacktrace
+
+.PHONY: all install
+all:
+	rm -f debian/.mymake
+	echo $(or $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))),"1") | $(MM) --config > /dev/null
+	echo "[]\nrootdir=$$(pwd)/\ntriplet=${DEB_TARGET_MULTIARCH}" >> .myproject
+
+	bash ./update_version.sh
+
+	$(MM) release $(MM_CONFIG) mps Main
+	$(MM) release $(MM_CONFIG) Gui noskia nocairogl
+	$(MM) release $(MM_CONFIG) Crypto
+	$(MM) release $(MM_CONFIG) Graphics
+	$(MM) release $(MM_CONFIG) Sound
+	$(MM) release $(MM_CONFIG) SQL
+
+
+install:
+	mkdir -p $(DESTDIR)/usr/bin
+	cp release/Storm_mps $(DESTDIR)/usr/bin/storm
+	chmod +x $(DESTDIR)/usr/bin/storm
+	cp scripts/progvis $(DESTDIR)/usr/bin
+	chmod +x $(DESTDIR)/usr/bin/progvis
+	mkdir -p $(STORM_SHARED)
+	cp -r root/doc $(STORM_SHARED)
+	cp -r root/lang $(STORM_SHARED)
+	cp -r root/layout $(STORM_SHARED)
+	cp -r root/crypto $(STORM_SHARED)
+	cp -r root/graphics $(STORM_SHARED)
+	cp -r root/sound $(STORM_SHARED)
+	cp -r root/parser $(STORM_SHARED)
+	cp -r root/presentation $(STORM_SHARED)
+	cp -r root/progvis $(STORM_SHARED)
+	cp -r root/sql $(STORM_SHARED)
+	cp -r root/test $(STORM_SHARED)
+	cp -r root/ui $(STORM_SHARED)
+	cp -r root/util $(STORM_SHARED)
+	bash ./install_icons.sh $(DESTDIR)
+
--- /dev/null
+++ b/scripts/progvis
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec storm -f progvis.main
--- /dev/null
+++ b/update_version.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+(echo "core.info"; sed -En 's/^.*\(([0-9.\-]*)\).*$/\1+debian/p' debian/changelog | head -n 1) > Compiler/COMPILER.version
+
--- a/Gui/.mymake
+++ b/Gui/.mymake
@@ -53,6 +53,6 @@
 library+=dl
 
 # Defaults
-flags+=`pkg-config --cflags gtk+-3.0 x11 fontconfig`
-linkFlags+=`pkg-config --libs gtk+-3.0 x11 fontconfig pangoft2` -lGL -lEGL
+flags+=`pkg-config --cflags gtk+-3.0 x11`
+linkFlags+=-lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lglib-2.0 -lX11 -lGL
 
--- /dev/null
+++ b/install_icons.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+for file in res/*.png
+do
+    dest="$1/usr/share/icons/hicolor/"$(echo "$file" | sed -E 's|res/([a-z]+)-([0-9x]*)\.png|\2/apps/org.storm_lang.\1.png|')
+    mkdir -p $(dirname "$dest")
+    cp "$file" "$dest"
+done
--- a/res/org.storm_lang.progvis.desktop
+++ b/res/org.storm_lang.progvis.desktop
@@ -6,4 +6,4 @@
 Terminal=false
 Categories=Education
 Exec=/usr/bin/progvis
-Icon=progvis
+Icon=org.storm_lang.progvis
--- a/.myproject
+++ b/.myproject
@@ -167,6 +167,10 @@
 #We do not need O3
 opt=-O2
 
+#Generate debug information, it is stripped later.
+flags+=-g
+cflags+=-g
+
 [pic,unix]
 #All libraries need to be compiled with the -fPIC flag. At least on X86-64.
 flags+=-fPIC
@@ -217,7 +221,8 @@
 ext+=S
 noIncludes+=*.s
 noIncludes+=*.S
-compile+=*.S:gcc -g <file> <includes> -c -o <output>
+# Note: The -ffile-prefix-map does not work for asm files.
+compile+=*.S:gcc -fdebug-prefix-map=<rootdir>=. <file> <includes> -c -o <output>
 
 [stormpp]
 stormpp=CppTypes
@@ -272,3 +277,8 @@
 
 [unix]
 compile+=*.c:gcc -Wno-unknown-pragmas -Wno-pragmas -std=c99 -O3 <cflags> <defines> <warnings> -Wno-maybe-uninitialized <file> -c <includes> -o <output>
+
+# Don't use absolute paths, that makes the build not reproducible through the __FILE__ macro among other things.
+absolutePath=no
+flags+=-ffile-prefix-map=<rootdir>=.
+cflags+=-ffile-prefix-map=<rootdir>=.
