-*- mode: org -*- #+TITLE: spine (doc_reform) (project) makefile #+DESCRIPTION: makefile for spine #+FILETAGS: :spine:build:tools: #+AUTHOR: Ralph Amissah #+EMAIL: [[mailto:ralph.amissah@gmail.com][ralph.amissah@gmail.com]] #+COPYRIGHT: Copyright (C) 2015 - 2020 Ralph Amissah #+LANGUAGE: en #+STARTUP: content hideblocks hidestars noindent entitiespretty #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t #+PROPERTY: header-args :exports code #+PROPERTY: header-args+ :noweb yes #+PROPERTY: header-args+ :eval no #+PROPERTY: header-args+ :results no #+PROPERTY: header-args+ :cache no #+PROPERTY: header-args+ :padline no [[./spine.org][spine.org]] VERSION [[./spine_info.org][spine_info.org]] [[../org/][org/]] * version info VERSION :version:set:project: ** project #+NAME: version_spine #+BEGIN_SRC sh 0.11.1 #+END_SRC ** subprojects - d2sqlite3 #+NAME: version_d2sqlite3 #+BEGIN_SRC sh 0.19.1 #+END_SRC - imageformats #+NAME: version_imageformats #+BEGIN_SRC sh 7.0.2 #+END_SRC - dyaml #+NAME: version_dyaml #+BEGIN_SRC sh 0.8.0 #+END_SRC - tinyendian #+NAME: version_tinyendian #+BEGIN_SRC sh 0.2.0 #+END_SRC ** build tools if specified - meson #+NAME: version_meson #+BEGIN_SRC sh 0.46 #+END_SRC - soversion #+NAME: version_soversion 0 #+END_SRC * makefile :makefile: ** tangle #+BEGIN_SRC makefile :tangle ../makefile <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> <> #+END_SRC ** settings [+2] :settings: *** git version stamp :git:version: #+NAME: make_set_var_0_git_version #+BEGIN_SRC makefile PROG_VER_GIT :=$(shell echo `git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`) PROG_VER_DECLARED :=$(shell echo `cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`) #+END_SRC *** dub (build tool) :dub: #+NAME: make_set_var_1_dub #+BEGIN_SRC makefile DUB=dub DUB_FLAGS=-v --force --compiler= #+END_SRC *** Project Details :project:spine: #+NAME: make_set_var_2_project_details #+BEGIN_SRC makefile PRG_NAME=doc-reform PRG_NICKAME=spine PRG_NAME_DIR=$(shell echo `echo $(PRG_NAME) | sed -e "s/-/_/g"`) PRG_SRC=$(PRG_NAME).d PRG_SRCDIR=./src PRG_BIN=$(PRG_NAME) PRG_BINDIR=./bin PRG_DOCDIR=./docs #+END_SRC *** Emacs Org settings :settings:emacs:org:tangle: #+NAME: make_set_var_3_emacs_org #+BEGIN_SRC makefile EMACSLISP=/usr/share/emacs/site-lisp ORG_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-???????? | cut -d '-' -f2`) EMACSLISP_ORG=~/.emacs.d/elpa/org-$($(shell echo $(ORG_VER_AVAILABLE))) ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-contrib-???????? | cut -d '-' -f2`) EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE))) ORGFILELIST=$(shell echo `ls -1 org/*.org`) ORGFILES="" ORGDIR :=$(shell echo `pwd`) #+END_SRC *** Markup Samples **** pods #+NAME: make_set_var_4_markup_samples_pods #+BEGIN_SRC makefile SiSU_MARKUP_SAMPLES_FIND_PODS= \ find data/pod -maxdepth 2 -name pod.manifest | cut -f 1-3 -d / | sort SiSU_MARKUP_SAMPLES_PODS_FOUND= \ $(SiSU_MARKUP_SAMPLES_FIND_PODS) | xargs SiSU_MARKUP_SAMPLES_POD = \ data/pod/accelerando.charles_stross \ data/pod/alices_adventures_in_wonderland.lewis_carroll \ data/pod/content.cory_doctorow \ data/pod/democratizing_innovation.eric_von_hippel \ data/pod/down_and_out_in_the_magic_kingdom.cory_doctorow \ data/pod/for_the_win.cory_doctorow \ data/pod/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman \ data/pod/free_culture.lawrence_lessig \ data/pod/free_for_all.peter_wayner \ data/pod/gpl2.fsf \ data/pod/gpl3.fsf \ data/pod/gullivers_travels.jonathan_swift \ data/pod/little_brother.cory_doctorow \ data/pod/live-manual \ data/pod/sisu-manual \ data/pod/the_autonomous_contract.ralph_amissah \ data/pod/the_cathedral_and_the_bazaar.eric_s_raymond \ data/pod/the_public_domain.james_boyle \ data/pod/the_wealth_of_networks.yochai_benkler \ data/pod/through_the_looking_glass.lewis_carroll \ data/pod/two_bits.christopher_kelty \ data/pod/un_contracts_international_sale_of_goods_convention_1980 \ data/pod/viral_spiral.david_bollier #+END_SRC **** dir #+NAME: make_set_var_5_markup_samples_search_dirs #+BEGIN_SRC makefile SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND = \ find data/sisudir/media/text -name *.ss[tm] | sort | xargs SiSU_MARKUP_SAMPLES_DIR = \ data/sisudir/media/text/accelerando.charles_stross.sst \ data/sisudir/media/text/alices_adventures_in_wonderland.lewis_carroll.sst \ data/sisudir/media/text/content.cory_doctorow.sst \ data/sisudir/media/text/democratizing_innovation.eric_von_hippel.sst \ data/sisudir/media/text/down_and_out_in_the_magic_kingdom.cory_doctorow.sst \ data/sisudir/media/text/ffa_tmp.sst \ data/sisudir/media/text/for_the_win.cory_doctorow.sst \ data/sisudir/media/text/free_as_in_freedom_2.richard_stallman_and_the_free_software_revolution.sam_williams.richard_stallman.sst \ data/sisudir/media/text/free_culture.lawrence_lessig.sst \ data/sisudir/media/text/free_for_all.peter_wayner.sst \ data/sisudir/media/text/gpl2.fsf.sst \ data/sisudir/media/text/gpl3.fsf.sst \ data/sisudir/media/text/gullivers_travels.jonathan_swift.sst \ data/sisudir/media/text/little_brother.cory_doctorow.sst \ data/sisudir/media/text/sisu_markup.sst \ data/sisudir/media/text/sisu_markup_stress_test.sst \ data/sisudir/media/text/sisu_markup_test.sst \ data/sisudir/media/text/table_special_markup.sst \ data/sisudir/media/text/the_autonomous_contract.ralph_amissah.sst \ data/sisudir/media/text/the_cathedral_and_the_bazaar.eric_s_raymond.sst \ data/sisudir/media/text/the_public_domain.james_boyle.sst \ data/sisudir/media/text/the_wealth_of_networks.yochai_benkler.sst \ data/sisudir/media/text/through_the_looking_glass.lewis_carroll.sst \ data/sisudir/media/text/two_bits.christopher_kelty.sst \ data/sisudir/media/text/un_contracts_international_sale_of_goods_convention_1980.sst \ data/sisudir/media/text/viral_spiral.david_bollier.sst #+END_SRC ******* sample markup file list #+NAME: make_find_markup_samples_0_pod_and_dir #+BEGIN_SRC makefile markup_samples: find data/pod -name pod.manifest | cut -f 1-3 -d / | sort; \ find data/sisudir/media/text -name *.ss[tm] | sort #+END_SRC #+NAME: make_find_markup_samples_1_pod #+BEGIN_SRC makefile markup_pod_samples: find data/pod -name pod.manifest | cut -f 1-3 -d / | sort #+END_SRC #+NAME: make_find_markup_samples_2_dir #+BEGIN_SRC makefile markup_dir_samples: find data/sisudir/media/text -name *.ss[tm] | sort #+END_SRC ** _make_ commands [+2] :make:commands: - build commands - build - debug - release - init, clean, distclean etc. - init - clean - expunge - distclean - distclean_and_init - org babel tangle - tangle - git snapshot - gitsnapshot *** build commands [+1] :build:compile: **** _dub_ build rebuild :dub: ***** all compiler builds :all:dmd:gdc:ldc: ****** all builds ******* default #+NAME: make_dub_upgrade #+BEGIN_SRC makefile dub_upgrade: $(DUB) upgrade #+END_SRC #+NAME: make_compile_0_compiler_default #+BEGIN_SRC makefile default: ldc #+END_SRC ******* quick :quick: ******** default :default: #+NAME: make_compile_1_compiler_all #+BEGIN_SRC makefile all: dmd ldc gdc #+END_SRC ******** version :version: #+NAME: make_compile_2_compiler_all_versioned #+BEGIN_SRC makefile all_ver: dmd_ver ldc_ver gdc_ver #+END_SRC ******** debug :debug: #+NAME: make_compile_3_compiler_all_debug #+BEGIN_SRC makefile all_debug: dmd_debug gdc_debug ldc_debug #+END_SRC ******** _meson_ build :meson: meson using dub - works & looks pretty clean - but subprojects built externally & not suitable for debian packaging #+NAME: make_meson_build #+BEGIN_SRC makefile meson_clean_build_dir: rm -r build; mkdir build meson_build: meson_clean_build_dir meson --buildtype=debugoptimized build ninja -C build notify-send -t 0 'D meson build ldc compiled test release executable ready' 'spine' meson_redo: meson_clean_build_dir meson_build meson_project_build_clean: clean skel tangle dub_upgrade meson_build meson: meson_clean_build_dir dub_upgrade meson_build #+END_SRC ******* clean & tangle :clean:tangle: ******** default :default: #+NAME: make_clean_tangle_compile_0_all_clean #+BEGIN_SRC makefile all_clean: clean tangle dmd ldc gdc #+END_SRC ******** version :version: #+NAME: make_clean_tangle_compile_1_all_clean_versioned #+BEGIN_SRC makefile all_ver_clean: clean tangle dmd_ver ldc_ver gdc_ver #+END_SRC ******** debug :debug: #+NAME: make_clean_tangle_compile_2_all_clean_debug #+BEGIN_SRC makefile all_debug_ver: dmd_debug_ver gdc_debug_ver ldc_debug_ver all_debug_clean_ver: clean tangle dmd_debug_ver gdc_debug_ver ldc_debug_ver #+END_SRC ***** individual compiler builds :each: ****** dmd :dmd: ******* quick :quick: ******** default :default: #+NAME: make_dub_compile_dmd_0_default #+BEGIN_SRC makefile dmd: dub_upgrade $(DUB) --compiler=dmd --config=dmd --build=release-nobounds notify-send -t 0 'D dmd compiled test release executable ready' 'spine-dmd' #+END_SRC ******** debug :debug: #+NAME: make_dub_compile_dmd_1_debug #+BEGIN_SRC makefile dmd_debug: $(DUB) --compiler=dmd --config=dmd --build=debug #+END_SRC ******** version :version: - assumes git tags with program version #+NAME: make_dub_compile_dmd_2_versioned #+BEGIN_SRC makefile dmd_ver: dub_upgrade $(DUB) --compiler=dmd --config=dmd-version mv bin/spine-dmd-ver bin-archive/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-dmd notify-send -t 0 'D dmd compiled test release executable ready' 'spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-dmd' dmd_clean_ver: clean tangle dmd_ver #+END_SRC ******* clean & tangle :clean:tangle: #+NAME: make_dub_compile_dmd_3_release #+BEGIN_SRC makefile dmd_rel: expunge skel tangle $(DUB) --compiler=dmd --config=spine-release dmd_rel_tangle: tangle $(DUB) --compiler=dmd --config=spine-dmd dmd_rel_expunge_tangle: expunge skel tangle dmd_rel_tangle dmd_debug_tangle: tangle $(DUB) --compiler=dmd --config=spine-dmd-debug #+END_SRC ****** gdc :gdc: ******* quick :quick: ******** default :default: #+NAME: make_dub_compile_gdc_0_default #+BEGIN_SRC makefile gdc: dub_upgrade $(DUB) --compiler=gdc --config=gdc notify-send -t 0 'D gdc compiled test release executable ready' 'spine-gdc' #+END_SRC ******** debug :debug: #+NAME: make_dub_compile_gdc_1_debug #+BEGIN_SRC makefile gdc_debug: $(DUB) --compiler=gdc --config=gdc --build=debug #+END_SRC ******** version :version: - assumes git tags with program version #+NAME: make_dub_compile_gdc_2_versioned #+BEGIN_SRC makefile gdc_ver: dub_upgrade $(DUB) --compiler=gdc --config=gdc-version mv bin/spine-gdc-ver bin-archive/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-gdc notify-send -t 0 'D gdc compiled test release executable ready' 'spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-gdc' gdc_clean_ver: clean tangle gdc_ver #+END_SRC ******* clean & tangle :clean:tangle: #+NAME: make_dub_compile_gdc_3_release #+BEGIN_SRC makefile gdc_rel: expunge skel tangle $(DUB) --compiler=gdc --config=spine-release gdc_rel_tangle: tangle $(DUB) --compiler=gdc --config=spine-gdc gdc_rel_expunge_tangle: expunge skel tangle gdc_rel_tangle gdc_debug_tangle: tangle $(DUB) --compiler=gdc --config=spine-gdc-debug #+END_SRC ****** ldc :ldc: ******* quick :quick: ******** default :default: #+NAME: make_dub_compile_ldc_0_default #+BEGIN_SRC makefile ldc: dub_upgrade $(DUB) --compiler=ldc2 --config=ldc --build=release notify-send -t 0 'D ldc compiled test release executable ready' 'spine-ldc' #+END_SRC ******** debug :debug: #+NAME: make_dub_compile_ldc_1_debug #+BEGIN_SRC makefile ldc_debug: $(DUB) --compiler=ldc2 --config=ldc --build=debug #+END_SRC ******** version :version: - assumes git tags with program version #+NAME: make_dub_compile_ldc_2_versioned #+BEGIN_SRC makefile ldc_ver: dub_upgrade $(DUB) --compiler=ldc2 --config=ldc-version mv bin/spine-ldc-ver bin-archive/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-ldc notify-send -t 0 'D ldc2 compiled test release executable ready' 'spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)-ldc' ldc_clean_ver: clean tangle ldc_ver #+END_SRC ******* clean & tangle :clean:tangle: #+NAME: make_dub_compile_ldc_3_release #+BEGIN_SRC makefile ldc_rel: expunge skel tangle $(DUB) --compiler=ldc2 --config=spine-release ldc_rel_tangle: tangle $(DUB) --compiler=ldc2 --config=spine-ldc ldc_rel_expunge_tangle: expunge skel tangle ldc_rel_tangle ldc_debug_tangle: tangle $(DUB) --compiler=ldc2 --config=spine-ldc-debug #+END_SRC ***** generic ****** init clean distclean etc. :clean: #+NAME: make_initialization_operations_0_parts #+BEGIN_SRC makefile reinit: clean skel tangle skel: mkdir -p $(PRG_BINDIR); \ mkdir -p $(PRG_BINDIR)-archive; \ mkdir -p build; \ mkdir -p views; \ mkdir -p data; \ mkdir -p misc/util/d/cgi/search/cgi-bin/src; \ mkdir -p misc/util/d/tools/markup_conversion; \ mkdir -p misc/editor-syntax-etc/emacs; \ mkdir -p misc/editor-syntax-etc/vim/syntax; \ mkdir -p misc/editor-syntax-etc/vim/colors; \ mkdir -p misc/editor-syntax-etc/vim/ftplugin; \ mkdir -p misc/editor-syntax-etc/vim/rc; \ mkdir -p misc/editor-syntax-etc/vim/templates; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/conf; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/io_in; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/io_out; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/meta; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR)/share; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR); \ mkdir -p $(PRG_BINDIR); init: skel clean: rm -rf build; \ rm -rf $(PRG_SRCDIR); \ rm -rf $(PRG_DOCDIR); clean_bin: rm $(PRG_BINDIR)/* clean_src: rm -rf $(PRG_SRCDIR); clean_docs: rm -rf $(PRG_DOCDIR) expunge: rm -f dub.selections.json; \ rm -rf build; \ rm -rf $(PRG_SRCDIR); \ rm -rf $(PRG_BINDIR); \ rm -rf $(PRG_DOCDIR); distclean: expunge distclean_and_init: expunge mkdir -p views; \ mkdir -p misc/util/d/cgi/search/cgi-bin/src; \ mkdir -p misc/util/d/tools/markup_conversion; \ mkdir -p misc/editor-syntax-etc/emacs; \ mkdir -p misc/editor-syntax-etc/vim/syntax; \ mkdir -p misc/editor-syntax-etc/vim/colors; \ mkdir -p misc/editor-syntax-etc/vim/ftplugin; \ mkdir -p misc/editor-syntax-etc/vim/rc; \ mkdir -p misc/editor-syntax-etc/vim/templates; \ mkdir -p $(PRG_SRCDIR)/$(PRG_NAME_DIR); \ mkdir -p $(PRG_BINDIR); #+END_SRC ****** version :version: #+NAME: make_initialization_operations_1_git_version #+BEGIN_SRC makefile ver: echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT) #+END_SRC ****** tangle build rebuild :clean:tangle:build: #+NAME: make_initialization_operations_2_assemble #+BEGIN_SRC makefile clean_tangle_build: clean tangle build tangle_build: tangle build build: $(PRG_SRCDIR)/$(PRG_SRC) $(DC) $(DC_FLAGS) \ $(DC_FLAG_BINOF)$(PRG_BINDIR)/$(PRG_BIN) \ $(PRG_SRCDIR)/$(PRG_SRC) rebuild: $(PRG_SRCDIR)/$(PRG_SRC) $(PRG_BINDIR)/$(PRG_BIN).o clean build makefile_new: make -k tangle_maker restart: clean tangle #+END_SRC *** testrun (program against document markup) :markup:sample: **** pods :pod: ****** find files #+NAME: make_project_testrun_0_find_pods #+BEGIN_SRC makefile find_pods: $(SiSU_MARKUP_SAMPLES_FIND_PODS) #+END_SRC ***** dmd ****** find files #+NAME: make_project_testrun_1 #+BEGIN_SRC makefile dmd_testrun_find: ./bin/spine-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ data/pod/sisu-manual dmd_testrun_find_pod_source: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --source --html --epub \ --output-dir=tmp/program_output_pod dmd_testrun_find_pod_pod: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-dmd -v --pod \ --output-dir=tmp/program_output_pod dmd_testrun_find_pod_html: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-dmd -v --html \ --output-dir=tmp/program_output_pod dmd_testrun_find_pod_epub: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-dmd -v --epub \ --output-dir=tmp/program_output_pod dmd_testrun_find_pod_all: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod #+END_SRC ****** path list #+NAME: make_project_testrun_2 #+BEGIN_SRC makefile dmd_testrun_paths_pod_source: ./bin/spine-dmd -v --source \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) dmd_testrun_paths_pod_pod: ./bin/spine-dmd -v --pod \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) dmd_testrun_paths_pod_html: ./bin/spine-dmd -v --html \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) dmd_testrun_paths_pod_epub: ./bin/spine-dmd -v --epub \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) dmd_testrun_paths_pod_all: ./bin/spine-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) #+END_SRC ***** gdc ****** find files #+NAME: make_project_testrun_3 #+BEGIN_SRC makefile gdc_testrun_find: ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ data/pod/sisu-manual gdc_testrun_find_pod_source: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-gdc -v --source \ --output-dir=tmp/program_output_pod gdc_testrun_find_pod_pod: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-gdc -v --pod \ --output-dir=tmp/program_output_pod gdc_testrun_find_pod_html: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-gdc -v --html \ --output-dir=tmp/program_output_pod gdc_testrun_find_pod_epub: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-gdc -v --epub \ --output-dir=tmp/program_output_pod gdc_testrun_find_pod_all: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod #+END_SRC ****** path list #+NAME: make_project_testrun_4 #+BEGIN_SRC makefile gdc_testrun_paths: ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ data/pod/sisu-manual gdc_testrun_paths_pod_source: ./bin/spine-gdc -v --source \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) gdc_testrun_paths_pod_pod: ./bin/spine-gdc -v --pod \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) gdc_testrun_paths_pod_html: ./bin/spine-gdc -v --html \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) gdc_testrun_paths_pod_epub: ./bin/spine-gdc -v --epub \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) gdc_testrun_paths_pod_all: ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) #+END_SRC ***** ldc ****** find files #+NAME: make_project_testrun_5 #+BEGIN_SRC makefile ldc_testrun_find: ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ data/pod/sisu-manual ldc_testrun_find_pod_source: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --source \ --output-dir=tmp/program_output_pod ldc_testrun_find_pod_pod: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --pod \ --output-dir=tmp/program_output_pod ldc_testrun_find_pod_html: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --html \ --output-dir=tmp/program_output_pod ldc_testrun_find_pod_epub: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --epub \ --output-dir=tmp/program_output_pod ldc_testrun_find_pod_all: $(SiSU_MARKUP_SAMPLES_PODS_FOUND) \ ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod #+END_SRC ****** path list #+NAME: make_project_testrun_6 #+BEGIN_SRC makefile ldc_testrun_paths: ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ data/pod/sisu-manual ldc_testrun_paths_pod_source: ./bin/spine-ldc -v --source \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) ldc_testrun_paths_pod_pod: ./bin/spine-ldc -v --pod \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) ldc_testrun_paths_pod_html: ./bin/spine-ldc -v --html \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) ldc_testrun_paths_pod_epub: ./bin/spine-ldc -v --epub \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) ldc_testrun_paths_pod_all: ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_pod \ $(SiSU_MARKUP_SAMPLES_POD) #+END_SRC **** dir :dir: ***** dmd ****** find files #+NAME: make_project_testrun_7 #+BEGIN_SRC makefile dmd_testrun_find_dir_source: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-dmd -v --source \ --output-dir=tmp/program_output_dir dmd_testrun_find_dir_pod: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-dmd -v --pod \ --output-dir=tmp/program_output_dir dmd_testrun_find_dir_html: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-dmd -v --html \ --output-dir=tmp/program_output_dir dmd_testrun_find_dir_epub: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-dmd -v --epub \ --output-dir=tmp/program_output_dir dmd_testrun_find_dir_all: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir #+END_SRC ****** file list #+NAME: make_project_testrun_8 #+BEGIN_SRC makefile dmd_testrun_filelist_dir_source: ./bin/spine-dmd -v --source \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) dmd_testrun_filelist_dir_pod: ./bin/spine-dmd -v --pod \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) dmd_testrun_filelist_dir_html: ./bin/spine-dmd -v --html \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) dmd_testrun_filelist_dir_epub: ./bin/spine-dmd -v --epub \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) dmd_testrun_filelist_dir_all: ./bin/spine-dmd -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) #+END_SRC ***** gdc ****** find files #+NAME: make_project_testrun_9 #+BEGIN_SRC makefile gdc_testrun_find_dir_source: ./bin/spine-gdc -v --source \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) gdc_testrun_find_dir_pod: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-gdc -v --pod \ --output-dir=tmp/program_output_dir gdc_testrun_find_dir_html: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-gdc -v --html \ --output-dir=tmp/program_output_dir gdc_testrun_find_dir_epub: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-gdc -v --epub \ --output-dir=tmp/program_output_dir gdc_testrun_find_dir_all: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir #+END_SRC ****** file list #+NAME: make_project_testrun_10 #+BEGIN_SRC makefile gdc_testrun_filelist_dir_source: ./bin/spine-gdc -v --source \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) gdc_testrun_filelist_dir_pod: ./bin/spine-gdc -v --pod \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) gdc_testrun_filelist_dir_html: ./bin/spine-gdc -v --html \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) gdc_testrun_filelist_dir_epub: ./bin/spine-gdc -v --epub \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) gdc_testrun_filelist_dir_all: ./bin/spine-gdc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) #+END_SRC ***** ldc ****** find files #+NAME: make_project_testrun_11 #+BEGIN_SRC makefile ldc_testrun_find_dir_source: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-ldc -v --source \ --output-dir=tmp/program_output_dir ldc_testrun_find_dir_pod: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-ldc -v --pod \ --output-dir=tmp/program_output_dir ldc_testrun_find_dir_html: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-ldc -v --html \ --output-dir=tmp/program_output_dir ldc_testrun_find_dir_epub: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-ldc -v --epub \ --output-dir=tmp/program_output_dir ldc_testrun_find_dir_all: $(SiSU_MARKUP_SAMPLES_DIR_FILES_FOUND) \ ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir #+END_SRC ****** file list #+NAME: make_project_testrun_12 #+BEGIN_SRC makefile ldc_testrun_filelist_dir_source: ./bin/spine-ldc -v --source \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) ldc_testrun_filelist_dir_pod: ./bin/spine-ldc -v --pod \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) ldc_testrun_filelist_dir_html: ./bin/spine-ldc -v --html \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) ldc_testrun_filelist_dir_epub: ./bin/spine-ldc -v --epub \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) ldc_testrun_filelist_dir_all: ./bin/spine-ldc -v --source --html --epub --sqlite-discrete \ --sqlite-create --sqlite-update \ --output-dir=tmp/program_output_dir \ $(SiSU_MARKUP_SAMPLES_DIR) #+END_SRC *** org babel tangle batch process command :tangle: **** tangle: org babel tangle *.org #+NAME: make_tangle_0 #+BEGIN_SRC makefile tangle: skel for f in $(ORGFILELIST); do \ ORGFILES="$$ORGFILES \"$$f\""; \ done; \ emacs --batch -Q -q \ --eval "(progn \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP)\")) \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP_ORG)\" t)) \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP_ORG_CONTRIB)\" t)) \ (require 'org)(require 'ob)(require 'ob-tangle) \ (mapc (lambda (file) \ (find-file (expand-file-name file \"$(ORGDIR)\")) \ (setq-local org-src-preserve-indentation t) \ (org-babel-tangle) \ (kill-buffer)) '($$ORGFILES)))" 2>&1 #+END_SRC **** tangle maker: org babel tangle makefile new #+NAME: make_tangle_1 #+BEGIN_SRC makefile tangle_maker: for f in $(ORGFILELIST); do \ ORGFILES="\"org/dr_build_scaffold.org\""; \ done; \ emacs --batch -Q -q \ --eval "(progn \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP)\")) \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP_ORG)\" t)) \ (add-to-list 'load-path \ (expand-file-name \"$(EMACSLISP_ORG_CONTRIB)\" t)) \ (require 'org)(require 'ob)(require 'ob-tangle) \ (mapc (lambda (file) \ (find-file (expand-file-name file \".\")) \ (setq-local org-src-preserve-indentation t) \ (org-babel-tangle) \ (kill-buffer)) '($$ORGFILES)))" 2>&1 #+END_SRC #+NAME: make_nix_project_shell #+BEGIN_SRC makefile nixsh_dmd_nixpkg: ln -sf nixDevEnv/shells/shell-dmd-verNix.nix shell.nix; \ ln -sf nixDevEnv/dub/mkDub-dmd.nix mkDub.nix; \ ls -la shell.nix mkDub.nix | cut -d " " -f 9-; \ nix-shell; nixsh_dmd_user: ln -sf nixDevEnv/shells/shell-dmd-verUser.nix shell.nix; \ ln -sf nixDevEnv/dub/mkDub-dmd.nix mkDub.nix; \ ls -la shell.nix mkDub.nix | cut -d " " -f 9-; \ nix-shell; nixsh_ldc_nixpkg: ln -sf nixDevEnv/shells/shell-ldc-verNix.nix shell.nix; \ ln -sf nixDevEnv/dub/mkDub-ldc.nix mkDub.nix; \ ls -la shell.nix mkDub.nix | cut -d " " -f 9-; \ nix-shell; nixsh_ldc_user: ln -sf nixDevEnv/shells/shell-ldc-verUser.nix shell.nix; \ ln -sf nixDevEnv/dub/mkDub-ldc.nix mkDub.nix; \ ls -la shell.nix mkDub.nix | cut -d " " -f 9-; \ nix-shell; #+END_SRC *** git snapshot #+NAME: make_git_snapshot #+BEGIN_SRC makefile gitsnapshot: distclean tangle git commit -a #+END_SRC ** phony :phony: #+NAME: make_phony #+BEGIN_SRC makefile .PHONY : all build rebuild debug release \ distclean init \ tangle gitsnapshot #+END_SRC * dub.json :dub:config:json: ** dub.json #+BEGIN_SRC json :tangle ../dub.json { "authors": [ "Ralph Amissah" ], "copyright": "Copyright © 2015 - 2020 Ralph Amissah", "name": "spine", "version": "<>", "description": "a sisu like document parser", "homepage": "http://sisudoc.org", "license": "AGPL-3.0+", "targetPath": "./bin", "sourcePaths": [ "./src/doc_reform" ], "stringImportPaths": [ "./views" ], "buildRequirements": [ "allowWarnings" ], "targetType": "executable", "platforms": [ "posix" ], "buildTypes": { "dmd": { "dflags": [ "-J=views", "-I=src/doc_reform" ], "buildOptions": [ "verbose", "inline" ], "buildRequirements": [ "allowWarnings" ] }, "ldc": { "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], "buildOptions": [ "verbose", "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] } }, "dependencies": { "d2sqlite3": "~><>", "imageformats": "~><>", "dyaml": "~><>", "tinyendian": "~><>" }, "configurations": [ { "name": "default", "targetName": "spine" }, { "name": "ldc", "targetName": "spine-ldc" }, { "name": "dmd", "targetName": "spine-dmd" } ], "subConfigurations": { "d2sqlite3": "with-lib" } } #+END_SRC ** +check dub.json+ #+BEGIN_SRC sh :NO-tangle ../dub.json { "authors": [ "Ralph Amissah" ], "copyright": "Copyright © 2015 - 2020 Ralph Amissah", "name": "spine", "description": "a sisu like document parser", "homepage": "http://sisudoc.org", "license": "AGPL-3.0+", "targetPath": "./bin", "sourcePaths": [ "./src/doc_reform" ], "stringImportPaths": [ "./views" ], "buildRequirements": [ "allowWarnings" ], "targetType": "executable", "platforms": [ "posix" ], "dependencies": { "d2sqlite3": "~><>", "imageformats": "~><>", "dyaml": "~><>", "tinyendian": "~><>" }, "subConfigurations": { "d2sqlite3": "all-included" }, "configurations": [ { "name": "default", "targetName": "spine" }, { "name": "ldc", "targetName": "spine-ldc" }, { "name": "dmd", "targetName": "spine-dmd" } ], "buildTypes": { "dmd": { "dflags": [ "-J=views", "-I=src/doc_reform" ], "buildOptions": [ "verbose", "inline" ], "buildRequirements": [ "allowWarnings" ] }, "ldc": { "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ], "buildOptions": [ "verbose", "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] } } } #+END_SRC * dub.sdl :dub:config:sdl: Every DUB package should contain a [[http://code.dlang.org/package-format?lang=json][dub.json]] (or [[http://code.dlang.org/package-format?lang=sdl][dub.sdl]]) not configured here using dub.json for the moment ** header (including dependencies) :header: #+BEGIN_SRC sh :NO-tangle ../dub.sdl :tangle-mode (identity #o755) :shebang #!/usr/bin/env dub name "spine" description "sisu document parser" homepage "http://sisudoc.org" authors "Ralph Amissah" copyright "Copyright (C) 2016 - 2020 Ralph Amissah" license "AGPL-3.0+" targetPath "./bin" #sourcePath "./src/doc_reform" stringImportPaths "./views" buildRequirements "allowWarnings" targetType "executable" platforms "posix" dependency "d2sqlite3" version="~><>" # https://code.dlang.org/packages/d2sqlite3 http://biozic.github.io/d2sqlite3/d2sqlite3 subconfiguration "d2sqlite3" "all-included" dependency "imageformats" version="~><>" # https://code.dlang.org/packages/imageformats https://github.com/lgvz/imageformats dependency "dyaml" version="~><>" # https://code.dlang.org/packages/dyaml https://github.com/dlang-community/D-YAML dependency "tinyendian" version="~><>" # http://code.dlang.org/packages/tinyendian https://github.com/dlang-community/tinyendian // dyaml dependency #+END_SRC ** default time (dub --compiler=dmd --build=release) time (dub --compiler=ldc2 --build=release) time (dub --compiler=gdc --build=release) #+BEGIN_SRC sh :NO-tangle ../dub.sdl configuration "default" { targetName "spine" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine'" } #+END_SRC ** dmd :dmd: time (dub --compiler=dmd -color --config=dmd --build=dmd) time (dub --compiler=dmd -color --config=dmd --build=dmd-release) #+BEGIN_SRC sh :NO-tangle ../dub.sdl configuration "dmd" { targetName "spine-dmd" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-dmd'" } buildType "dmd" { dflags "-J=views" "-I=src/doc_reform" buildOptions "verbose" "inline" buildRequirements "allowWarnings" } buildType "dmd-release" { dflags "-J=views" "-I=src/doc_reform" buildOptions "verbose" "releaseMode" "optimize" "inline" } configuration "dmd-version" { dflags "-J=views" "-I=src/doc_reform" buildOptions "verbose" "optimize" targetName "spine-dmd-ver" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-dmd-ver'" } #+END_SRC buildOptions "verbose" "optimize" // ok works quick compile buildOptions "verbose" "optimize" "inline" // ok works takes ages to compile buildOptions "verbose" "releaseMode" "optimize" "inline" // broken, runtime errors ** ldc :ldc: time (dub --compiler=ldc2 -color --config=ldc --build=ldc) time (dub --compiler=ldc2 -color --config=ldc --build=ldc-release) #+BEGIN_SRC sh :NO-tangle ../dub.sdl configuration "ldc" { targetName "spine-ldc" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-ldc'" } buildType "ldc" { dflags "-O2" "-J=views" "-I=src/doc_reform" buildOptions "verbose" "optimize" "inline" buildRequirements "allowWarnings" } buildType "ldc-local" { dflags "-O2" "-J=views" "-I=src/doc_reform" "-mcpu=native" buildOptions "verbose" "optimize" "inline" buildRequirements "allowWarnings" } buildType "ldc-release" { dflags "-O2" "-J=views" "-I=src/doc_reform" buildOptions "verbose" "optimize" "inline" "releaseMode" } configuration "ldc-version" { dflags "-O2" "-J=views" "-I=src/doc_reform" buildOptions "verbose" "optimize" "inline" "releaseMode" targetName "spine-ldc-ver" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-ldc-ver'" } #+END_SRC ** gdc :gdc: time (dub --compiler=gdc --config=gdc --build=gdc) time (dub --compiler=gdc --config=gdc --build=gdc-release) #+BEGIN_SRC sh :NO-tangle ../dub.sdl configuration "gdc" { targetName "spine-gdc" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-gdc'" } buildType "gdc" { dflags "-O" "-J=views" "-I=src/doc_reform" lflags "-lz" buildOptions "inline" buildRequirements "allowWarnings" } buildType "gdc-release" { dflags "-O2" "-J=views" "-I=src/doc_reform" lflags "-lz" buildOptions "verbose" "optimize" "inline" "releaseMode" } configuration "gdc-version" { dflags "-O2" "-J=views" "-I=src/doc_reform" lflags "-lz" buildOptions "verbose" "optimize" "inline" "releaseMode" targetName "spine-gdc-ver" postGenerateCommands "notify-send -t 0 'D executable ready' 'spine-gdc-ver'" } #+END_SRC *** generic :generic: **** build (sdp) :release: #+BEGIN_SRC sh configuration "build" { name "build" targetType "executable" platforms "posix" targetName "bin/spine" dflags "-J=views" "-I=src/doc_reform" buildOptions "verbose" "releaseMode" "optimize" "inline" postGenerateCommands "notify-send -t 0 'D release executable ready' 'spine'" } #+END_SRC * meson :meson:build: ** notes http://mesonbuild.com/D.html http://mesonbuild.com/Dependencies.html#Dub - create and move to subdirectory rm -r build; mkdir build && cd build - build - regular build (faster compile time): meson && ninja - optimized build (faster program run time): meson --buildtype=debugoptimized && ninja - time build time ( meson --buildtype=debugoptimized && ninja ) - other - flags DFLAGS= DC=ldc2 meson .. *** projects :project: ls -1 ./src/*/**/*.d tree -fi ./src |rg "\.d$" fdfind -e .d tree -if src | rg ".+\.d$" > spine_sources.txt && \ for i in spine_sources.txt; do; \ sed -i "s/\(.\+\.d$\)/ '\1',/g" $i; done && \ cat spine_sources.txt **** project meson.build :filelist: #+BEGIN_SRC sh :tangle ../meson.build project('spine', 'd', license: 'AGPL-3', version: '<>', meson_version: '>=<>' ) #if meson.get_compiler('d').get_id() == 'gcc' # error('spine cannot be compiled with GDC at time. Sorry.') #endif spine_src = [ 'src/doc_reform/spine.d', 'src/doc_reform/conf/compile_time_info.d', 'src/doc_reform/io_in/paths_source.d', 'src/doc_reform/io_in/read_config_files.d', 'src/doc_reform/io_in/read_source_files.d', 'src/doc_reform/io_out/cgi_sqlite_search_form.d', 'src/doc_reform/io_out/create_zip_file.d', 'src/doc_reform/io_out/defaults.d', 'src/doc_reform/io_out/epub3.d', 'src/doc_reform/io_out/html.d', 'src/doc_reform/io_out/hub.d', 'src/doc_reform/io_out/latex.d', 'src/doc_reform/io_out/metadata.d', 'src/doc_reform/io_out/odt.d', 'src/doc_reform/io_out/package.d', 'src/doc_reform/io_out/paths_output.d', 'src/doc_reform/io_out/rgx.d', 'src/doc_reform/io_out/source_pod.d', 'src/doc_reform/io_out/sqlite.d', 'src/doc_reform/io_out/xmls_css.d', 'src/doc_reform/io_out/xmls.d', 'src/doc_reform/meta/conf_make_meta_json.d', 'src/doc_reform/meta/conf_make_meta_structs.d', 'src/doc_reform/meta/conf_make_meta_yaml.d', 'src/doc_reform/meta/defaults.d', 'src/doc_reform/meta/doc_debugs.d', 'src/doc_reform/meta/metadoc.d', 'src/doc_reform/meta/metadoc_from_src.d', 'src/doc_reform/meta/metadoc_harvest.d', 'src/doc_reform/meta/metadoc_harvests_authors.d', 'src/doc_reform/meta/metadoc_harvests_topics.d', 'src/doc_reform/meta/metadoc_object_setter.d', 'src/doc_reform/meta/metadoc_show_config.d', 'src/doc_reform/meta/metadoc_show_make.d', 'src/doc_reform/meta/metadoc_show_metadata.d', 'src/doc_reform/meta/metadoc_show_summary.d', 'src/doc_reform/meta/package.d', 'src/doc_reform/meta/rgx.d', 'src/doc_reform/share/defaults.d', ] source_root = meson.source_root() src_dir = include_directories('src/') # Dependencies dep_tinyendian = dependency('tinyendian', version: '>= <>', fallback: ['tinyendian', 'tinyendian_dep'], method: 'dub') dep_dyaml = dependency('dyaml', version: '>= <>', fallback: ['dyaml', 'dyaml_dep'], method: 'dub') dep_d2sqlite3 = dependency('d2sqlite3', version: '>= <>', fallback: ['d2sqlite3', 'd2sqlite3_dep'], method: 'dub') dep_imageformats = dependency('imageformats', version: '>= <>', fallback: ['imageformats', 'imageformats_dep'], method: 'dub') # Executable spine_exe = executable('spine', [spine_src], include_directories : [src_dir], d_import_dirs: [include_directories('views')], dependencies : [ dep_tinyendian, dep_dyaml, dep_d2sqlite3, dep_imageformats, ], install : true ) #+END_SRC ** meson subprojects [taken care of using dub] :subprojects: *** README #+BEGIN_SRC txt :tangle ../subprojects/README - d2sqlite3 - dub - https://code.dlang.org/packages/d2sqlite3 - upstream - https://github.com/biozic/d2sqlite3 - dyaml - dub - https://code.dlang.org/packages/dyaml - upstream - https://github.com/dlang-community/D-YAML - upstream git clone - https://github.com/dlang-community/D-YAML.git - imageformats - dub - https://code.dlang.org/packages/imageformats - upstream git clone - https://github.com/lgvz/imageformats - tinyendian (dyaml dependency) - dub - http://code.dlang.org/packages/tinyendian - upstream git clone - https://github.com/dlang-community/tinyendian.git #+END_SRC *** d2sqlite3 :d2sqlite3: **** wrap #+BEGIN_SRC sh :tangle ../subprojects/d2sqlite3.wrap [wrap-git] directory = d2sqlite3 url = https://github.com/biozic/d2sqlite3.git revision = head #+END_SRC **** meson.build #+BEGIN_SRC sh :NO-tangle ../subprojects/d2sqlite3.meson.build project('d2sqlite3', 'd', meson_version: '>=<>', license: 'BSL-1.0', version: '<>' ) project_soversion = '<>' src_dir = include_directories('source/') pkgc = import('pkgconfig') sqlite_dep = dependency('sqlite3') d2sqlite3_src = [ 'source/d2sqlite3/database.d', 'source/d2sqlite3/internal/memory.d', 'source/d2sqlite3/internal/util.d', 'source/d2sqlite3/library.d', 'source/d2sqlite3/package.d', 'source/d2sqlite3/results.d', 'source/d2sqlite3/sqlite3.d', 'source/d2sqlite3/statement.d', ] install_subdir('source/d2sqlite3/', install_dir: 'include/d/d2sqlite3/') d2sqlite3_lib = library('d2sqlite3', [d2sqlite3_src], include_directories: [src_dir], dependencies: [sqlite_dep], install: true, version: meson.project_version(), soversion: project_soversion ) pkgc.generate(name: 'd2sqlite3', libraries: d2sqlite3_lib, subdirs: 'd/d2sqlite3/', version: meson.project_version(), requires: ['sqlite3'], description: 'A small wrapper around SQLite for the D programming language.' ) # for use by others which embed this as subproject d2sqlite3_dep = declare_dependency( link_with: [d2sqlite3_lib], dependencies: [sqlite_dep], include_directories: [src_dir] ) #+END_SRC *** dyaml :dyaml: **** wrap #+BEGIN_SRC sh :tangle ../subprojects/dyaml.wrap [wrap-git] directory = dyaml url = https://github.com/dlang-community/D-YAML.git revision = head #+END_SRC **** meson.build (provided by upstream) Upstream provides meson.build #+BEGIN_SRC sh :NO-tangle ../subprojects/D-YAML/meson.build project('D-YAML', 'd', meson_version: '>=<>', subproject_dir: 'contrib', version: '<>' ) project_soversion = '<>' src_dir = include_directories('source/') pkgc = import('pkgconfig') dyaml_src = [ 'source/dyaml/composer.d', 'source/dyaml/constructor.d', 'source/dyaml/dumper.d', 'source/dyaml/emitter.d', 'source/dyaml/encoding.d', 'source/dyaml/escapes.d', 'source/dyaml/event.d', 'source/dyaml/exception.d', 'source/dyaml/linebreak.d', 'source/dyaml/loader.d', 'source/dyaml/node.d', 'source/dyaml/package.d', 'source/dyaml/parser.d', 'source/dyaml/queue.d', 'source/dyaml/reader.d', 'source/dyaml/representer.d', 'source/dyaml/resolver.d', 'source/dyaml/scanner.d', 'source/dyaml/serializer.d', 'source/dyaml/style.d', 'source/dyaml/tagdirective.d', 'source/dyaml/test/common.d', 'source/dyaml/test/compare.d', 'source/dyaml/test/constructor.d', 'source/dyaml/test/emitter.d', 'source/dyaml/test/errors.d', 'source/dyaml/test/inputoutput.d', 'source/dyaml/test/reader.d', 'source/dyaml/test/representer.d', 'source/dyaml/test/resolver.d', 'source/dyaml/test/tokens.d', 'source/dyaml/token.d' ] install_subdir('source/dyaml', install_dir: 'include/d/yaml/') tinyendian_dep = dependency('tinyendian', version: '>=<>', fallback: ['tinyendian', 'tinyendian_dep']) dyaml_lib = library('dyaml', [dyaml_src], include_directories: [src_dir], dependencies: [tinyendian_dep], install: true, version: meson.project_version(), soversion: project_soversion ) pkgc.generate(name: 'dyaml', libraries: dyaml_lib, subdirs: 'd/yaml/', version: meson.project_version(), description: 'YAML parser and emitter for the D programming language.' ) # Make D-YAML easy to use as subproject dyaml_dep = declare_dependency( link_with: dyaml_lib, include_directories: [src_dir], dependencies: [tinyendian_dep] ) #+END_SRC *** imageformats :imageformats: **** wrap #+BEGIN_SRC sh :tangle ../subprojects/imageformats.wrap [wrap-git] directory = imageformats url = https://github.com/lgvz/imageformats.git revision = head #+END_SRC **** meson.build #+BEGIN_SRC sh :NO-tangle ../subprojects/imageformats.meson.build project('imageformats', 'd', meson_version: '>=<>', license: 'BSL-1.0', version: '<>' ) project_soversion = '<>' src_dir = include_directories('.') pkgc = import('pkgconfig') imageformats_src = [ 'imageformats/bmp.d', 'imageformats/jpeg.d', 'imageformats/package.d', 'imageformats/png.d', 'imageformats/tga.d' ] install_subdir('imageformats/', install_dir: 'include/d/imageformats-d/') imageformats_lib = library('imageformats-d', [imageformats_src], include_directories: [src_dir], install: true, version: meson.project_version(), soversion: project_soversion ) pkgc.generate(name: 'imageformats-d', libraries: imageformats_lib, subdirs: 'd/imageformats-d/', version: meson.project_version(), description: 'Decoders for PNG, TGA, BMP, JPEG and encoders for PNG, TGA, BMP.' ) # for use by others which embed this as subproject imageformats_dep = declare_dependency( link_with: [imageformats_lib], include_directories: [src_dir] ) #+END_SRC *** tinyendian (dyaml dependency) :tinyendian: **** wrap #+BEGIN_SRC sh :tangle ../subprojects/tinyendian.wrap [wrap-git] directory = tinyendian url = https://github.com/dlang-community/tinyendian.git revision = head #+END_SRC **** meson.build (provided by upstream) Upstream provides meson.build #+BEGIN_SRC sh :NO-tangle ../subprojects/tinyendian/meson.build # -*- mode: python; -*- project( 'tinyendian', 'd', meson_version: '>=<>', version: '<>', default_options: ['buildtype=release'], ) src_dir = include_directories('source/') pkgc = import('pkgconfig') tinyendian_src = [ 'source/tinyendian.d' ] install_headers(tinyendian_src, subdir: 'd/') tinyendian_lib = library( meson.project_name(), [tinyendian_src], include_directories: [src_dir], version: meson.project_version(), pic: true, install: true, ) pkgc.generate( name: meson.project_name(), libraries: tinyendian_lib, subdirs: 'd/', version: meson.project_version(), description: 'Lightweight endianness library for D.' ) # Make Tinyendian easy to use as subproject tinyendian_dep = declare_dependency( link_with: tinyendian_lib, include_directories: [src_dir] ) #+END_SRC * nix :nix: - default.nix - shell.nix - dub2.nix ** dub2nix notes (from author (Lionello Lunesu) email reply, 2020-10-12) NOTE - https://github.com/lionello/dub2nix - see shell.nix minimal content: #+BEGIN_SRC nix :NO-tangle shell.nix with import {}; let dub2nix-src = fetchTarball { url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; }; dub2nix = (import dub2nix-src) { inherit pkgs; }; in mkShell { buildInputs = [ dub dmd rdmd sqlite dub2nix nix-prefetch-git ]; } #+END_SRC - run: nix-shell - run: dub init - add d2sqlite3 dependency (provide as dependency during “dub init” or add it to the dub.json manually) #+BEGIN_SRC json :NO-tangle dub.json { "authors": [ "Ralph Amissah" ], "copyright": "Copyright © 2020, Ralph Amissah", "description": "A minimal D application.", "license": "AGPL-3", "name": "d2sqlite3_dub2nix", "dependencies": { "d2sqlite3": "~><>" }, "subConfigurations": { "d2sqlite3": "with-lib" } } #+END_SRC - run: dub build - run: dub2nix save creates: dub.selections.nix - Create a new file default.nix with this content: #+BEGIN_SRC nix :NO-tangle default.nix { pkgs ? import {} }: with import ./mkDub.nix { inherit pkgs; }; mkDubDerivation { src = ./.; buildInputs = [ pkgs.sqlite ]; } #+END_SRC - Copy mkDub.nix from the dub2nix project. #+BEGIN_SRC sh aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix #+END_SRC make modificatons if desired - run: nix-build ** envrc :envrc: #+BEGIN_SRC nix :tangle ../.envrc if type lorri &>/dev/null; then echo "direnv: using lorri from PATH ($(type -p lorri))" eval "$(lorri direnv)" else # fall back to using direnv's builtin nix support # to prevent bootstrapping problems. use nix NIX_ENFORCE_PURITY=0 fi # source an additional user-specific .envrc in ./.envrc-local if [ -e .envrc-local ]; then source .envrc-local fi #+END_SRC ** shells shell.nix :shell: *** dmd shell :dmd: - ln -sf nixDevEnv/shells/shell-dmd-verNix.nix shell.nix - ln -sf nixDevEnv/shells/shell-dmd-verUser.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-dmd.nix mkDub.nix **** nixpkg - ln -sf nixDevEnv/shells/shell-dmd-verNix.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-dmd.nix mkDub.nix #+BEGIN_SRC nix :tangle ../nixDevEnv/shells/shell-dmd-verNix.nix { pkgs ? import <> }: let <> in pkgs.mkShell { <> } #+END_SRC **** user - ln -sf nixDevEnv/shells/shell-dmd-verUser.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-dmd.nix mkDub.nix #+BEGIN_SRC nix :tangle ../nixDevEnv/shells/shell-dmd-verUser.nix { pkgs ? import <> }: let <> in pkgs.mkShell { <> } #+END_SRC *** ldc shell :ldc: - ln -sf nixDevEnv/shells/shell-ldc-verNix.nix shell.nix - ln -sf nixDevEnv/shells/shell-ldc-verUser.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-ldc.nix mkDub.nix **** nixpkg - ln -sf nixDevEnv/shells/shell-ldc-verNix.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-ldc.nix mkDub.nix #+BEGIN_SRC nix :tangle ../nixDevEnv/shells/shell-ldc-verNix.nix { pkgs ? import <> }: let <> in pkgs.mkShell { <> } #+END_SRC **** user - ln -sf nixDevEnv/shells/shell-ldc-verUser.nix shell.nix - ln -sf nixDevEnv/dub/mkDub-ldc.nix mkDub.nix #+BEGIN_SRC nix :tangle ../nixDevEnv/shells/shell-ldc-verUser.nix { pkgs ? import {}, }: let <> in pkgs.mkShell { <> } #+END_SRC - overlay header #+BEGIN_SRC nix { pkgs ? import <> }: #+END_SRC *** parts **** dub2nix #+NAME: nix_shell_dub2nix #+BEGIN_SRC nix dub2nix-src = fetchTarball { url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; }; dub2nix = (import dub2nix-src) { inherit pkgs; }; #+END_SRC **** overlays :overlays: #+NAME: nix_shell_overlay_none #+BEGIN_SRC nix { overlays = [ ]; } #+END_SRC ***** (import ./nixDevEnv/overlays/dmdVersion.nix) no working overlay, default none: #+NAME: nix_shell_overlay_user_version_dmd #+BEGIN_SRC nix { overlays = [ ]; } #+END_SRC use if working overlay: #+BEGIN_SRC nix { overlays = [ (import ../overlays/dmdVersion.nix) ]; } #+END_SRC ***** (import ./nixDevEnv/overlays/ldcVersion.nix) #+NAME: nix_shell_overlay_user_version_ldc #+BEGIN_SRC nix { overlays = [ (import ../overlays/ldcVersion.nix) ]; } #+END_SRC **** build inputs #+NAME: nix_shell_buildInputs_dmd #+BEGIN_SRC nix buildInputs = with pkgs; [ nix dub dmd rdmd sqlite dub2nix nix-prefetch-git ]; #+END_SRC #+NAME: nix_shell_buildInputs_ldc #+BEGIN_SRC nix buildInputs = with pkgs; [ nix dub ldc rdmd sqlite dub2nix nix-prefetch-git ]; #+END_SRC *** shell with dmd & ldc :shell: #+NAME: nix_shell_with_compilers_dmd_and_ldc #+BEGIN_SRC nix { pkgs ? import { overlays = [ (import ./nixDevEnv/overlays/ldcVersion.nix) ]; } }: let dub2nix-src = fetchTarball { url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; }; dub2nix = (import dub2nix-src) { inherit pkgs; }; in pkgs.mkShell { buildInputs = with pkgs; [ nix dub dmd ldc rdmd sqlite dub2nix nix-prefetch-git ]; } #+END_SRC *** dub2nix version :dub2nix: #+BEGIN_SRC nix dub2nix-src = fetchTarball { url = "https://github.com/lionello/dub2nix/archive/8e7c65f1fd8c1ef5b32e2bf63ba80fe4f059ec15.tar.gz"; sha256 = "0imlbpv40h303h4mq4vijc9psl401n4sdxn3yp6k4gp2n0853xpm"; }; #+END_SRC ** default.nix :default: #+BEGIN_SRC txt :tangle ../default.nix <> #+END_SRC #+BEGIN_SRC txt :tangle ../project.nix <> #+END_SRC #+NAME: nix_project #+BEGIN_SRC nix { pkgs ? import {}, stdenv ? pkgs.stdenv, }: with import ./mkDub.nix { inherit pkgs; }; mkDubDerivation rec { name = "spine-${version}"; version = "<>"; src = ./.; buildInputs = [ pkgs.sqlite ]; meta = with stdenv.lib; { homepage = http://sisudoc.org; description = "a sisu like document parser"; license = licenses.agpl3Plus; platforms = platforms.linux; maintainers = [ Ralph Amissah ]; }; } #+END_SRC ** mkDub.nix :mkDub: Get current mkDub.nix from the dub2nix project: #+BEGIN_SRC sh aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix #+END_SRC *** mkDub dmd #+BEGIN_SRC nix :tangle ../nixDevEnv/dub/mkDub-dmd.nix { pkgs ? import {}, stdenv ? pkgs.stdenv, rdmd ? pkgs.rdmd, dmd ? pkgs.dmd, dub ? pkgs.dub }: with stdenv; let # Filter function to remove the .dub package folder from src filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( type == "directory" && baseName == ".dub" ); # Convert a GIT rev string (tag) to a simple semver version rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; # Fetch a dependency (source only for now) fromDub = dubDep: mkDerivation rec { name = "${src.name}-${version}"; version = rev-to-version dubDep.fetch.rev; nativeBuildInputs = [ rdmd dmd dub ]; src = dep2src dubDep; buildPhase = '' runHook preBuild export HOME=$PWD dub build -b=release runHook postBuild ''; # outputs = [ "lib" ]; # installPhase = '' # runHook preInstall # mkdir -p $out/bin # runHook postInstall # ''; }; # Adds a local package directory (e.g. a git repository) to Dub dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; # The target output of the Dub package targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; # Remove reference to build tools and library sources disallowedReferences = deps: [ dmd rdmd dub ] ++ builtins.map dep2src deps; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; in { inherit fromDub; mkDubDerivation = lib.makeOverridable ({ src, nativeBuildInputs ? [], dubJSON ? src + "/dub.json", selections ? src + "/dub.selections.nix", deps ? import selections, passthru ? {}, package ? lib.importJSON dubJSON, ... } @ attrs: stdenv.mkDerivation (attrs // { pname = package.name; nativeBuildInputs = [ rdmd dmd dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; disallowedReferences = disallowedReferences deps; passthru = passthru // { inherit dub dmd rdmd pkgs; }; src = lib.cleanSourceWith { filter = filterDub; src = lib.cleanSource src; }; preFixup = '' find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true ''; buildPhase = '' runHook preBuild export HOME=$PWD ${lib.concatMapStringsSep "\n" dub-add-local deps} dub build -b release --combined --skip-registry=all runHook postBuild ''; checkPhase = '' runHook preCheck export HOME=$PWD ${lib.concatMapStringsSep "\n" dub-add-local deps} dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp -r "${targetOf package}" $out/bin runHook postInstall ''; meta = lib.optionalAttrs (package ? description) { description = package.description; } // attrs.meta or {}; } // lib.optionalAttrs (!(attrs ? version)) { # Use name from dub.json, unless pname and version are specified name = package.name; })); } #+END_SRC *** mkDub ldc HACK #+BEGIN_SRC nix :tangle ../nixDevEnv/dub/mkDub-ldc.nix { pkgs ? import {}, stdenv ? pkgs.stdenv, rdmd ? pkgs.rdmd, #dmd ? pkgs.dmd, #gcc ? pkgs.gcc, ldc ? pkgs.ldc, dub ? pkgs.dub }: with stdenv; let # Filter function to remove the .dub package folder from src filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( type == "directory" && baseName == ".dub" ); # Convert a GIT rev string (tag) to a simple semver version rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; # Fetch a dependency (source only for now) fromDub = dubDep: mkDerivation rec { name = "${src.name}-${version}"; version = rev-to-version dubDep.fetch.rev; nativeBuildInputs = [ rdmd ldc dub ]; src = dep2src dubDep; buildPhase = '' runHook preBuild export HOME=$PWD dub build -b=release runHook postBuild ''; # outputs = [ "lib" ]; # installPhase = '' # runHook preInstall # mkdir -p $out/bin # runHook postInstall # ''; }; # Adds a local package directory (e.g. a git repository) to Dub dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; # The target output of the Dub package targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; # Remove reference to build tools and library sources disallowedReferences = deps: [ ldc rdmd dub ] ++ builtins.map dep2src deps; removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; in { inherit fromDub; mkDubDerivation = lib.makeOverridable ({ src, nativeBuildInputs ? [], dubJSON ? src + "/dub.json", selections ? src + "/dub.selections.nix", deps ? import selections, passthru ? {}, package ? lib.importJSON dubJSON, ... } @ attrs: stdenv.mkDerivation (attrs // { pname = package.name; nativeBuildInputs = [ rdmd ldc dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; disallowedReferences = disallowedReferences deps; passthru = passthru // { inherit dub ldc rdmd pkgs; }; src = lib.cleanSourceWith { filter = filterDub; src = lib.cleanSource src; }; preFixup = '' find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true ''; buildPhase = '' runHook preBuild export HOME=$PWD ${lib.concatMapStringsSep "\n" dub-add-local deps} dub build --compiler=ldc2 --build=release --combined --skip-registry=all #dub build -b optimize -b inline --combined --skip-registry=all runHook postBuild ''; checkPhase = '' runHook preCheck export HOME=$PWD ${lib.concatMapStringsSep "\n" dub-add-local deps} dub test --combined --skip-registry=all runHook postCheck ''; installPhase = '' runHook preInstall mkdir -p $out/bin cp -r "${targetOf package}" $out/bin runHook postInstall ''; meta = lib.optionalAttrs (package ? description) { description = package.description; } // attrs.meta or {}; } // lib.optionalAttrs (!(attrs ? version)) { # Use name from dub.json, unless pname and version are specified name = package.name; })); } #+END_SRC ** overlays :overlay: *** compilers (latest versions) [version information set elsewhere] **** ldcVersion.nix overlay :ldc:version: #+BEGIN_SRC nix :tangle ../nixDevEnv/overlays/ldcVersion.nix self: super: rec { pname = "ldc"; <> ldc = super.ldc.overrideAttrs(oldAttrs: rec { inherit pname version sha256; name = "${pname}-${version}"; src = super.fetchurl { url = "https://github.com/ldc-developers/ldc/releases/download/v${version}/ldc-${version}-src.tar.gz"; sha256 = sha256; }; postUnpack = '' patchShebangs . ''; }); } #+END_SRC **** dmdVersion.nix overlay HACK :dmd:version: no working overlay, tangle to work on #+BEGIN_SRC nix :NO-tangle ../nixDevEnv/overlays/dmdVersion.nix self: super: rec { <> dmd = super.dmd.overrideAttrs(oldAttrs: rec { inherit year version sha256; pname = oldAttrs.pname; name = "${pname}-${version}"; src = super.fetchurl { url = "http://downloads.dlang.org/releases/${year}/dmd.${version}.linux.tar.xz"; sha256 = sha256; }; # postUnpack = '' # patchShebangs . # ''; }); } #+END_SRC ** version info REVIEW :version: - https://dlang.org/download.html *** compilers (set latest versions) :compiler:version: **** ldc VERSION :version:set:ldc: - https://github.com/ldc-developers/ldc/releases ***** 1.24.0 HACK - https://github.com/ldc-developers/ldc/releases/tag/v1.24.0 - nix-prefetch-url https://github.com/ldc-developers/ldc/releases/download/v1.24.0/ldc-1.24.0-src.tar.gz #+NAME: ldc_version_info #+BEGIN_SRC nix version = "1.24.0"; sha256 = "0g5svf55i0kq55q49awmwqj9qi1n907cyrn1vjdjgs8nx6nn35gx"; #+END_SRC - ldc-1.24.0 overlay does not build with latest nixos version, nixos-20.09 nixos at ldc-1.20.0 ***** 1.23.0 - https://github.com/ldc-developers/ldc/releases/tag/v1.23.0 - nix-prefetch-url https://github.com/ldc-developers/ldc/releases/download/v1.23.0/ldc-1.23.0-src.tar.gz #+BEGIN_SRC nix version = "1.23.0"; sha256 = "1fdgj222x29as466vdxy9c0m82zzlsb7vnvvh89n2riszcrx463d"; #+END_SRC **** dmd :dmd: https://dlang.org/changelog/index.html https://dlang.org/changelog/pending.html http://downloads.dlang.org/releases/ http://downloads.dlang.org/releases/2.x/ #+NAME: dmd_version_info #+BEGIN_SRC nix version = "2.094.0"; sha256 = "0xhm8m46ahfx3hcibi3vws02zaplny3226f3x8cd8584gzfqyzxp"; year = "2020"; #+END_SRC * .gitignore :gitignore: #+BEGIN_SRC sh :tangle ../.gitignore # git ls-files --others --exclude-from=.git/info/exclude * !.gitignore !README.md !COPYRIGHT !CHANGELOG !makefile !version.txt !dub.json !dub.sdl !meson.build !tangle !*.org !*.d !*.rb !conf.sdl !doc !doc/** !man !man/** !org !misc !misc/** !*.nix !nixDevEnv !nixDevEnv/** !.envrc !src !src/** !data !data/* !data/src/** !data/src_yaml/** !data/pod/** !data/pod_yaml/** !*.sst !*.ssm !**/*.sst !**/*.ssm !subprojects !subprojects/*.wrap #!subprojects/*.meson.build #!subprojects/** !pod.manifest !sisu_document_make !config_local_site !sisudoc !views !docs/*.html !notes notes/** !notes/*.org !notes/sisu-description.sst !notes/reminders !notes/reminders/** .dub/** **/.dub/** **/cgi-bin/** tmp/** *_.org *_.d *_.txt *_ *.swp *~ *~ \#* *.\#* #!*/ #\#* #*.\#* #.reggae/** #+END_SRC * sh script to batch process _emacs org babel tangle_ :shell_script:tangle: [[http://orgmode.org/manual/Batch-execution.html]] creates a shell batch script called "tangle", that will tangle (emacs org babel tangle) org files in ./org/ to create .d source files in ./src/doc_reform/ (similar functionality is contained within the "makefile" created by this "dr_build_scaffold.org" file make tangle) #+BEGIN_SRC sh :tangle ../tangle :tangle-mode (identity #o755) :shebang #!/bin/sh # -*- mode: shell-script -*- # tangle files with org-mode DIR=`pwd` ORGFILES="" EMACSLISP=/usr/share/emacs/site-lisp ORG_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-???????? | cut -d '-' -f2`) EMACSLISP_ORG=~/.emacs.d/elpa/org-$($(shell echo $(ORG_VER_AVAILABLE))) ORG_CONTRIB_VER_AVAILABLE=$(shell echo `ls -d ~/.emacs.d/elpa/org-plus-???????? | cut -d '-' -f2`) EMACSLISP_ORG_CONTRIB=~/.emacs.d/elpa/org-plus-contrib-$($(shell echo $(ORG_CONTRIB_VER_AVAILABLE))) # wrap each argument in the code required to call tangle on it for i in $@; do ORGFILES="$ORGFILES \"$i\"" done emacs --batch -Q -q \ --eval "(progn (add-to-list 'load-path (expand-file-name \"$EMACSLISP\")) (add-to-list 'load-path (expand-file-name \"$EMACSLISP_ORG\" t)) (add-to-list 'load-path (expand-file-name \"$EMACSLISP_ORG_CONTRIB\" t)) (require 'org)(require 'ob)(require 'ob-tangle) (mapc (lambda (file) (find-file (expand-file-name file \"$DIR\")) (setq-local org-src-preserve-indentation t) (org-babel-tangle) (kill-buffer)) '($ORGFILES)))" 2>&1 #|grep tangled #+END_SRC ** build *** dub #+BEGIN_SRC sh :tangle no dub build -h #+END_SRC #+BEGIN_SRC sh time (dub --compiler=dmd --config=spine-dmd --debug=steps) time (dub --compiler=ldc2 --config=spine-ldc --debug=steps) time (dub --compiler=gdc --config=spine-gdc --debug=steps) time (dub --compiler=ldc2 --config=spine-ldc --debug=checkdoc --debug=summary --debug=dumpdoc) time (dub --compiler=ldc2 --config=spine-ldc --debug=io) time (dub --compiler=ldc2 --config=spine-ldc --debug=checkdoc --debug=summary --debug=dumpdoc --debug=io) time (dub --compiler=ldc2 --config=spine-ldc-debug --debug=io) time (dub --compiler=gdc --config=spine-gdc-debug --debug=io) time (dub --compiler=dmd --config=spine-dmd-debug --debug=io) #+END_SRC *** make #+BEGIN_SRC sh time make dmd time make gdc time make ldc time make gdc ldc time make all time make all_ver time make dmd_ver ldc_ver gdc_ver time make restart time make restart ldc time make tangle ldc time make ldc_testrun_find_pod_epub #+END_SRC ** dub zfunc :zfunc: *** ,dubdmd :dmd: #+BEGIN_SRC sh :tangle no time dub --compiler=dmd -v --force #+END_SRC *** ,dubldc :ldc: #+BEGIN_SRC sh :tangle no time dub --compiler=ldc2 -v --force #+END_SRC *** ,dubgdc :gdc: #+BEGIN_SRC sh :tangle no time dub --compiler=gdc -v --force #+END_SRC ** git *** project version echo $(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') *** what files changed git whatchanged --since="1 day ago" --oneline --name-only --pretty=format: | sort -u git log --since="1 day ago" --name-only --pretty=format: | sort -u ** test run *** e.g. time (./bin/spine-ldc --source --html -v --output-dir=tmp/program-output data/pod/sisu-manual/media/text/en/sisu_markup.sst ) time (./bin/spine-ldc --source --html -v --output-dir=tmp/program-output data/pod/sisu-manual ) time (./bin/spine-ldc --source --html -v --output-dir=tmp/program-output data/pod/the_wealth_of_networks.yochai_benkler ) time (./bin/spine-ldc --source --html -v --output-dir=tmp/program-output data/pod/live-manual ) time (~sdp2/bin/spine-ldc --pod --source --html --epub --sqlite-create --sqlite-update -v sisudoc/media/text/en/sisu_markup_stress_test.sst sisudoc/media/text/en/the_wealth_of_networks.yochai_benkler.sst ) can point to directory containing sisudoc.txt file (listing which files to process) time (~sdp2/bin/spine-ldc --html -v sisudoc) # will process source files listed in sisudoc.txt for appropriate files and dir structure e.g. live-manual a multilingual document (with source file inserts .ssi) time (~sdp2/bin/spine-ldc --html --lang=en,es -v sisudoc) time ( find data/pod -name pod.manifest | sort | xargs ./bin/spine-ldc --source --html --epub -v --output-dir=tmp/program-output ) time ( find data/pod -maxdepth 2 -name pod.manifest | sort | xargs ./bin/spine-ldc --source --html --epub -v --output-dir=tmp/program-output ) time ( find data/sisudir/media/text -name *.ss[tm] | sort | xargs ./bin/spine-ldc --source --html --epub -v --output-dir=tmp/program-output ) find data/pod -maxdepth 2 -name pod.manifest | sort | xargs find data/sisudir/media/text -name *.ss[tm] | sort | xargs *** list markup files find data/pod -name pod.manifest | sort find data/sisudir/media/text -name *.ss[tm] | sort time make ldc_testrun_paths_pod_pod time make ldc_testrun_paths_pod_pod | ag "^\".+\"|NOT found" time make ldc_testrun_find_pod_pod time make ldc_testrun_find_dir_pod time make ldc_testrun_filelist_dir_pod ** misc *** compilers - [X] Set D_COMPILER (one of DMD LDC or GDC) - [X] Set debug flags (using DMD standard flag -deb [[http://wiki.dlang.org/Compilers][D Compilers wiki https://wiki.dlang.org/Compilers]] [[http://dlang.org/download.html][D Compilers download http://dlang.org/download.html]] *** dub :dub: https://github.com/dlang/dub/ http://code.dlang.org/getting_started http://code.dlang.org/docs/commandline **** setup ***** dub json or sdlang Every DUB package should contain a [[http://code.dlang.org/package-format?lang=json][dub.json]] or [[http://code.dlang.org/package-format?lang=sdl][dub.sdl]] https://code.dlang.org/package-format?lang=sdl https://code.dlang.org/packages/sdlang-d https://github.com/Abscissa/SDLang-D/blob/master/HOWTO.md https://code.dlang.org/docs/commandline ***** dub dependencies dub list dub upgrade dub fetch taggedalgebraic dub fetch libinputvisitor dub fetch unit-threaded ? sdp ~master: /home/ralph/grotto/repo/git.repo/utils/spine-x/ /home/ralph/.dub/packages/* **** build ***** debug flags #+BEGIN_SRC sh biblio biblio_sorted bibliosorted block bookindex bookindexmatch bookindexraw check checkdoc code comment dumpdoc write out document contents, with object type and ocn endnotes endnotes_build footnotes footnotesdone group header header_and_content header1 headerjson headermakejson headermetadatajson heading headings headingsfound insert io munge node objectrelated1 objectrelated2 objects ocnoff para parabullet parabulletindent paraindent paraindenthang parent poem quote raw source srclines structattrib summary table toc #+END_SRC