summaryrefslogtreecommitdiff
path: root/gnu/packages/sml.scm
blob: af7f15512ba6b1001383a7ab773cc64146973109 (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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2019, 2020 Brett Gilio <brettg@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu packages sml)
  #:use-module (gnu packages lesstif)
  #:use-module (gnu packages libffi)
  #:use-module (gnu packages multiprecision)
  #:use-module (gnu packages xorg)
  #:use-module (guix build-system gnu)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix gexp))

(define-public polyml
  (package
    (name "polyml")
    (version "5.8")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/polyml/polyml.git")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1jabrf9cnmsppawga6q5pjiq1cdayilxp66fkxykczs6vv2gz7f9"))))
    (build-system gnu-build-system)
    (inputs
     `(("gmp" ,gmp)
       ("lesstif" ,lesstif)
       ("libffi" ,libffi)
       ("libx11" ,libx11)
       ("libxt" ,libxt)))
    (arguments
     '(#:configure-flags
       (list "--with-system-libffi=yes"
             "--with-x=yes"
             "--with-threads=yes"
             "--with-gmp=yes")
       #:phases
       (modify-phases %standard-phases
         (add-after 'build 'build-compiler
           (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
             (define flags
               (if parallel-build?
                   (cons (format #f "-j~d" (parallel-job-count))
                         make-flags)
                   make-flags))
             (apply system* "make" (append flags (list "compiler"))))))))
    (home-page "https://www.polyml.org/")
    (synopsis "Standard ML implementation")
    (description "Poly/ML is a Standard ML implementation.  It is fully
compatible with the ML97 standard.  It includes a thread library, a foreign
function interface, and a symbolic debugger.")
    ;; Some source files specify 'or any later version'; some don't
    (license
     (list license:lgpl2.1
           license:lgpl2.1+))))

(define (smlnj-file version filename hash)
  (origin
    (method url-fetch)
    (uri (string-append "http://smlnj.cs.uchicago.edu/dist/working/" version "/" filename))
    (sha256
     (base32
      hash))))

(define-public smlnj
  (package
    (name "smlnj")
    (version "110.94")
    (source #f) ; Sources are passed as native-inputs.
    (build-system gnu-build-system)
    (arguments
     '(#:phases
       (modify-phases %standard-phases
         (replace 'unpack
           (lambda* (#:key inputs #:allow-other-keys)
             (for-each
              (lambda (file)
                (invoke "tar" "xvf" (assoc-ref inputs file)))
              (list "config"
                    "cm"
                    "compiler"
                    "runtime"
                    "system"
                    "MLRISC"
                    "smlnj-lib"
                    "old-basis"
                    "ckit"
                    "nlffi"
                    "cml"
                    "eXene"
                    "ml-lpt"
                    "ml-lex"
                    "ml-yacc"
                    "ml-burg"
                    "pgraph"
                    "trace-debug-profile"
                    "heap2asm"
                    "smlnj-c"))
             #t))
         (delete 'configure)
         (replace 'patch-source-shebangs
           (lambda _ (substitute*
                         (list "config/install.sh"
                               "runtime/objs/mk.amd64-linux")
                       (("/bin/sh") (which "sh")))))
         (replace 'build
           (lambda* (#:key inputs #:allow-other-keys)
             (substitute* "config/chk-global-names.sh"
               (("CC=.*") "CC=gcc"))
             (substitute* "config/unpack"
               (("# Now do it:") "exit 0"))
             (substitute* "config/_arch-n-opsys"
               (("uname") (which "uname")))
             (substitute* "config/install.sh"
               (("DEFAULT_SIZE=\"32\"")
                "DEFAULT_SIZE=\"64\"")
               (("BASEDIR=\\$ROOT/base")
                "BASEDIR=$ROOT"))
             (invoke "sh" "config/install.sh"))))))
    (native-inputs
     `(("cm"
        ,(smlnj-file version
                     "cm.tgz"
                     "1x70nrk1gnxrzx16c7dyns35zkrqc0ngqyk34880ih04ccwmyxkp"))
       ("smlnj-c"
        ,(smlnj-file version
                     "smlnj-c.tgz"
                     "1w6yrckbn5yxi3m0hqb57lwmf7pri66yi0zs2ahvcv5bwbr4dfh1"))
       ("config"
        ,(smlnj-file version
                     "config.tgz"
                     "16ynwrakbcv5mp8i596aw8da09qdjkx9j0y5wxgix8aa99px4aba"))
       ("compiler"
        ,(smlnj-file version
                     "compiler.tgz"
                     "1fmxj017s9bg1hr4psvcxasp0hcrc00bk9f0845fr7gy8mb743a3"))
       ("runtime"
        ,(smlnj-file version
                     "runtime.tgz"
                     "08xq9ddp4ciqi1rwsnma0rsj7ydlbzcb9pc9m27n4krd61h8k4z9"))
       ("system"
        ,(smlnj-file version
                     "system.tgz"
                     "0lmi03mx9fbrdshazqmrvg1j4s6hnpyfm90rl7f8qhgy0qi8almh"))
       ("MLRISC"
        ,(smlnj-file version
                     "MLRISC.tgz"
                     "0y3f1ffzpqfn03a941dmjsr0zz4lz742ww1zbfnp15jbcy7mybiv"))
       ("smlnj-lib"
        ,(smlnj-file version
                     "smlnj-lib.tgz"
                     "1vvlgws7kb53v63hwfakvq5xbiix1pqiafk5m86qas46ayy731g7"))
       ("old-basis"
        ,(smlnj-file version
                     "old-basis.tgz"
                     "1kjgwnz0caymk4im9mjf88f2cym8bndnz0r84di5l4bd6pkwl8b2"))
       ("ckit"
        ,(smlnj-file version
                     "ckit.tgz"
                     "158973wwd4pkf6fpzwyfm9968xl7pmb2sd2zf1fb3s055gm5anz2"))
       ("nlffi"
        ,(smlnj-file version
                     "nlffi.tgz"
                     "13b3561b2bxpxyyy8ld359na7vimndw53nsc0fgr9li4xa3y70hl"))
       ("cml"
        ,(smlnj-file version
                     "cml.tgz"
                     "0q00nmsqq33vdykyz9mgsy7r437l26gnxxmfl03ls88kiq7fbq3l"))
       ("eXene"
        ,(smlnj-file version
                     "eXene.tgz"
                     "0phxh34psji67z30lq61b8pkwp7m45pakn6vnk592lmibikax2q0"))
       ("ml-lpt"
        ,(smlnj-file version
                     "ml-lpt.tgz"
                     "053784lbf57pzd80gz4x7chqyxvdn580ix6pkqwcr1vwpv980zyj"))
       ("ml-lex"
        ,(smlnj-file version
                     "ml-lex.tgz"
                     "052w6ck80v1jgql4m0k24hkkx9k4qwvqgxvk22hnwfh6k1avrk1i"))
       ("ml-yacc"
        ,(smlnj-file version
                     "ml-yacc.tgz"
                     "1vj346ffzx7vbcnzhw49cqzlmfw35hzzhvlivyakdqalqwc97h6m"))
       ("ml-burg"
        ,(smlnj-file version
                     "ml-burg.tgz"
                     "02qw4xkdh4h6ngj8a5yhgg4k4ph6lnhslbfh1drdz79whd389lzx"))
       ("pgraph"
        ,(smlnj-file version
                     "pgraph.tgz"
                     "0c4qgm46dvkix4s56hj3ii9025m3pcxj4hc2z4mcdxlw0gj0r684"))
       ("trace-debug-profile"
        ,(smlnj-file version
                     "trace-debug-profile.tgz"
                     "1z8ip80hgnj637ywcpzj9hfbnsci3qsdhssdbgparkzh7mk2bi4i"))
       ("heap2asm"
        ,(smlnj-file version
                     "heap2asm.tgz"
                     "0g0ndf4wj197igrac136lsc8wpj9686vv0kwarrbwffrrrkb1w76"))))
    (synopsis "Standard ML of New Jersey interactive compiler")
    (description "SML/NJ is an implementation of the Standard ML programming
language.  Standard ML has many features, including type safety, polymorphism,
algebraic data types with pattern matching, higher-order functions, and a
sophisticated module system.  It is especially well-suited for writing
compilers and other language processors.")
    (home-page "http://www.smlnj.org/")
    (license license:bsd-2)))