Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
6a5c3779
Commit
6a5c3779
authored
Jul 18, 2018
by
Michael Droettboom
Committed by
Roman Yurchak
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for transforming Fortran files with f2c
parent
34384953
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
2 deletions
+36
-2
pyodide_build/pywasmcross.py
pyodide_build/pywasmcross.py
+36
-2
No files found.
pyodide_build/pywasmcross.py
View file @
6a5c3779
...
...
@@ -41,6 +41,7 @@ from pyodide_build import common
ROOTDIR
=
common
.
ROOTDIR
symlinks
=
set
([
'cc'
,
'c++'
,
'ld'
,
'ar'
,
'gcc'
])
symlinks
=
set
([
'cc'
,
'c++'
,
'ld'
,
'ar'
,
'gcc'
,
'gfortran'
])
def
collect_args
(
basename
):
...
...
@@ -105,6 +106,24 @@ def capture_compile(args):
sys
.
exit
(
result
.
returncode
)
def
f2c
(
args
):
new_args
=
[]
found_source
=
False
for
arg
in
args
:
if
arg
.
endswith
(
'.f'
):
filename
=
os
.
path
.
abspath
(
arg
)
subprocess
.
check_call
(
[
'f2c'
,
os
.
path
.
basename
(
filename
)],
cwd
=
os
.
path
.
dirname
(
filename
))
new_args
.
append
(
arg
[:
-
2
]
+
'.c'
)
found_source
=
True
else
:
new_args
.
append
(
arg
)
if
not
found_source
:
return
None
return
new_args
def
handle_command
(
line
,
args
,
dryrun
=
False
):
"""Handle a compilation command
...
...
@@ -137,8 +156,16 @@ def handle_command(line, args, dryrun=False):
return
if
arg
==
'-print-multiarch'
:
return
if
arg
.
startswith
(
'/tmp'
):
return
if
line
[
0
]
==
'ar'
:
if
line
[
0
]
==
'gfortran'
:
result
=
f2c
(
line
)
if
result
is
None
:
return
line
=
result
new_args
=
[
'emcc'
]
elif
line
[
0
]
==
'ar'
:
new_args
=
[
'emar'
]
elif
line
[
0
]
==
'c++'
:
new_args
=
[
'em++'
]
...
...
@@ -153,6 +180,8 @@ def handle_command(line, args, dryrun=False):
new_args
.
extend
(
args
.
ldflags
.
split
())
elif
new_args
[
0
]
in
(
'emcc'
,
'em++'
):
new_args
.
extend
(
args
.
cflags
.
split
())
if
new_args
[
0
]
==
'em++'
:
new_args
.
append
(
'-std=c++98'
)
# Go through and adjust arguments
for
arg
in
line
[
1
:]:
...
...
@@ -171,11 +200,16 @@ def handle_command(line, args, dryrun=False):
arg
=
re
.
sub
(
r'/python([0-9]\
.[
0-9]+)m'
,
r'/python\1'
,
arg
)
if
arg
.
endswith
(
'.o'
):
arg
=
arg
[:
-
2
]
+
'.bc'
if
shared
and
arg
.
endswith
(
'.so'
):
output
=
arg
elif
shared
and
arg
.
endswith
(
'.so'
):
arg
=
arg
[:
-
3
]
+
'.wasm'
output
=
arg
new_args
.
append
(
arg
)
if
os
.
path
.
isfile
(
output
):
print
(
'SKIPPING: '
+
' '
.
join
(
new_args
))
return
print
(
' '
.
join
(
new_args
))
if
not
dryrun
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment