Description: Debian-specific build files.
Forwarded: not-needed
Author: Filip Strömbäck <filip@fprg.se>
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,78 @@
+# DESTDIR is the destination directory
+
+# Where to locate shared Storm files.
+STORM_SHARED := $(DESTDIR)/usr/lib/storm
+
+# Where to store documentation.
+STORM_DOC := $(DESTDIR)/usr/share/doc/storm-lang
+
+# To have a local .mymake configuration file
+MYMAKE_CONFIG := mymake.conf
+MM := mymake -d INFO --global-config $(MYMAKE_CONFIG)
+
+MM_CONFIG := dist nostatic noskia nocairogl mps
+
+CLEAN_DIRS = $(basename $(wildcard */.mymake))
+
+.PHONY: all install
+all:
+	rm -f mymake.conf
+	$(MM) -j $(or $(patsubst -j%,%,$(filter -j%,$(MAKEFLAGS))),"1") --config
+
+	bash ./update_version.sh
+
+	$(MM) release $(MM_CONFIG) Main
+	$(MM) release $(MM_CONFIG) Gui
+	$(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)
+	cp -r root/markdown $(STORM_SHARED)
+	cp -r root/tutorials $(STORM_SHARED)
+	cp -r root/http $(STORM_SHARED)
+	cp -r root/json $(STORM_SHARED)
+	cp -r root/experimental $(STORM_SHARED)
+	bash ./compile_doc.sh $(STORM_DOC)/html
+	find $(STORM_SHARED) -name "*.xcf" -exec rm \{\} \;
+	find $(STORM_DOC) -name "*.xcf" -exec rm \{\} \;
+	bash ./install_icons.sh $(DESTDIR)
+
+clean:
+	rm -rf release/ Gc/release_mps/ $(addsuffix release/,$(CLEAN_DIRS))
+	for i in $(filter-out Core/%,$(CLEAN_DIRS)); do \
+	  if [ -f $${i}Gen/.gitignore ]; then \
+	    rm -f $${i}Gen/*; \
+	  else \
+	    rm -rf $${i}Gen/; \
+	  fi \
+	done
+	rm -f root/doc
+	find root/ -name '*_doc' -print0 | xargs -0 rm -f
+	find root/ -name '*.so' -print0 | xargs -0 rm -f
+	rm -f mymake.conf
+
+test: all
+	$(MM) release $(MM_CONFIG) Test
+	release/Test_mps --all
--- /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
@@ -60,6 +60,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 -lgdk_pixbuf-2.0 -lgio-2.0 -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
@@ -189,6 +189,11 @@
 #We do not need O3
 opt=-O2
 
+#Respect CFLAGS etc.
+flags+=<env:CPPFLAGS> <env:CXXFLAGS>
+cflags+=<env:CPPFLAGS> <env:CFLAGS>
+linkFlags+=<env:LDFLAGS>
+
 [pic,unix]
 #All libraries need to be compiled with the -fPIC flag. At least on X86-64.
 flags+=-fPIC
@@ -246,7 +251,7 @@
 ext+=S
 noIncludes+=*.s
 noIncludes+=*.S
-compile+=*.S:gcc -g <file> <includes> -c -o <output>
+compile+=*.S:gcc <env:CFLAGS> <env:CPPFLAGS> <file> <includes> -c -o <output>
 
 # Enable branch protection on ARM (PAC) if asked to
 [unix,branchprotection]
--- /dev/null
+++ b/compile_doc.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+date=$(sed -En 's/--.*<.*>  ([^ ].*)/\1/p' debian/changelog | head -n 1)
+date=$(date --utc --date="$date" "+%Y-%m-%d")
+release/Storm_mps -r root -f markdown.doc.generate --  --clear --date=$date Storm storm doc "$1"
