From 259ba39fb2b927f94cca75215196794a47408ee1 Mon Sep 17 00:00:00 2001 From: Shiz Date: Sun, 21 Apr 2019 09:35:17 +0200 Subject: [PATCH] epoch --- .gitmodules | 12 +++++++++ LICENSE | 13 ++++++++++ Makefile | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 16 ++++++++++++ ext/bold | 1 + ext/fishypack | 1 + ext/smol | 1 + ext/vondehi | 1 + src/main.c | 42 ++++++++++++++++++++++++++++++ 9 files changed, 159 insertions(+) create mode 100644 .gitmodules create mode 100644 LICENSE create mode 100644 Makefile create mode 100644 README.md create mode 160000 ext/bold create mode 160000 ext/fishypack create mode 160000 ext/smol create mode 160000 ext/vondehi create mode 100755 src/main.c diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..3b45bbc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "ext/smol"] + path = ext/smol + url = https://github.com/Shizmob/smol +[submodule "ext/fishypack"] + path = ext/fishypack + url = https://gitlab.com/PoroCYon/fishypack-trident +[submodule "ext/vondehi"] + path = ext/vondehi + url = https://gitlab.com/PoroCYon/vondehi +[submodule "ext/bold"] + path = ext/bold + url = http://git.alrj.org/git/bold.git diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c6c7def --- /dev/null +++ b/LICENSE @@ -0,0 +1,13 @@ + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + Version 2, December 2004 + + Copyright (C) 2004 Sam Hocevar + + Everyone is permitted to copy and distribute verbatim or modified + copies of this license document, and changing it is allowed as long + as the name is changed. + + DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. You just DO WHAT THE FUCK YOU WANT TO. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d10712b --- /dev/null +++ b/Makefile @@ -0,0 +1,72 @@ +B = bin +O = obj +S = src +E = ext +PKGS = glib-2.0 gtk+-3.0 +LIBS = $(shell pkg-config --libs $(PKGS)) -lGL -lc +LIBFLAGS = $(shell pkg-config --cflags $(PKGS)) +BITS = 64 + +AS = nasm +ASFLAGS = + +CFLAGS = -m$(BITS) -Os -fomit-frame-pointer -fno-unwind-tables -ffast-math -march=haswell -ffunction-sections -fdata-sections +CFLAGS += $(LIBFLAGS) +SMOLCFLAGS = -no-pie -fno-PIE -fno-PIC -fno-plt -fno-stack-protector -fno-stack-check +BOLDFLAGS = -no-pie -fno-PIE -fno-PIC -fno-plt +COMPRESS = xz -c -9e --format=lzma --lzma1=preset=9,lc=1,lp=0,pb=0 + + +.PHONY: all clean +all: $(B)/demo +clean: + @rm -rfv $(B) $(O) + + +$(B)/demo: $(B)/demo.o.smol.vondehi + cp $< $@ + +$(B)/demo.o: $(O)/main.o + + +.SECONDARY: + +$(B)/%.fishypack: $(B)/% $(O)/fishypack + $(COMPRESS) $< | cat $(O)/fishypack - > $@ + chmod +x $@ + +$(B)/%.vondehi: $(B)/% $(O)/vondehi + $(COMPRESS) $< | cat $(O)/vondehi - > $@ + chmod +x $@ + +$(B)/%.smol: CFLAGS += $(SMOLCFLAGS) +$(B)/%.smol: | $(B)/% + $(E)/smol/smol $(LDFLAGS) $(LIBS) $(filter %.o,$^) -o $@ + +$(B)/%.bold: CFLAGS += $(BOLDFLAGS) +$(B)/%.bold: | $(B)/% + ln -sf ./ext/bold/runtime/bold_ibh*.o . + ./ext/bold/bold -c -a $(LIBS) $(filter %.o,$^) -o $@ + rm -f bold_ibh*.o + +$(B)/%.full: $(B)/%.o + $(CC) $< $(LDFLAGS) $(LIBS) -o $@ + +$(B)/%.o: | $(B)/ + $(LD) -r $(filter %.o,$^) -o $@ + + +$(O)/fishypack: $(E)/fishypack/packer/header-64.asm | $(O)/ + $(MAKE) -C $(E)/fishypack/packer header-64 + cp $(E)/fishypack/packer/header-64 $@ + +$(O)/vondehi: $(E)/vondehi/vondehi.asm | $(O)/ + $(MAKE) -C $(E)/vondehi vondehi + cp $(E)/vondehi/vondehi $@ + + +$(O)/%.o: $(S)/%.c | $(O)/ + $(CC) $(CFLAGS) -c $< -o $@ + +$(B)/ $(O)/: + @mkdir -vp $@ diff --git a/README.md b/README.md new file mode 100644 index 0000000..c93e9eb --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +liner +===== + +Small Linux demo toolkit. + +Usage +----- + +Edit your stuff in `src/`, edit `Makefile` to include your desired libraries in `PKGS = ` or `LIBS = `, +and edit the `$(B)/demo.o: ` line to include the object files your demo consists of. +Then just run Make! + +License +------- + +[WTFPL](/LICENSE) diff --git a/ext/bold b/ext/bold new file mode 160000 index 0000000..17a5979 --- /dev/null +++ b/ext/bold @@ -0,0 +1 @@ +Subproject commit 17a597978e7c7aa4311fe1b8fb186a6232ccfe4d diff --git a/ext/fishypack b/ext/fishypack new file mode 160000 index 0000000..704b8da --- /dev/null +++ b/ext/fishypack @@ -0,0 +1 @@ +Subproject commit 704b8daea40f4b5dfec2b26e217c712961bbb8fa diff --git a/ext/smol b/ext/smol new file mode 160000 index 0000000..d9dbaae --- /dev/null +++ b/ext/smol @@ -0,0 +1 @@ +Subproject commit d9dbaae27aea733cfb9c90128b222714890b0717 diff --git a/ext/vondehi b/ext/vondehi new file mode 160000 index 0000000..1e8dd70 --- /dev/null +++ b/ext/vondehi @@ -0,0 +1 @@ +Subproject commit 1e8dd70a464d7ab340bc7be244a91cda6d9972bc diff --git a/src/main.c b/src/main.c new file mode 100755 index 0000000..5706560 --- /dev/null +++ b/src/main.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include + + +static void setup(GtkGLArea *gl) +{ + gtk_gl_area_make_current(gl); +} + + +static gboolean render(GtkGLArea *gl, GdkGLContext *ctx) +{ + glBegin(GL_TRIANGLES); + glColor3f(0.1, 0.2, 0.3); + glVertex3f(0, 0, 0); + glVertex3f(1, 0, 0); + glVertex3f(0, 1, 0); + glEnd(); + return TRUE; +} + + +int main(void) { + /* skip one param, who needs it anyway */ + ((void (*)(int *))gtk_init)(NULL); + + /* setup window */ + GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + GtkWidget *gl = gtk_gl_area_new(); + gtk_container_add(GTK_CONTAINER(window), gl); + g_signal_connect(gl, "realize", G_CALLBACK(setup), NULL); + g_signal_connect(gl, "render", G_CALLBACK(render), NULL); + + /* show window */ + gtk_widget_show_all(window); + gtk_window_fullscreen(window); + gtk_main(); + + exit(0); +}