@ai-ecoverse/wasix-f2c 0.0.0 → 3.2.1-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +80 -0
- package/README.md +32 -5
- package/THIRD-PARTY-NOTICES.md +246 -0
- package/bin/build-f2c.sh +24 -0
- package/bin/gfortran +154 -0
- package/include/f2c.h +223 -0
- package/lib/libf2c.a +0 -0
- package/lib/pkgconfig/f2c.pc +10 -0
- package/package.json +30 -4
- package/share/f2c/src/Notice +23 -0
- package/share/f2c/src/README +198 -0
- package/share/f2c/src/cds.c +195 -0
- package/share/f2c/src/data.c +501 -0
- package/share/f2c/src/defines.h +300 -0
- package/share/f2c/src/defs.h +1088 -0
- package/share/f2c/src/equiv.c +412 -0
- package/share/f2c/src/error.c +347 -0
- package/share/f2c/src/exec.c +985 -0
- package/share/f2c/src/expr.c +3738 -0
- package/share/f2c/src/f2c.1 +227 -0
- package/share/f2c/src/f2c.h +223 -0
- package/share/f2c/src/format.c +2639 -0
- package/share/f2c/src/format.h +12 -0
- package/share/f2c/src/formatdata.c +1271 -0
- package/share/f2c/src/ftypes.h +78 -0
- package/share/f2c/src/gram.c +4125 -0
- package/share/f2c/src/gram.dcl +417 -0
- package/share/f2c/src/gram.exec +143 -0
- package/share/f2c/src/gram.expr +146 -0
- package/share/f2c/src/gram.head +299 -0
- package/share/f2c/src/gram.io +175 -0
- package/share/f2c/src/init.c +526 -0
- package/share/f2c/src/intr.c +1084 -0
- package/share/f2c/src/io.c +1509 -0
- package/share/f2c/src/iob.h +26 -0
- package/share/f2c/src/lex.c +1757 -0
- package/share/f2c/src/machdefs.h +31 -0
- package/share/f2c/src/main.c +818 -0
- package/share/f2c/src/makefile.u +115 -0
- package/share/f2c/src/malloc.c +184 -0
- package/share/f2c/src/mem.c +272 -0
- package/share/f2c/src/memset.c +72 -0
- package/share/f2c/src/misc.c +1424 -0
- package/share/f2c/src/names.c +819 -0
- package/share/f2c/src/names.h +18 -0
- package/share/f2c/src/niceprintf.c +445 -0
- package/share/f2c/src/niceprintf.h +16 -0
- package/share/f2c/src/output.c +1753 -0
- package/share/f2c/src/output.h +64 -0
- package/share/f2c/src/p1defs.h +158 -0
- package/share/f2c/src/p1output.c +743 -0
- package/share/f2c/src/parse.h +47 -0
- package/share/f2c/src/parse_args.c +558 -0
- package/share/f2c/src/pccdefs.h +64 -0
- package/share/f2c/src/pread.c +990 -0
- package/share/f2c/src/proc.c +1854 -0
- package/share/f2c/src/put.c +458 -0
- package/share/f2c/src/putpcc.c +2255 -0
- package/share/f2c/src/sysdep.c +701 -0
- package/share/f2c/src/sysdep.h +101 -0
- package/share/f2c/src/sysdeptest.c +24 -0
- package/share/f2c/src/tokens +101 -0
- package/share/f2c/src/usignal.h +7 -0
- package/share/f2c/src/vax.c +576 -0
- package/share/f2c/src/version.c +2 -0
- package/share/f2c/src/xsum.c +239 -0
- package/share/f2c/src/xsum0.out +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
==> Notice <==
|
|
2
|
+
|
|
3
|
+
/****************************************************************
|
|
4
|
+
Copyright 1990 - 1997 by AT&T, Lucent Technologies and Bellcore.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and distribute this software
|
|
7
|
+
and its documentation for any purpose and without fee is hereby
|
|
8
|
+
granted, provided that the above copyright notice appear in all
|
|
9
|
+
copies and that both that the copyright notice and this
|
|
10
|
+
permission notice and warranty disclaimer appear in supporting
|
|
11
|
+
documentation, and that the names of AT&T, Bell Laboratories,
|
|
12
|
+
Lucent or Bellcore or any of their entities not be used in
|
|
13
|
+
advertising or publicity pertaining to distribution of the
|
|
14
|
+
software without specific, written prior permission.
|
|
15
|
+
|
|
16
|
+
AT&T, Lucent and Bellcore disclaim all warranties with regard to
|
|
17
|
+
this software, including all implied warranties of
|
|
18
|
+
merchantability and fitness. In no event shall AT&T, Lucent or
|
|
19
|
+
Bellcore be liable for any special, indirect or consequential
|
|
20
|
+
damages or any damages whatsoever resulting from loss of use,
|
|
21
|
+
data or profits, whether in an action of contract, negligence or
|
|
22
|
+
other tortious action, arising out of or in connection with the
|
|
23
|
+
use or performance of this software.
|
|
24
|
+
****************************************************************/
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
==> LICENSE.txt <==
|
|
28
|
+
|
|
29
|
+
F2C License:
|
|
30
|
+
|
|
31
|
+
Copyright 1990 - 1997 by AT&T, Lucent Technologies and Bellcore.
|
|
32
|
+
|
|
33
|
+
Permission to use, copy, modify, and distribute this software and its
|
|
34
|
+
documentation for any purpose and without fee is hereby granted, provided that
|
|
35
|
+
the above copyright notice appear in all copies and that both that the copyright
|
|
36
|
+
notice and this permission notice and warranty disclaimer appear in supporting
|
|
37
|
+
documentation, and that the names of AT&T, Bell Laboratories, Lucent or Bellcore
|
|
38
|
+
or any of their entities not be used in advertising or publicity pertaining to
|
|
39
|
+
distribution of the software without specific, written prior permission.
|
|
40
|
+
|
|
41
|
+
AT&T, Lucent and Bellcore disclaim all warranties with regard to this software,
|
|
42
|
+
including all implied warranties of merchantability and fitness. In no event
|
|
43
|
+
shall AT&T, Lucent or Bellcore be liable for any special, indirect or
|
|
44
|
+
consequential damages or any damages whatsoever resulting from loss of use, data
|
|
45
|
+
or profits, whether in an action of contract, negligence or other tortious
|
|
46
|
+
action, arising out of or in connection with the use or performance of this
|
|
47
|
+
software.
|
|
48
|
+
|
|
49
|
+
Scipy License (for the files in tests/scipy/in):
|
|
50
|
+
|
|
51
|
+
Copyright (c) 2001-2002 Enthought, Inc. 2003-2024, SciPy Developers.
|
|
52
|
+
All rights reserved.
|
|
53
|
+
|
|
54
|
+
Redistribution and use in source and binary forms, with or without
|
|
55
|
+
modification, are permitted provided that the following conditions
|
|
56
|
+
are met:
|
|
57
|
+
|
|
58
|
+
1. Redistributions of source code must retain the above copyright
|
|
59
|
+
notice, this list of conditions and the following disclaimer.
|
|
60
|
+
|
|
61
|
+
2. Redistributions in binary form must reproduce the above
|
|
62
|
+
copyright notice, this list of conditions and the following
|
|
63
|
+
disclaimer in the documentation and/or other materials provided
|
|
64
|
+
with the distribution.
|
|
65
|
+
|
|
66
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
67
|
+
contributors may be used to endorse or promote products derived
|
|
68
|
+
from this software without specific prior written permission.
|
|
69
|
+
|
|
70
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
71
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
72
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
73
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
74
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
75
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
76
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
77
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
78
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
79
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
80
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
1
|
# @ai-ecoverse/wasix-f2c
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Fortran 77 for wasm32-wasix through [f2c](https://www.netlib.org/f2c/): a
|
|
4
|
+
**build input** (no slicc commands) that py-scipy compiles its Fortran with,
|
|
5
|
+
fetched by sha256. It follows Pyodide's scipy build.
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
- `lib/libf2c.a`: static and **PIC** (the ehpic tree's legacy wasm exceptions,
|
|
8
|
+
as scipy's side modules), built from CLAPACK 3.2.1's `F2CLIBS/libf2c` with
|
|
9
|
+
Pyodide's patches 0001–0007 on wasix-sysroot 2025.9.30-38. 0005 leaves
|
|
10
|
+
`c_abs`/`z_abs` to OpenBLAS (`@ai-ecoverse/wasix-openblas`), so the two
|
|
11
|
+
link together. `lib/pkgconfig/f2c.pc` has a relocatable prefix.
|
|
12
|
+
- `include/f2c.h`: the header f2c output is compiled against (hoodmane/f2c's).
|
|
13
|
+
- `share/f2c/src`: the f2c translator's source (hoodmane/f2c `caa9abc`, f2c
|
|
14
|
+
20240504). It's a **host tool**, so `bin/build-f2c.sh [<out-dir>]` builds it
|
|
15
|
+
with the host `cc` and prints its path. Without an out dir, it builds it
|
|
16
|
+
once into `$WASIX_F2C_CACHE`, else `~/.cache/wasix-f2c/<version>`. One
|
|
17
|
+
tarball serves every build host.
|
|
18
|
+
- `bin/gfortran`: a gfortran for meson and other build systems (Python 3).
|
|
19
|
+
- **Fortran sources:** `.f`/`.F` are translated with `f2c -R` next to the
|
|
20
|
+
source (`.F` through the C preprocessor first), then compiled with
|
|
21
|
+
`$WASIX_CC` (default `wasixcc`) and `-I<package>/include`.
|
|
22
|
+
- **Links:** link-only calls go to `$WASIX_CC`. An executable link from
|
|
23
|
+
Fortran adds `libf2c.a`, as gfortran adds libgfortran.
|
|
24
|
+
- **Identity probes:** meson's (`--version`, `-v`, `-dumpversion`,
|
|
25
|
+
`-dumpfullversion`, `-E -dM -`) are answered as GNU Fortran 13.2.0 for
|
|
26
|
+
wasm32, so no host gfortran is needed. Other queries without a source go
|
|
27
|
+
to `$REAL_GFORTRAN` if set.
|
|
28
|
+
- **Project fixes:** `$F2C_FIXES` can name a Python file with
|
|
29
|
+
`fix_f2c_input(path)`, `fix_f2c_output(path)` and `fix_args(args)` hooks,
|
|
30
|
+
for scipy's f2c fixes.
|
|
31
|
+
- **Overrides:** `$F2C_PATH` sets the f2c to run, and `$F2C_INCLUDE` the
|
|
32
|
+
directory for f2c.h.
|
|
6
33
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
34
|
+
libf2c and f2c are under the AT&T/Lucent/Bellcore notice (SMLNJ), and
|
|
35
|
+
`bin/gfortran` follows pyodide-build (MPL-2.0). See `LICENSE` and
|
|
36
|
+
`THIRD-PARTY-NOTICES.md`.
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
libf2c.a is CLAPACK 3.2.1's F2CLIBS/libf2c (its Notice is in LICENSE) with Pyodide's patches; share/f2c/src and f2c.h are hoodmane/f2c caa9abcaddd19154a5e6d77faa78b6289547bef5 (LICENSE.txt, also in LICENSE); bin/gfortran follows pyodide-build (MPL-2.0). libf2c.a is compiled against and meant to be linked with the following.
|
|
4
|
+
|
|
5
|
+
## wasix-libc headers (@ai-ecoverse/wasix-sysroot 2025.9.30-38; files from tag v2026-07-03.1)
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
wasi-libc as a whole is multi-licensed under the
|
|
9
|
+
Apache License v2.0 with LLVM Exceptions, the Apache License v2.0, and
|
|
10
|
+
the MIT License. See the LICENSE-APACHE-LLVM, LICENSE-APACHE and LICENSE-MIT
|
|
11
|
+
files, respectively, for details.
|
|
12
|
+
|
|
13
|
+
Portions of this software are derived from third-party works covered by
|
|
14
|
+
their own licenses:
|
|
15
|
+
|
|
16
|
+
dlmalloc/ - CC0; see the notice in malloc.c for details
|
|
17
|
+
emmalloc/ - MIT; see the notice in emmalloc.c for details
|
|
18
|
+
libc-bottom-half/cloudlibc/ - BSD-2-Clause; see the LICENSE file for details
|
|
19
|
+
libc-top-half/musl/ - MIT; see the COPYRIGHT file for details
|
|
20
|
+
|
|
21
|
+
wasi-libc changes to these files are multi-licensed under the
|
|
22
|
+
Apache License v2.0 with LLVM Exceptions, the Apache License v2.0,
|
|
23
|
+
the MIT License, and the original licenses of the third-party works.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Permission is hereby granted, free of charge, to any
|
|
28
|
+
person obtaining a copy of this software and associated
|
|
29
|
+
documentation files (the "Software"), to deal in the
|
|
30
|
+
Software without restriction, including without
|
|
31
|
+
limitation the rights to use, copy, modify, merge,
|
|
32
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
33
|
+
the Software, and to permit persons to whom the Software
|
|
34
|
+
is furnished to do so, subject to the following
|
|
35
|
+
conditions:
|
|
36
|
+
|
|
37
|
+
The above copyright notice and this permission notice
|
|
38
|
+
shall be included in all copies or substantial portions
|
|
39
|
+
of the Software.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
42
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
43
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
44
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
45
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
46
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
47
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
48
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
49
|
+
DEALINGS IN THE SOFTWARE.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
musl as a whole is licensed under the following standard MIT license:
|
|
54
|
+
|
|
55
|
+
----------------------------------------------------------------------
|
|
56
|
+
Copyright © 2005-2020 Rich Felker, et al.
|
|
57
|
+
|
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
59
|
+
a copy of this software and associated documentation files (the
|
|
60
|
+
"Software"), to deal in the Software without restriction, including
|
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
64
|
+
the following conditions:
|
|
65
|
+
|
|
66
|
+
The above copyright notice and this permission notice shall be
|
|
67
|
+
included in all copies or substantial portions of the Software.
|
|
68
|
+
|
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
72
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
73
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
74
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
75
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
76
|
+
----------------------------------------------------------------------
|
|
77
|
+
|
|
78
|
+
Authors/contributors include:
|
|
79
|
+
|
|
80
|
+
A. Wilcox
|
|
81
|
+
Ada Worcester
|
|
82
|
+
Alex Dowad
|
|
83
|
+
Alex Suykov
|
|
84
|
+
Alexander Monakov
|
|
85
|
+
Andre McCurdy
|
|
86
|
+
Andrew Kelley
|
|
87
|
+
Anthony G. Basile
|
|
88
|
+
Aric Belsito
|
|
89
|
+
Arvid Picciani
|
|
90
|
+
Bartosz Brachaczek
|
|
91
|
+
Benjamin Peterson
|
|
92
|
+
Bobby Bingham
|
|
93
|
+
Boris Brezillon
|
|
94
|
+
Brent Cook
|
|
95
|
+
Chris Spiegel
|
|
96
|
+
Clément Vasseur
|
|
97
|
+
Daniel Micay
|
|
98
|
+
Daniel Sabogal
|
|
99
|
+
Daurnimator
|
|
100
|
+
David Carlier
|
|
101
|
+
David Edelsohn
|
|
102
|
+
Denys Vlasenko
|
|
103
|
+
Dmitry Ivanov
|
|
104
|
+
Dmitry V. Levin
|
|
105
|
+
Drew DeVault
|
|
106
|
+
Emil Renner Berthing
|
|
107
|
+
Fangrui Song
|
|
108
|
+
Felix Fietkau
|
|
109
|
+
Felix Janda
|
|
110
|
+
Gianluca Anzolin
|
|
111
|
+
Hauke Mehrtens
|
|
112
|
+
He X
|
|
113
|
+
Hiltjo Posthuma
|
|
114
|
+
Isaac Dunham
|
|
115
|
+
Jaydeep Patil
|
|
116
|
+
Jens Gustedt
|
|
117
|
+
Jeremy Huntwork
|
|
118
|
+
Jo-Philipp Wich
|
|
119
|
+
Joakim Sindholt
|
|
120
|
+
John Spencer
|
|
121
|
+
Julien Ramseier
|
|
122
|
+
Justin Cormack
|
|
123
|
+
Kaarle Ritvanen
|
|
124
|
+
Khem Raj
|
|
125
|
+
Kylie McClain
|
|
126
|
+
Leah Neukirchen
|
|
127
|
+
Luca Barbato
|
|
128
|
+
Luka Perkov
|
|
129
|
+
M Farkas-Dyck (Strake)
|
|
130
|
+
Mahesh Bodapati
|
|
131
|
+
Markus Wichmann
|
|
132
|
+
Masanori Ogino
|
|
133
|
+
Michael Clark
|
|
134
|
+
Michael Forney
|
|
135
|
+
Mikhail Kremnyov
|
|
136
|
+
Natanael Copa
|
|
137
|
+
Nicholas J. Kain
|
|
138
|
+
orc
|
|
139
|
+
Pascal Cuoq
|
|
140
|
+
Patrick Oppenlander
|
|
141
|
+
Petr Hosek
|
|
142
|
+
Petr Skocik
|
|
143
|
+
Pierre Carrier
|
|
144
|
+
Reini Urban
|
|
145
|
+
Rich Felker
|
|
146
|
+
Richard Pennington
|
|
147
|
+
Ryan Fairfax
|
|
148
|
+
Samuel Holland
|
|
149
|
+
Segev Finer
|
|
150
|
+
Shiz
|
|
151
|
+
sin
|
|
152
|
+
Solar Designer
|
|
153
|
+
Stefan Kristiansson
|
|
154
|
+
Stefan O'Rear
|
|
155
|
+
Szabolcs Nagy
|
|
156
|
+
Timo Teräs
|
|
157
|
+
Trutz Behn
|
|
158
|
+
Valentin Ochs
|
|
159
|
+
Will Dietz
|
|
160
|
+
William Haddon
|
|
161
|
+
William Pitcock
|
|
162
|
+
|
|
163
|
+
Portions of this software are derived from third-party works licensed
|
|
164
|
+
under terms compatible with the above MIT license:
|
|
165
|
+
|
|
166
|
+
The TRE regular expression implementation (src/regex/reg* and
|
|
167
|
+
src/regex/tre*) is Copyright © 2001-2008 Ville Laurikari and licensed
|
|
168
|
+
under a 2-clause BSD license (license text in the source files). The
|
|
169
|
+
included version has been heavily modified by Rich Felker in 2012, in
|
|
170
|
+
the interests of size, simplicity, and namespace cleanliness.
|
|
171
|
+
|
|
172
|
+
Much of the math library code (src/math/* and src/complex/*) is
|
|
173
|
+
Copyright © 1993,2004 Sun Microsystems or
|
|
174
|
+
Copyright © 2003-2011 David Schultz or
|
|
175
|
+
Copyright © 2003-2009 Steven G. Kargl or
|
|
176
|
+
Copyright © 2003-2009 Bruce D. Evans or
|
|
177
|
+
Copyright © 2008 Stephen L. Moshier or
|
|
178
|
+
Copyright © 2017-2018 Arm Limited
|
|
179
|
+
and labelled as such in comments in the individual source files. All
|
|
180
|
+
have been licensed under extremely permissive terms.
|
|
181
|
+
|
|
182
|
+
The ARM memcpy code (src/string/arm/memcpy.S) is Copyright © 2008
|
|
183
|
+
The Android Open Source Project and is licensed under a two-clause BSD
|
|
184
|
+
license. It was taken from Bionic libc, used on Android.
|
|
185
|
+
|
|
186
|
+
The AArch64 memcpy and memset code (src/string/aarch64/*) are
|
|
187
|
+
Copyright © 1999-2019, Arm Limited.
|
|
188
|
+
|
|
189
|
+
The implementation of DES for crypt (src/crypt/crypt_des.c) is
|
|
190
|
+
Copyright © 1994 David Burren. It is licensed under a BSD license.
|
|
191
|
+
|
|
192
|
+
The implementation of blowfish crypt (src/crypt/crypt_blowfish.c) was
|
|
193
|
+
originally written by Solar Designer and placed into the public
|
|
194
|
+
domain. The code also comes with a fallback permissive license for use
|
|
195
|
+
in jurisdictions that may not recognize the public domain.
|
|
196
|
+
|
|
197
|
+
The smoothsort implementation (src/stdlib/qsort.c) is Copyright © 2011
|
|
198
|
+
Valentin Ochs and is licensed under an MIT-style license.
|
|
199
|
+
|
|
200
|
+
The x86_64 port was written by Nicholas J. Kain and is licensed under
|
|
201
|
+
the standard MIT terms.
|
|
202
|
+
|
|
203
|
+
The mips and microblaze ports were originally written by Richard
|
|
204
|
+
Pennington for use in the ellcc project. The original code was adapted
|
|
205
|
+
by Rich Felker for build system and code conventions during upstream
|
|
206
|
+
integration. It is licensed under the standard MIT terms.
|
|
207
|
+
|
|
208
|
+
The mips64 port was contributed by Imagination Technologies and is
|
|
209
|
+
licensed under the standard MIT terms.
|
|
210
|
+
|
|
211
|
+
The powerpc port was also originally written by Richard Pennington,
|
|
212
|
+
and later supplemented and integrated by John Spencer. It is licensed
|
|
213
|
+
under the standard MIT terms.
|
|
214
|
+
|
|
215
|
+
All other files which have no copyright comments are original works
|
|
216
|
+
produced specifically for use as part of this library, written either
|
|
217
|
+
by Rich Felker, the main author of the library, or by one or more
|
|
218
|
+
contibutors listed above. Details on authorship of individual files
|
|
219
|
+
can be found in the git version control history of the project. The
|
|
220
|
+
omission of copyright and license comments in each file is in the
|
|
221
|
+
interest of source tree size.
|
|
222
|
+
|
|
223
|
+
In addition, permission is hereby granted for all public header files
|
|
224
|
+
(include/* and arch/*/bits/*) and crt files intended to be linked into
|
|
225
|
+
applications (crt/*, ldso/dlstart.c, and arch/*/crt_arch.h) to omit
|
|
226
|
+
the copyright notice and permission notice otherwise required by the
|
|
227
|
+
license, and to use these files without any requirement of
|
|
228
|
+
attribution. These files include substantial contributions from:
|
|
229
|
+
|
|
230
|
+
Bobby Bingham
|
|
231
|
+
John Spencer
|
|
232
|
+
Nicholas J. Kain
|
|
233
|
+
Rich Felker
|
|
234
|
+
Richard Pennington
|
|
235
|
+
Stefan Kristiansson
|
|
236
|
+
Szabolcs Nagy
|
|
237
|
+
|
|
238
|
+
all of whom have explicitly granted such permission.
|
|
239
|
+
|
|
240
|
+
This file previously contained text expressing a belief that most of
|
|
241
|
+
the files covered by the above exception were sufficiently trivial not
|
|
242
|
+
to be subject to copyright, resulting in confusion over whether it
|
|
243
|
+
negated the permissions granted in the license. In the spirit of
|
|
244
|
+
permissive licensing, and of not having licensing issues being an
|
|
245
|
+
obstacle to adoption, that text has been removed.
|
|
246
|
+
```
|
package/bin/build-f2c.sh
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# build-f2c.sh [<out-dir>]: build the f2c translator (hoodmane/f2c, the
|
|
3
|
+
# pinned source in share/f2c/src) with the host C compiler and print its
|
|
4
|
+
# path. It's a host tool, so the package ships its source, not a binary for
|
|
5
|
+
# one host. Without <out-dir> it builds once into
|
|
6
|
+
# ${WASIX_F2C_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/wasix-f2c}/<version>.
|
|
7
|
+
set -euo pipefail
|
|
8
|
+
PKG="$(cd "$(dirname "$0")/.." && pwd)"
|
|
9
|
+
VER="$(sed -n 's/.*"version": *"\([^"]*\)".*/\1/p' "$PKG/package.json" | head -1)"
|
|
10
|
+
OUT="${1:-${WASIX_F2C_CACHE:-${XDG_CACHE_HOME:-$HOME/.cache}/wasix-f2c}/$VER}"
|
|
11
|
+
if [[ -x "$OUT/f2c" ]]; then
|
|
12
|
+
echo "$OUT/f2c"
|
|
13
|
+
exit 0
|
|
14
|
+
fi
|
|
15
|
+
TMP="$(mktemp -d "${TMPDIR:-/tmp}/wasix-f2c-build.XXXXXX")"
|
|
16
|
+
trap 'rm -rf "$TMP"' EXIT
|
|
17
|
+
cp -R "$PKG/share/f2c/src/." "$TMP/"
|
|
18
|
+
# gram.c ships generated: don't regenerate it with yacc (as Pyodide does).
|
|
19
|
+
sed 's/^gram\.c:/gram.c1:/' "$TMP/makefile.u" >"$TMP/makefile"
|
|
20
|
+
make -s -C "$TMP" CC="${HOST_CC:-${CC_FOR_BUILD:-cc}}" CFLAGS="-O -w" f2c >&2
|
|
21
|
+
mkdir -p "$OUT"
|
|
22
|
+
cp "$TMP/f2c" "$OUT/f2c.tmp.$$"
|
|
23
|
+
mv "$OUT/f2c.tmp.$$" "$OUT/f2c"
|
|
24
|
+
echo "$OUT/f2c"
|
package/bin/gfortran
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# gfortran for wasm32-wasix: Fortran 77 through f2c, then the C compiler.
|
|
3
|
+
#
|
|
4
|
+
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
5
|
+
# License, v. 2.0 (http://mozilla.org/MPL/2.0/): the f2c replay below follows
|
|
6
|
+
# pyodide-build's _f2c_fixes.py / pywasmcross (Pyodide, MPL-2.0), as
|
|
7
|
+
# packages/py-scipy/tools/gfortran did. homescoop's changes are under the
|
|
8
|
+
# same licence.
|
|
9
|
+
"""gfortran → f2c → $WASIX_CC.
|
|
10
|
+
|
|
11
|
+
- A compile of .f/.F sources: each is translated with `f2c -R` (Fortran REAL
|
|
12
|
+
functions return float, as OpenBLAS's f2c'd LAPACK does) next to the
|
|
13
|
+
source (.F first through the C preprocessor), and the C is compiled with
|
|
14
|
+
$WASIX_CC (default wasixcc) and -I<package>/include for f2c.h. gfortran-only
|
|
15
|
+
flags are dropped.
|
|
16
|
+
- Link-only calls (no Fortran source) go to $WASIX_CC as they are. A link
|
|
17
|
+
that produces an executable from Fortran (no -c, no -shared) adds
|
|
18
|
+
<package>/lib/libf2c.a, as gfortran adds libgfortran.
|
|
19
|
+
- meson's identity probes (--version, -v, -dumpversion, -dumpfullversion,
|
|
20
|
+
-E -dM -) are answered here as GNU Fortran 13.2.0 for wasm32-wasi, so no
|
|
21
|
+
host gfortran is needed. Anything else without a source goes to
|
|
22
|
+
$REAL_GFORTRAN if it's set, else fails.
|
|
23
|
+
|
|
24
|
+
Environment:
|
|
25
|
+
F2C_PATH the f2c to run (default: f2c on PATH, else bin/build-f2c.sh
|
|
26
|
+
builds it once into $WASIX_F2C_CACHE or ~/.cache/wasix-f2c)
|
|
27
|
+
WASIX_CC the C compiler (default wasixcc)
|
|
28
|
+
F2C_INCLUDE where f2c.h is (default <package>/include)
|
|
29
|
+
F2C_FIXES a Python file with optional fix_f2c_input(path),
|
|
30
|
+
fix_f2c_output(path) and fix_args(args) hooks (scipy's fixes)
|
|
31
|
+
REAL_GFORTRAN a host gfortran for other probes (optional)
|
|
32
|
+
"""
|
|
33
|
+
from __future__ import annotations
|
|
34
|
+
|
|
35
|
+
import importlib.util
|
|
36
|
+
import os
|
|
37
|
+
import shutil
|
|
38
|
+
import subprocess
|
|
39
|
+
import sys
|
|
40
|
+
from pathlib import Path
|
|
41
|
+
|
|
42
|
+
PKG = Path(__file__).resolve().parent.parent
|
|
43
|
+
GFORTRAN_VERSION = "13.2.0"
|
|
44
|
+
FORTRAN_SUFFIXES = (".f", ".F", ".for", ".FOR", ".f77", ".F77")
|
|
45
|
+
DROP_EXACT = {"-ffixed-form", "-ffree-form", "-fno-second-underscore", "-fPIC", "-fpic", "-cpp", "-nocpp"}
|
|
46
|
+
DROP_PREFIX = ("-fallow-", "-fdefault-", "-fblas-", "-J", "-finit-", "-freal-", "-fimplicit-", "-fcheck",
|
|
47
|
+
"-ffpe-", "-fbacktrace", "-frecursive", "-std=", "-fmodule", "-ffixed-line-length", "-fno-automatic")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def hooks():
|
|
51
|
+
path = os.environ.get("F2C_FIXES")
|
|
52
|
+
if not path:
|
|
53
|
+
return None
|
|
54
|
+
spec = importlib.util.spec_from_file_location("wasix_f2c_fixes", path)
|
|
55
|
+
mod = importlib.util.module_from_spec(spec)
|
|
56
|
+
spec.loader.exec_module(mod)
|
|
57
|
+
return mod
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def hook(mod, name, *args):
|
|
61
|
+
fn = getattr(mod, name, None) if mod else None
|
|
62
|
+
if fn:
|
|
63
|
+
fn(*args)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def f2c_path() -> str:
|
|
67
|
+
if os.environ.get("F2C_PATH"):
|
|
68
|
+
return os.environ["F2C_PATH"]
|
|
69
|
+
found = shutil.which("f2c")
|
|
70
|
+
if found:
|
|
71
|
+
return found
|
|
72
|
+
out = subprocess.run([str(PKG / "bin" / "build-f2c.sh")], check=True, stdout=subprocess.PIPE, text=True).stdout
|
|
73
|
+
return out.strip().splitlines()[-1]
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def wasix_cc() -> str:
|
|
77
|
+
return os.environ.get("WASIX_CC", "wasixcc")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def probe(argv: list[str]) -> int | None:
|
|
81
|
+
"""meson's identity probes, answered as GNU Fortran for wasm32-wasi."""
|
|
82
|
+
if argv in (["--version"], ["-v", "--version"]):
|
|
83
|
+
print(f"GNU Fortran (wasix-f2c: f2c -R and {wasix_cc()}) {GFORTRAN_VERSION}")
|
|
84
|
+
print("This is f2c translating Fortran 77 to C for wasm32-wasix, not GNU Fortran.")
|
|
85
|
+
return 0
|
|
86
|
+
if argv in (["-dumpversion"], ["-dumpfullversion"]):
|
|
87
|
+
print(GFORTRAN_VERSION)
|
|
88
|
+
return 0
|
|
89
|
+
if argv == ["-v"]:
|
|
90
|
+
print(f"Target: wasm32-wasi\ngcc version {GFORTRAN_VERSION} (wasix-f2c)", file=sys.stderr)
|
|
91
|
+
return 0
|
|
92
|
+
if "-E" in argv and "-dM" in argv and argv[-1] == "-":
|
|
93
|
+
defs = subprocess.run([wasix_cc(), "-E", "-dM", "-x", "c", "-"], stdin=subprocess.DEVNULL,
|
|
94
|
+
check=True, stdout=subprocess.PIPE, text=True).stdout
|
|
95
|
+
major, minor, patch = GFORTRAN_VERSION.split(".")
|
|
96
|
+
keep = [l for l in defs.splitlines() if not l.startswith(("#define __GNUC__", "#define __GNUC_MINOR__", "#define __GNUC_PATCHLEVEL__", "#define __clang"))]
|
|
97
|
+
keep += [f"#define __GNUC__ {major}", f"#define __GNUC_MINOR__ {minor}", f"#define __GNUC_PATCHLEVEL__ {patch}", "#define __GFORTRAN__ 1"]
|
|
98
|
+
print("\n".join(sorted(keep)))
|
|
99
|
+
return 0
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def translate(src: str, mod) -> str:
|
|
104
|
+
"""f2c -R one Fortran source next to itself; returns the .c path."""
|
|
105
|
+
path = Path(src).resolve()
|
|
106
|
+
hook(mod, "fix_f2c_input", Path(src))
|
|
107
|
+
if path.suffix in (".F", ".F77"):
|
|
108
|
+
pre = path.with_suffix(".f77")
|
|
109
|
+
subprocess.check_call([wasix_cc(), "-E", "-P", "-C", "-traditional-cpp", "-x", "c", str(path), "-o", str(pre)])
|
|
110
|
+
path = pre
|
|
111
|
+
out = path.with_suffix(".c")
|
|
112
|
+
with open(path) as fin, open(out, "w") as fout:
|
|
113
|
+
subprocess.check_call([f2c_path(), "-R"], stdin=fin, stdout=fout, cwd=path.parent)
|
|
114
|
+
c = str(Path(src).with_suffix(".c")) if Path(src).suffix not in (".F", ".F77") else str(out)
|
|
115
|
+
hook(mod, "fix_f2c_output", Path(c))
|
|
116
|
+
return c
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def main() -> int:
|
|
120
|
+
argv = sys.argv[1:]
|
|
121
|
+
sources = [a for a in argv if a.endswith(FORTRAN_SUFFIXES) and not a.startswith("-")]
|
|
122
|
+
if not sources:
|
|
123
|
+
answered = probe(argv)
|
|
124
|
+
if answered is not None:
|
|
125
|
+
return answered
|
|
126
|
+
if any(a.startswith("-Wl,") or a in ("-shared", "-dynamiclib") or a.endswith((".o", ".a", ".so", ".wasm"))
|
|
127
|
+
for a in argv):
|
|
128
|
+
os.execvp(wasix_cc(), [wasix_cc(), *argv])
|
|
129
|
+
real = os.environ.get("REAL_GFORTRAN")
|
|
130
|
+
if real:
|
|
131
|
+
os.execvp(real, [real, *argv])
|
|
132
|
+
print(f"wasix-f2c gfortran: nothing to translate or link in {' '.join(argv)!r} (set REAL_GFORTRAN for other queries)", file=sys.stderr)
|
|
133
|
+
return 2
|
|
134
|
+
|
|
135
|
+
mod = hooks()
|
|
136
|
+
args = [wasix_cc()]
|
|
137
|
+
for a in argv:
|
|
138
|
+
if a in sources:
|
|
139
|
+
args.append(translate(a, mod))
|
|
140
|
+
elif a in DROP_EXACT or a.startswith(DROP_PREFIX):
|
|
141
|
+
continue
|
|
142
|
+
else:
|
|
143
|
+
args.append(a)
|
|
144
|
+
args.insert(1, f"-I{os.environ.get('F2C_INCLUDE', str(PKG / 'include'))}")
|
|
145
|
+
links = "-c" not in argv and "-E" not in argv and "-S" not in argv
|
|
146
|
+
if links and "-shared" not in argv:
|
|
147
|
+
args += [str(PKG / "lib" / "libf2c.a"), "-lm"]
|
|
148
|
+
hook(mod, "fix_args", args)
|
|
149
|
+
os.execvp(args[0], args)
|
|
150
|
+
return 1
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
if __name__ == "__main__":
|
|
154
|
+
raise SystemExit(main())
|