summaryrefslogtreecommitdiffhomepage
path: root/org/config_make.org
blob: 2c7e8d9dc94c1ea63b05750c768ccad71785c03b (plain)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
-*- mode: org -*-
#+TITLE:       sisudoc 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 - 2024 Ralph Amissah
#+LANGUAGE:    en
#+STARTUP:     content hideblocks hidestars noindent entitiespretty
#+PROPERTY:    header-args  :exports code
#+PROPERTY:    header-args+ :noweb yes
#+PROPERTY:    header-args+ :results no
#+PROPERTY:    header-args+ :cache no
#+PROPERTY:    header-args+ :padline no
#+PROPERTY:    header-args+ :mkdirp yes

- [[./doc-reform.org][doc-reform.org]]  [[../org/][org/]]

* project
** version info SET VERSION :version:set:project:
*** project VERSION

#+NAME: spine_version
#+HEADER: :noweb yes
#+BEGIN_SRC emacs-lisp
<<./sisudoc_spine_version_info_and_doc_header_including_copyright_and_license.org:spine_project_version()>>
#+END_SRC

*** build tools if specified

- meson

#+NAME: meson_version_set
#+BEGIN_SRC sh
0.46
#+END_SRC

- soversion

#+NAME: soversion_version_set
#+BEGIN_SRC sh
0
#+END_SRC

* dr spine_search
** spine_search makefile :makefile
*** tangle

#+HEADER: :tangle ../makefile
#+HEADER: :noweb yes
#+BEGIN_SRC makefile
#include .envrc-local
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'`)

default: flake-check

flake-check:
	nix flake update; \
	nix flake check; \
	echo -e 'nix flake show ❯❯\n'; \
	nix flake show; \
	echo -e '\n❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh\n'; \
	echo -e '❯❯ nix develop\n❯❯ nix develop -c zsh\n'; \
	echo -e '❯❯ nix build ".#spine-ldc" --print-build-logs |& nom\n❯❯ nix build ".#spine-dmd" --print-build-logs |& nom\n'; \
	echo -e '❯❯ make -s\n❯❯ make -s nix-build-ldc\n❯❯ make -s nix-build-dmd\n'; \
	echo -e '❯❯ make -s ldc\n❯❯ make -s dmd\n'; \
	echo -e '❯❯ $(DUB) --compiler=ldmd2 --build=ldmd2\n❯❯ $(DUB) --compiler=dmd --build=dmd\n';

nix-devshell:
	echo -ne '\n❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell"\n\n❯❯ nix build ".#default" --print-build-logs\n❯❯ nix build ".#spine-search-dmd" --print-build-logs\n❯❯ nix build ".#spine-search-ldc" --print-build-logs\n❯❯ nix build ".#spine-search-gdc" --print-build-logs\n\n'; \
	nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell"

# nix build
build: nix-build-default

nix-build-default:
	nix build ".#default" --print-build-logs

nix-build-dmd:
	nix build ".#spine-search-dmd" --print-build-logs

nix-build-ldc:
	nix build ".#spine-search-ldc" --print-build-logs

nix-build-gdc:
	nix build ".#spine-search-gdc" --print-build-logs

# get project external dependencies
get_depends:
	hwd=$$(echo `pwd`) && \
	gwd="$${hwd}/src/ext_depends" && \
	license_bsl="Boost Software License 1.0 (BSL-1.0)" && \
	echo $${hwd} && \
	echo $${gwd} && \
	dub upgrade; \
	deps=`echo "d2sqlite3 arsd"` && \
	for dir in $${deps}; do \
	  if [ ! -d $${gwd}/$${dir} ]; then \
	    mkdir -p $${gwd}/$${dir}; \
	  fi; \
	done; \
	cd $${gwd} && \
	for dir in $${deps}; do \
	  if [ -d $${dir} ]; then \
	    echo $${dir} && \
	    if [ "arsd" == $${dir} ]; then \
	      echo $${dir} && \
	      rm -rf $${dir} && \
        mkdir $${dir} && \
	      cd $${dir} && \
	        wget "$${dir}/cgi.d" "https://raw.githubusercontent.com/adamdruppe/arsd/master/core.d"; \
	        wget "$${dir}/cgi.d" "https://raw.githubusercontent.com/adamdruppe/arsd/master/cgi.d" && \
	      cd $${gwd}; \
	    elif [[ "d2sqlite3" == $${dir} ]]; then \
	      echo $${dir} && \
	      rm -rf $${dir} && \
	      git clone --depth=1 https://github.com/dlang-community/$${dir} && \
	      cd $${dir} && \
	        echo "$${dir} `git rev-parse HEAD | cut -c 1-8`"   > ../$${dir}.meta && \
	        echo "https://github.com/dlang-community/$${dir}" >> ../$${dir}.meta && \
	        echo "$${license_bsl}"                            >> ../$${dir}.meta && \
	      cd $${gwd} && \
	      rm -rf $${dir}/.git; \
	    fi; \
	  fi; \
	done; \
	cd $${hwd}

# get and set project external dependencies
set_depends: get_depends
	dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g'  > dub_describe.json

# cp cgi search form
cp-cgi:
	sudo cp -vi /var/www/cgi/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search_old && \
	sudo cp -vi result/share/cgi-bin/spine_search /var/www/cgi/cgi-bin/spine_search

# git archive
gitZip:
	if [ ! -d "./tarballGitHEAD"  ]; then \
	  mkdir ./tarballGitHEAD; \
	fi; \
	git archive -v --format=tar --prefix=`echo spine-search-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ./tarballGitHEAD/spine-search-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \
	echo "to unzip: tar -xzf spine-search-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz"
#+END_SRC