About Social Code
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-08-21 23:21:39 +0100
committerLucas Fryzek <lucas.fryzek@fryzekconcepts.com>2024-08-21 23:21:39 +0100
commit15d890c7c57f7cce8a84a90d639ab8b86959be62 (patch)
treef52771581927d42b151f72381d4d75c1dcd461d5
parent31d83c2ad43fd562e2fb57fa8eb0acd87d0dc9a1 (diff)
build: switch to using meson
-rwxr-xr-xdeploy.sh1
-rw-r--r--html/feed.xml2
-rw-r--r--html/graphics_feed.xml2
-rw-r--r--makefile63
-rw-r--r--meson.build118
-rw-r--r--tools/meta_tools.lua3
-rwxr-xr-xtools/rss_gen.py18
7 files changed, 134 insertions, 73 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..78ad0d9
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1 @@
+git subtree push --prefix html origin gh-pages
diff --git a/html/feed.xml b/html/feed.xml
index 9b47435..6c008ad 100644
--- a/html/feed.xml
+++ b/html/feed.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Fryzek Concepts</title><atom:link href="https://fryzekconcepts.com/feed.xml" rel="self" type="application/rss+xml"/><link>https://fryzekconcepts.com</link><description>Lucas is a developer working on cool things</description><lastBuildDate>Mon, 29 Jul 2024 23:20:14 -0000</lastBuildDate><item><title>Generating Video</title><link>https://fryzekconcepts.com/notes/generating-video.html</link><description>&lt;p&gt;One thing I’m very interested in is computer graphics. This could be
+<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Fryzek Concepts</title><atom:link href="https://fryzekconcepts.com/feed.xml" rel="self" type="application/rss+xml"/><link>https://fryzekconcepts.com</link><description>Lucas is a developer working on cool things</description><lastBuildDate>Wed, 21 Aug 2024 22:17:23 -0000</lastBuildDate><item><title>Generating Video</title><link>https://fryzekconcepts.com/notes/generating-video.html</link><description>&lt;p&gt;One thing I’m very interested in is computer graphics. This could be
complex 3D graphics or simple 2D graphics. The idea of getting a
computer to display visual data fascinates me. One fundamental part of
showing visual data is interfacing with a computer monitor. This can be
diff --git a/html/graphics_feed.xml b/html/graphics_feed.xml
index be27b83..40028d5 100644
--- a/html/graphics_feed.xml
+++ b/html/graphics_feed.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Fryzek Concepts</title><atom:link href="https://fryzekconcepts.com/feed.xml" rel="self" type="application/rss+xml"/><link>https://fryzekconcepts.com</link><description>Lucas is a developer working on cool things</description><lastBuildDate>Mon, 29 Jul 2024 23:20:15 -0000</lastBuildDate><item><title>2022 Graphics Team Contributions at Igalia</title><link>https://fryzekconcepts.com/notes/2022_igalia_graphics_team.html</link><description>&lt;p&gt;This year I started a new job working with &lt;a
+<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Fryzek Concepts</title><atom:link href="https://fryzekconcepts.com/feed.xml" rel="self" type="application/rss+xml"/><link>https://fryzekconcepts.com</link><description>Lucas is a developer working on cool things</description><lastBuildDate>Wed, 21 Aug 2024 22:17:25 -0000</lastBuildDate><item><title>2022 Graphics Team Contributions at Igalia</title><link>https://fryzekconcepts.com/notes/2022_igalia_graphics_team.html</link><description>&lt;p&gt;This year I started a new job working with &lt;a
href="https://www.igalia.com/technology/graphics"&gt;Igalia’s Graphics
Team&lt;/a&gt;. For those of you who don’t know &lt;a
href="https://www.igalia.com/"&gt;Igalia&lt;/a&gt; they are a &lt;a
diff --git a/makefile b/makefile
deleted file mode 100644
index f48526e..0000000
--- a/makefile
+++ /dev/null
@@ -1,63 +0,0 @@
-SRC_DIR := notes
-BUILD_DIR := build
-HTML_DIR := html
-PAGE_DIR := pages
-SOURCE_DOCS := $(wildcard $(SRC_DIR)/*.md)
-PAGE_DOCS := $(wildcard $(PAGE_DIR)/*.md)
-
-META_DOCS=$(patsubst $(SRC_DIR)/%,$(BUILD_DIR)/%,$(SOURCE_DOCS:.md=.meta))
-HTML_DOCS=$(patsubst $(SRC_DIR)/%,$(HTML_DIR)/notes/%,$(SOURCE_DOCS:.md=.html))
-SOURCE_FILES=$(patsubst $(SRC_DIR)/%,%,$(SOURCE_DOCS:.md=))
-PAGE_FILES=$(patsubst $(PAGE_DIR)/%,$(HTML_DIR)/%,$(PAGE_DOCS:.md=.html))
-
-export PLANTUML_LIMIT_SIZE=16384
-
-$(BUILD_DIR)/%.meta: $(SRC_DIR)/%.md
- @mkdir -p $(BUILD_DIR)
- pandoc --write=tools/link_gen.lua $< -o $@
-
-.PRECIOUS: $(META_DOCS)
-$(HTML_DIR)/notes/%.html: $(BUILD_DIR)/%.meta $(META_DOCS)
- @mkdir -p $(HTML_DIR)
- @mkdir -p $(HTML_DIR)/notes
- pandoc -s --template=./templates/main.html \
- --lua-filter=./tools/note.lua \
- --filter ./tools/pandoc-plantuml.py \
- $(patsubst $(BUILD_DIR)/%,$(SRC_DIR)/%,$(<:.meta=.md)) \
- --highlight-style=pygments \
- -o $@
-
-$(HTML_DIR)/%.html: $(PAGE_DIR)/%.md
- @mkdir -p $(HTML_DIR)
- pandoc -s --template=./templates/main.html \
- $< \
- --highlight-style=pygments \
- -M main_class="html-main-page" \
- -M main_container="main-container-page" \
- --filter ./tools/pandoc-plantuml.py \
- -o $@
-
-$(HTML_DIR)/feed.xml: $(META_DOCS)
- ./tools/rss_gen.py $@
-
-$(HTML_DIR)/graphics_feed.xml: $(META_DOCS)
- ./tools/rss_gen.py $@ igalia graphics
-
-$(HTML_DIR)/index.html: $(HTML_DOCS) $(PAGE_FILES) $(HTML_DIR)/feed.xml $(HTML_DIR)/graphics_feed.xml
- touch $(HTML_DIR)/.nojekyll
- pandoc -s --lua-filter=./tools/front_page.lua --template=./templates/main.html main.md \
- --metadata=note_list:"$(SOURCE_FILES)" \
- -o $@
-
-.PHONY: all clean
-.DEFAULT_GOAL := all
-
-all: $(HTML_DIR)/index.html
-
-deploy: all
- git subtree push --prefix html origin gh-pages
-
-clean:
- rm -rf build
- find html -name "*.html" -type f -delete
- find html -name "*.xml" -type f -delete
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..1b87184
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,118 @@
+project('blog')
+
+src_dir = 'notes'
+page_dir = 'pages'
+
+source_docs = [
+ '2022_igalia_graphics_team.md',
+ 'android_swrast.md',
+ 'baremetal-risc-v.md',
+ 'converting_from_3d_to_2d.md',
+ 'digital_garden.md',
+ 'freedreno_journey.md',
+ 'generating-video.md',
+ 'global_game_jam_2023.md',
+ 'mesa_23_1_contributions_behind_the_scenes.md',
+ 'n64brew-gamejam-2021.md',
+ 'rasterizing-triangles.md',
+ 'vulkanised_2024.md',
+]
+
+page_docs = [
+ 'about.md',
+ 'now.md',
+]
+
+source_doc_no_ext = []
+foreach source : source_docs
+ source_doc_no_ext += source.substring(0, -3)
+endforeach
+
+page_doc_no_ext = []
+foreach source : page_docs
+ page_doc_no_ext += source.substring(0, -3)
+endforeach
+
+pandoc = find_program('pandoc')
+link_gen = join_paths(meson.source_root(), 'tools/link_gen.lua')
+note = join_paths(meson.source_root(), 'tools/note.lua')
+front_page = join_paths(meson.source_root(), 'tools/front_page.lua')
+plantuml = join_paths(meson.source_root(), 'tools/pandoc-plantuml.py')
+main_template = join_paths(meson.source_root(), 'templates/main.html')
+rss_gen = join_paths(meson.source_root(), 'tools/rss_gen.py')
+meta_files = []
+lua_env = {'LUA_PATH' : meson.source_root() + '/?.lua' + ';;'}
+
+foreach source : source_doc_no_ext
+ source_file = join_paths(src_dir, source + '.md')
+ meta_file = source + '.meta'
+ html_file = source + '.html'
+ meta = custom_target(meta_file,
+ input : [link_gen, source_file],
+ output : meta_file,
+ command : [pandoc, '--write', '@INPUT@', '-o', '@OUTPUT@'],
+ env : lua_env)
+ meta_files += meta
+ html = custom_target(html_file,
+ input : [main_template, note, plantuml, meta, source_file],
+ output : html_file,
+ command : [pandoc, '-s', '--template', '@INPUT0@',
+ '--lua-filter', '@INPUT1@',
+ '--filter', '@INPUT2@',
+ '@INPUT4@',
+ '--highlight-style=pygments',
+ '-o', '@OUTPUT@',
+ '-V', 'build_root=@0@'.format(meson.build_root())],
+ env : lua_env,
+ install : true,
+ install_dir : 'notes')
+endforeach
+
+foreach source : page_doc_no_ext
+ source_file = join_paths(page_dir, source + '.md')
+ html_file = source + '.html'
+ custom_target(html_file,
+ input : [main_template, source_file, plantuml],
+ output : html_file,
+ command : [pandoc, '-s', '--template', '@INPUT0@',
+ '@INPUT1@',
+ '--highlight-style=pygments',
+ '-M', 'main_class=html-main-page',
+ '-M', 'main_container=main-container-page',
+ '--filter', '@INPUT2@',
+ '-V', 'build_root=@0@'.format(meson.build_root()),
+ '-o', '@OUTPUT@'],
+ env : lua_env,
+ install : true,
+ install_dir : '')
+endforeach
+
+# Generate index.html
+custom_target('index.html',
+ input : [front_page, main_template, 'main.md', meta_files],
+ output : 'index.html',
+ command : [pandoc, '-s', '--lua-filter', '@INPUT0@',
+ '--template', '@INPUT1@',
+ '@INPUT2@',
+ '--metadata=note_list:@0@'.format(' '.join(source_doc_no_ext)),
+ '-V', 'build_root=@0@'.format(meson.build_root()),
+ '-o', '@OUTPUT@'],
+ env : lua_env,
+ install : true,
+ install_dir : '')
+
+custom_target('feed.xml',
+ input : [rss_gen, meta_files],
+ output : 'feed.xml',
+ command : [rss_gen, meson.source_root(), meson.build_root(), '@OUTPUT@'],
+ env : lua_env,
+ install : true,
+ install_dir : '')
+
+custom_target('graphics_feed.xml',
+ input : [rss_gen, meta_files],
+ output : 'graphics_feed.xml',
+ command : [rss_gen, meson.source_root(), meson.build_root(), '@OUTPUT@', 'igalia', 'graphics'],
+ env : lua_env,
+ install : true,
+ install_dir : '')
diff --git a/tools/meta_tools.lua b/tools/meta_tools.lua
index 006e156..3687a27 100644
--- a/tools/meta_tools.lua
+++ b/tools/meta_tools.lua
@@ -33,7 +33,8 @@ function meta_tools.write_link_file(name, links)
end
function meta_tools.get_note(note_name)
- local file = io.open(string.format("build/%s.meta", note_name), "r")
+ local build_root = PANDOC_WRITER_OPTIONS.variables["build_root"]
+ local file = io.open(string.format("%s/%s.meta", build_root, note_name), "r")
local note = {}
for line in file:lines() do
diff --git a/tools/rss_gen.py b/tools/rss_gen.py
index f2b55c7..c3f74ad 100755
--- a/tools/rss_gen.py
+++ b/tools/rss_gen.py
@@ -25,7 +25,8 @@ ET.SubElement(channel, "lastBuildDate").text = today
notes = []
-build_dir = "./build"
+source_dir = sys.argv[1]
+build_dir = sys.argv[2]
for file in os.listdir(build_dir):
if file.endswith(".meta"):
path = os.path.join(build_dir, file)
@@ -43,9 +44,9 @@ notes.sort(key=lambda note: datetime.datetime.strptime(note["date"], "%Y-%m-%d")
limit_cat = False
categories = []
-if len(sys.argv) >= 3:
+if len(sys.argv) >= 5:
limit_cat = True
- categories = sys.argv[2:]
+ categories = sys.argv[4:]
for note in notes:
if limit_cat:
@@ -64,10 +65,13 @@ for note in notes:
ET.SubElement(item, "title").text = note["title"]
ET.SubElement(item, "link").text = post_url
-
# Generate simple text version of post
- process = Popen(["pandoc", "--lua-filter=./tools/note.lua", "--highlight-style=pygments",
- "./notes/{}.md".format(note["name"])], stdout=PIPE)
+ process = Popen(["pandoc",
+ "--lua-filter={source}/tools/note.lua".format(source=source_dir),
+ "--highlight-style=pygments",
+ "{source}/notes/{note}.md".format(source=source_dir, note=note["name"]),
+ "-V", 'build_root={}'.format(build_dir)]
+ ,stdout=PIPE)
(output, err) = process.communicate()
exit_code = process.wait()
ET.SubElement(item, "description").text = output.decode()
@@ -78,4 +82,4 @@ for note in notes:
ET.SubElement(item, "guid").text = post_url
tree = ET.ElementTree(rss)
-tree.write(sys.argv[1], encoding='utf-8', xml_declaration=True)
+tree.write(sys.argv[3], encoding='utf-8', xml_declaration=True)