all repos — min @ 018c4828da8785ed64e99d89e1388ef8177af694

A small but practical concatenative programming language.

tasks/build.min

 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
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
#!/usr/bin/env min

"_helpers" require :helpers 'helpers import

(
  symbol cz
  ('sym :stage 'sym :variant 'sym :target-os ==>)
  (
    "-d:release" :d-stage
    (stage "dev" ==)
      ("-d:dev" @d-stage)
    when
    " " :d-variant
    "min" :o-variant
    (variant length 0 >) (
      "-d:$# " (variant) =% @d-variant
      "$#min" (variant) =% @o-variant
    ) when
    "nim" required
    "Building $# - $# (x64)" (o-variant target-os) =% notice!
    "" :musl
    "musl-gcc" which :musl-gcc
    (musl-gcc length 0 >)
      ("--gcc.exe:musl-gcc --gcc.linkerexe:musl-gcc" @musl)
    when
    "nim c $# -d:ssl $# --cpu:amd64 --os:$# $#-o:$# min" (d-stage musl target-os d-variant o-variant) =% puts ! pop
    {}
      target-os %os
      config /version %version
      o-variant %exe
    (stage "dev" !=)
      (pack)
    when
  )
) ::
;; Builds and packs a min executable.

#| Tasks |#

(
  symbol guide
  (==>)
  (
    "hastyscribe" required
    "Building - guide" notice!
    "hastyscribe Min_DeveloperGuide.md --field/version=$#" (version) =% !
    !"cp Min_DeveloperGuide.htm site/output/guide.dev.html"
  )
) ::
;; Builds the developer guide.

(
  symbol site
  (==>)
  (
    "hastysite" required 
    "Building - site" notice!
    !"cd site && hastysite build && cd .."
  )
) ::
;; Builds the min site.

(
  symbol pack
  (dict :vdata ==>)
  (
    vdata /exe :exe
    (vdata /os "windows" ==) ("$#.exe" (exe) =% @exe) when
    "$exe:_v$version:_$os:_x64.zip" :fn
    fn vdata dpairs % ":" "" replace @fn
    "Compressing: $#" (fn) =% notice!
    (exe) => fn zip
  )
) ::
;; Compresses a min executable.

(
  symbol vim
  (==>)
  (
    config /version :min-version
    "tasks/templates/min.vim" fread :template
    timestamp "dd MMM YYYY" tformat :date
    min-symbols " " join :symbols
    "min.vim" :out-file
    "Building - min.vim" notice!
    template ("date" date "version" min-version "symbols" symbols) =% out-file fwrite 
  )
) ::
;; Generates the min.vim file.

(
  symbol docs
  (==>)
  (
    guide
    site
  )
) ::
;; Generate the min development guide and site.

(
  symbol lite
  (==>)
  ("" "lite" os cz)
) ::
;; Builds litemin on the current OS.

(
  symbol mini
  (==>)
  ("" "mini" os cz)
) ::
;; Builds minimin on the current OS.
(
  symbol dev
  (==>)
  ("dev" "" os cz)
) ::
;; Builds min (dev version) on the current OS.
(
  symbol default
  (==>)
  ("" "" os cz)
) ::
;; Builds min on the current OS.
(
  symbol linux
  (==>)
  ("" "" "linux" cz)
) ::
;; Builds min for Linux.
(
  symbol linux-lite
  (==>)
  ("" "lite" "linux" cz)
) ::
;; Builds litemin for Linux.
(
  symbol linux-mini
  (==>)
  ("" "" "linux-mini" cz)
) ::
;; Builds minimin for Linux.
(
  symbol macosx
  (==>)
  ("" "" "macosx" cz)
) ::
;; Builds min for macOS.
(
  symbol macosx-lite
  (==>)
  ("" "lite" "macosx" cz)
) ::
;; Builds litemin for macOS.
(
  symbol macosx-mini
  (==>)
  ("" "" "macosx-mini" cz)
) ::
;; Builds minimin for macOS.
(
  symbol windows
  (==>)
  ("" "" "windows" cz)
) ::
;; Builds min for Windows.
(
  symbol windows-lite
  (==>)
  ("" "lite" "windows" cz)
) ::
;; Builds litemin for Windows.
(
  symbol windows-mini
  (==>)
  ("" "" "windows-mini" cz)
) ::
;; Builds minimin for Windows.