all repos — eureka @ 1e232e2b9a7ce4dbe73773b7cd9123cc15d7e9ad

static site generator based on the 100r.co engine

build.sh (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh

# copy default config if none
if [ ! -e config.h ]; then
  cp config.def.h config.h
fi

# ensure sane environment

if [ ! -d inc ]; then
  mkdir inc
fi

if [ ! -e inc/meta.nav.htm ]; then
  touch inc/meta.nav.htm
fi

# Lint
clang-format -i main.c config.h

# Cleanup
rm -f ./main

# Linux(debug)
# cc -std=c89 -DDEBUG -Wall -Wno-unknown-pragmas -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og -fsanitize=address -fsanitize=undefined main.c -o main

# Linux(fast)
cc main.c -std=c89 -Os -DNDEBUG -g0 -s -Wall -Wno-unknown-pragmas -o main

# RPi
# tcc -Wall main.c -o main

# Plan9
# pcc main.c -o main

# Valgrind
# gcc -std=c89 -DDEBUG -Wall -Wpedantic -Wshadow -Wuninitialized -Wextra -Werror=implicit-int -Werror=incompatible-pointer-types -Werror=int-conversion -Wvla -g -Og main.c -o main
# valgrind ./main

# Build Size
# echo "$(du -b ./main | cut -f1) bytes written"

# Run
if [ "$1" = "-t" ]; then
  shift && ./tw.sh $@
fi
./main
exitstatus=$?
if [ "${exitstatus}" = "0" ]; then
  ./thumbnailer.sh build &
fi

# Cleanup
rm -f ./main

exit ${exitstatus}