3 version: '2.0.0-DEV' # from configure.in
4 + '+' + run_command([find_program('python', required: true),
5 'scripts/patchtag.py'], check: true).stdout().strip(),
6 default_options: run_command([find_program('python', required: true),
7 'scripts/default_options.py'], check: true).stdout().strip().split('\n'))
10 pyton=find_program('python')
12 if meson.is_cross_build()
13 error('cross build is not allowed')
15 if host_machine.system() == 'windows'
16 emacs = find_program('emacs', dirs: [
17 'C:/Program Files/Emacs/', 'C:/Program Files/Emacs/bin/',
18 'C:/Program Files/GNU/', 'C:/Program Files/GNU/bin/'], required: true)
19 install_info_script = files('scripts/inst-info.cmd')
21 if host_machine.system() == 'darwin' # for mac
22 emacs = find_program('Emacs', dirs: [
23 '/Applications/MacPorts/EmacsMac.app/Contents/MacOS/',
24 '/Applications/MacPorts/Emacs.app/Contents/MacOS/',
25 '/opt/local/bin', '/usr/local/bin'], required: true)
27 emacs = find_program('emacs', required: true)
29 install_info_script = files('scripts/inst-info.sh')
31 git = find_program('git', disabler: true, required: false)
32 intall_info = find_program('install-info', disabler: true, required: false)
33 openssl = find_program('openssl', disabler: true, required: false)
34 ncat = find_program('ncat', disabler: true, required: false)
35 python = find_program('python', required: true)
37 patch_tag = meson.project_version().split('+')[1]
38 lisp_dir = get_option('lispdir') / meson.project_name()
40 icon_dir = lisp_dir / 'icons'
42 inl_files = ['navi2ch-decls.el', 'navi2ch-inline.el']
43 el_files_all = ['navi2ch-vars.el', 'navi2ch-face.el', 'navi2ch-util.el', 'navi2ch-net.el', 'navi2ch-socks.el', 'navi2ch-multibbs.el', 'navi2ch-list.el', 'navi2ch-article.el', 'navi2ch-popup-article.el', 'navi2ch-board-misc.el', 'navi2ch-board.el', 'navi2ch-articles.el', 'navi2ch-bookmark.el', 'navi2ch-history.el', 'navi2ch-search.el', 'navi2ch-message.el', 'navi2ch-head.el', 'navi2ch-mona.el', 'navi2ch-e21.el', 'navi2ch-xmas.el', 'navi2ch-splash.el', 'navi2ch-directory.el', 'navi2ch-be2ch.el', 'navi2ch-jbbs-net.el', 'navi2ch-jbbs-shitaraba.el', 'navi2ch-machibbs.el', 'navi2ch-futaba.el', 'navi2ch-megabbs.el', 'navi2ch-http-date.el', 'navi2ch-localfile.el', 'navi2ch-oyster.el', 'navi2ch-auto-modify.el', 'navi2ch-p2.el', 'navi2ch-thumbnail.el', 'navi2ch.el']
44 texi_files = ['doc/navi2ch.texi']
46 if run_command(emacs, '-q', '-batch', '--eval', '(princ (featurep \'xemacs))', check: true).stdout().strip() == 'nil'
47 skip_files = ['navi2ch-xmas.el']
49 skip_files = ['navi2ch-e21.el']
53 foreach el: el_files_all
54 if skip_files.contains(el)
55 message(el + ': skipped')
62 foreach f: ['gikope.el', 'izonmoji-mode.el', 'navi2ch-js-livedoor-move.el', 'navi2ch-logo.el', 'navi2ch-migemo.el', 'navi2ch-pizaunix.el', 'navi2ch-track-mouse.el']
63 contrib_files += 'contrib' / f
66 foreach f: ['plugged.xpm', 'unplugged.xpm']
67 ico_files += 'icons' / f
70 in_files = ['navi2ch-version.el.in', 'navi2ch-config.el.in']
75 cpied_inl += fsmod.copyfile(f, install: true, install_dir: lisp_dir, install_mode: 'rw-r--r--')
76 preloads += ['--eval', '(require \'' + fsmod.stem(f) + ')']
79 dep = '(setq depends (list'
90 output: fsmod.stem(f),
92 install_dir: lisp_dir,
93 install_mode: 'rw-r--r--',
95 'VERSION': meson.project_version(),
96 'icondir': get_option('prefix') / icon_dir,
100 elc_files += fsmod.replace_suffix(c, '.elc')
104 foreach el: el_files + contrib_files
105 cpied_el += fsmod.copyfile(
108 install_dir: lisp_dir,
109 install_mode: 'rw-r--r--',
111 elc_files += fsmod.name(fsmod.replace_suffix(el, '.elc'))
114 rfc3986_el = custom_target(
116 output: 'navi2ch-rfc3986.el',
117 depend_files: [files('scripts/rfc3986-regexp-generator.el')],
118 command: [emacs, '-q', '--batch',
119 '-l', '@SOURCE_ROOT@' / 'scripts/rfc3986-regexp-generator.el',
120 '--eval', '(with-temp-buffer (erase-buffer) (insert ";; automatically generated (do not edit) -*- lexical-binding: t -*-\n;; Generated from rfc3986-regexp-generator.el\n") (insert (prin1-to-string `(defconst navi2ch-rfc3986-rules-alist (quote ,(rfc3986-regexp-generate-alist))))) (insert "\n(provide \'navi2ch-rfc3986)\n") (write-file (car argv)))',
123 install_dir: lisp_dir,
124 install_mode: 'rw-r--r--',
125 build_by_default: true,
127 elc_files += 'navi2ch-rfc3986.elc'
132 input: [rfc3986_el, conf_el, cpied_el],
135 command: [emacs, '-q', '--batch',
136 '--eval', '(require \'cl-extra)',
137 '--eval', '(setq load-path (cons "@OUTDIR@" load-path))',
140 '--eval', '(dolist (el argv) (let* ((base-name (file-name-sans-extension (file-name-sans-extension el))) (name (intern base-name)) (pred (lambda (f) (file-newer-than-file-p (concat base-name ".elc") f)))) (unless (cl-every pred (cons el depends)) (message "compiling %s" el) (byte-compile-file el)) (cond ((memq name \'(navi2ch-xmas)) (when (featurep \'xemacs) (require name))) ((memq name \'(navi2ch-e21)) (unless (featurep \'xemacs) (require name))) (t (require name)))))', '@INPUT@'],
142 install_dir: lisp_dir,
143 install_mode: 'rw-r--r--',
144 build_by_default: true,
147 # generate navi2ch-autoloads.el
148 autoloads = custom_target(
149 input: [conf_el, cpied_el],
150 output: meson.project_name() + '-autoloads.el',
151 # command: [emacs, '-q', '--batch', '--eval', '(require \'package)', '--eval', '(package-generate-autoloads (car argv) (cadr argv))', meson.project_name(), '@OUTDIR@'],
152 command: [emacs, '-q', '--batch',
153 '--eval', '(require \'package)',
154 '--eval', '(require \'nadvice)',
155 '--eval', '(advice-add \'loaddefs-generate :filter-args (lambda (args) (let ((info-extra (prin1-to-string \'(let ((info-dir (directory-file-name (file-name-directory load-file-name)))) (when (file-exists-p (file-name-concat info-dir "dir")) (add-to-list \'Info-directory-list info-dir t)))))) (list (nth 0 args) (nth 1 args) (nth 2 args) (format "%s\n%s" (nth 3 args) info-extra) (nth 4 args) (nth 5 args)))) (list :name "loaddefs-generate:filter-args"))',
156 '--eval', '(package-generate-autoloads (car argv) (cadr argv))', meson.project_name(), '@OUTDIR@'],
158 install_dir: lisp_dir,
159 install_mode: 'rw-r--r--',
162 if intall_info.found()
163 texi2info = files('doc/batch-texi2info.el')
165 if find_program('gzip', disabler: true, required: false).found()
171 foreach ti: texi_files
172 texi = fsmod.copyfile(ti)
173 info += custom_target(
175 output: fsmod.stem(texi.full_path()) + '.info',
176 command: [emacs, '-q', '--batch', '-l', texi2info, '-f', 'batch-texi2info', texi])
178 meson.add_install_script(
179 install_info_script, gzip, info_dir, info,
185 install_dir: icon_dir,
186 install_mode: 'rw-r--r--',
190 if not get_option('disable-test') and openssl.found()
192 foreach i: ['0', '1']
193 ecparams += custom_target(
194 output: 'ecprm' + i + '.pem',
195 command: [openssl, 'ecparam', '-name', 'prime256v1', '-out', '@OUTPUT@'])
198 cacert = custom_target(
199 input: ['test/ssl.conf', ecparams[0]],
200 output: ['ca_key.pem', 'ca_cert.pem', 'ca_cert.srl'],
201 command: [openssl, 'req', '-batch', '-newkey', 'ec:' + '@INPUT1@', '-sha256', '-nodes',
202 '-subj', '/C=JP/ST=Tokyo/O=Snake Oil Company/CN=Snake Oil company Root Certificate Authority',
203 '-keyout', '@OUTPUT0@', '-out', '@OUTPUT1@',
204 '-x509', '-days', '3650', '-extensions', 'v3_ca', '-config', '@INPUT0@'])
206 hostcsr = custom_target(
207 input: ['test/ssl.conf', ecparams[1]],
208 output: ['localhost_key.pem', 'localhost_csr.pem'],
209 command: ['openssl', 'req', '-new', '-newkey', 'ec:' + '@INPUT1@', '-nodes', '-keyout', '@OUTPUT0@',
210 '-subj', '/C=JP/ST=Tokyo/O=Snake Oil Company/OU=Limiment Div./CN=localhost',
211 '-addext', 'subjectAltName=DNS:localhost,DNS:[::1],IP:127.0.0.1,IP:::1',
212 '-out', '@OUTPUT1@'])
214 hostcert = custom_target(
215 input: ['test/ssl.conf', hostcsr[1], cacert],
216 output: 'localhost_cert.pem',
217 command: [openssl, 'x509', '-req', '-in', '@INPUT1@',
218 '-CAkey', '@INPUT2@','-CA', '@INPUT3@',
219 '-CAcreateserial', '-subj', '/C=JP/ST=Tokyo/O=Snake Oil Company/OU=Limiment Div./CN=localhost',
220 '-days', '3650', '-sha256', '-extfile', '@INPUT0@', '-extensions', 'server_ext', '-out', '@OUTPUT@'])
222 net_test_depends = [cacert, hostcert]
223 alias_target('net_test_certs', net_test_depends)
225 net_test_depends = []
228 test_depends = [elc, autoloads]
229 test_env = ['NAVI2CHDIR=' + meson.current_build_dir()]
235 extra_files = ['meson.build', 'meson.options',
236 'test/test-basic.el', 'test/test-network.el',
237 'test/test-basic.sh', 'test/test-network.sh',
239 'scripts/default_options.py', 'scripts/patchtag.py',
240 'scripts/inst-info.cmd', 'scripts/inst-info.sh',
241 'scripts/rfc3986-regexp-generator.el',
242 'scripts/make-patch.sh']
245 output: 'navi2ch-patch-kit-' + patch_tag + '.patch',
246 command: ['scripts/make-patch.sh', '@SOURCE_ROOT@', '@OUTPUT@',
247 [inl_files, el_files_all, texi_files, contrib_files, in_files, extra_files]],
248 depends: [rfc3986_el],
250 build_by_default: false,
258 if not get_option('disable-test')
260 net_test_env = [test_env, 'NCAT=ncat %s %s']
262 net_test_env = test_env
267 files('test/test-basic.sh'),
268 depends: test_depends,
272 files('test/test-network.sh'),
273 depends: [test_depends, net_test_depends],
277 # alias_target('byte-compile', elc)