blob: a5ef456e49dbd60f09dfc2c22eb0aecd848a021a (
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
|
#!/usr/bin/guile \
--no-auto-compile -s
!#
(define // file-name-separator-string)
(define here (cond ((current-filename) => dirname)
(else (getcwd))))
(define module-dir (string-append here // "module"))
(add-to-load-path module-dir)
(use-modules (util))
;; --with-zoneinfo
(define zoneinfo #t)
;; when zoneinfo
(use-modules (ice-9 rdelim))
(define *develop* #t)
(define PREFIX //)
(define CACHE_DIR (string-append PREFIX // "var/cache/calp"))
(define LIBEXEC (if *develop* here (string-append PREFIX // "usr/lib/calp")))
(define pipe
(-> LIBEXEC
(string-append // "tzget")
((@ (ice-9 popen) open-input-pipe))))
(define path (read-line pipe))
(define names (string-split (read-line pipe) #\space))
(use-modules (util io)
(datetime))
(with-atomic-output-to-file
(string-append module-dir // "autoconfig.scm")
(lambda ()
(display ";;; Commentary:") (newline)
(display ";;; File genererated by ./configure on ")
(display (datetime->string
(current-datetime) "~Y-~m-~d ~H:~M:~S~Z"))
(newline)
(display ";;; DONT make any manual changes") (newline)
(display ";;; Code:") (newline)
(for-each (@ (ice-9 pretty-print) pretty-print)
`((define-module (autoconfig)
use-module: (util config))
,@(when zoneinfo
`((set-config! 'tz-file ,path)
(set-config! 'tz-list (quote ,names))))))))
;; vim:ft=scheme:
|