Skip to content

Commit

Permalink
chore: port to GNU make completely
Browse files Browse the repository at this point in the history
We'll probably want to port the build system to use meson or autoconf in
the future, but this means that everything is in one place.

It's mostly equivalent, except that use the `libbuchstabensuppe.a`
archive directly instead of using `-L. -lbuchstabensuppe`. redo is nice,
but, while its dependency tracking is better, you end up scripting a lot
in a lot of different places.
  • Loading branch information
sternenseemann committed May 1, 2022
1 parent 0431d78 commit 5e5c2a9
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 65 deletions.
38 changes: 33 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,47 @@ LIBDIR ?= $(PREFIX)/lib
INCDIR ?= $(PREFIX)/include
MANDIR ?= $(PREFIX)/share/man

AR ?= ar
RANLIB ?= ranlib
CC ?= cc

# TODO: no -Os, -g only in dev
CFLAGS += -W -Wall -Wextra -pedantic -Os -std=c99 -g
CFLAGS += -Iinclude

.PHONY: all clean install check
all:
redo bs-renderflipdot.exe libbuchstabensuppe.a

# We want to merge the headers anyways so no point in
# tracking dependencies more accurately
BS_HEADERS = include/buchstabensuppe.h
BS_HEADERS += include/buchstabensuppe/bitmap.h
BS_HEADERS += include/buchstabensuppe/flipdot.h

LDFLAGS = -lm -lharfbuzz -lutf8proc -lschrift

all: bs-renderflipdot.exe libbuchstabensuppe.a

bitmap.o: bitmap.c $(BS_HEADERS)
buchstabensuppe.o: buchstabensuppe.c $(BS_HEADERS)
flipdot.o: flipdot.c $(BS_HEADERS)
test.o: test.c third_party/test.h $(BS_HEADERS)
bs-renderflipdot.o: bs-renderflipdot.c $(BS_HEADERS)

libbuchstabensuppe.a: bitmap.o buchstabensuppe.o flipdot.o
$(AR) rc $@ $?
$(RANLIB) $@

%.exe: %.o libbuchstabensuppe.a
$(CC) $(CFLAGS) -o $@ $? $(LDFLAGS)

clean:
rm -f *.o *.a *.exe
rm -rf doc/html

check:
redo test.exe
check: test.exe
./test.exe

install:
install: all
install -Dm755 bs-renderflipdot.exe $(BINDIR)/bs-renderflipdot
install -Dm644 include/buchstabensuppe.h -t $(INCDIR)
install -Dm644 include/buchstabensuppe/bitmap.h -t $(INCDIR)/buchstabensuppe
Expand Down
7 changes: 0 additions & 7 deletions build_config

This file was deleted.

9 changes: 0 additions & 9 deletions default.exe.do

This file was deleted.

30 changes: 0 additions & 30 deletions default.o.do

This file was deleted.

14 changes: 0 additions & 14 deletions libbuchstabensuppe.a.do

This file was deleted.

36 changes: 36 additions & 0 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,46 @@ let
doCheck = true;
};

haskell-buchstabensuppe =
# Update using C-u M-! cabal2nix ./bindings/hs
{ mkDerivation, base, buchstabensuppe, harfbuzz, lib, schrift
, utf8-light, utf8proc
}:
mkDerivation {
pname = "haskell-buchstabensuppe";
version = "0.1.0.0";
src = ./bindings/hs;
isLibrary = true;
isExecutable = true;
libraryHaskellDepends = [ base utf8-light ];
librarySystemDepends = [
buchstabensuppe harfbuzz schrift utf8proc
];
executableHaskellDepends = [ base ];
homepage = "https://github.com/sternenseemann/buchstabensuppe";
description = "Bindings to the buchstabensuppe font rendering library";
license = lib.licenses.bsd3;
}
;

in

{
buchstabensuppe =
assert self.lib.versionAtLeast self.libschrift.version "0.10.1";
self.callPackage buchstabensuppe { };

haskell = super.haskell // {
packageOverrides = hsSelf: hsSuper: {
haskell-buchstabensuppe = self.haskell.lib.compose.overrideSrc {
version = "git";
# Ignore some extra files to avoid unnecessary rebuilds
src = gi.gitignoreSource [
"shell.nix"
] ./bindings/hs;
} (hsSelf.callPackage haskell-buchstabensuppe {
schrift = self.libschrift;
});
};
};
}

0 comments on commit 5e5c2a9

Please sign in to comment.