This commit is contained in:
Shiz 2019-04-21 09:35:17 +02:00
commit 259ba39fb2
9 changed files with 159 additions and 0 deletions

12
.gitmodules vendored Normal file
View File

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

13
LICENSE Normal file
View File

@ -0,0 +1,13 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
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.

72
Makefile Normal file
View File

@ -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 $@

16
README.md Normal file
View File

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

1
ext/bold Submodule

@ -0,0 +1 @@
Subproject commit 17a597978e7c7aa4311fe1b8fb186a6232ccfe4d

1
ext/fishypack Submodule

@ -0,0 +1 @@
Subproject commit 704b8daea40f4b5dfec2b26e217c712961bbb8fa

1
ext/smol Submodule

@ -0,0 +1 @@
Subproject commit d9dbaae27aea733cfb9c90128b222714890b0717

1
ext/vondehi Submodule

@ -0,0 +1 @@
Subproject commit 1e8dd70a464d7ab340bc7be244a91cda6d9972bc

42
src/main.c Executable file
View File

@ -0,0 +1,42 @@
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h>
#include <GL/gl.h>
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);
}