Skip to content

Commit 775a21c

Browse files
committed
wip
1 parent 9797ec3 commit 775a21c

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

.gitmodules

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,11 @@
5757
[submodule "examples/opencv"]
5858
path = examples/opencv
5959
url = https://github.com/opencv/opencv.git
60+
[submodule "examples/grass-addons"]
61+
path = examples/grass-addons
62+
url = [email protected]:faasm/grass-addons.git
63+
branch = faasm
64+
[submodule "examples/grass"]
65+
path = examples/grass
66+
url = [email protected]:faasm/grass.git
67+
branch = faasm

examples/grass

Submodule grass added at 50da15e

examples/grass-addons

Submodule grass-addons added at 29ef0ea

tasks/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from . import format_code
88
from . import func
99
from . import git
10+
from . import grass
1011
from . import imagemagick
1112
from . import jwt
1213
from . import kernels
@@ -27,6 +28,7 @@
2728
format_code,
2829
func,
2930
git,
31+
grass,
3032
imagemagick,
3133
jwt,
3234
kernels,

tasks/grass.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
from faasmtools.build import get_faasm_build_env_dict
2+
from faasmtools.compile_util import wasm_copy_upload
3+
from invoke import task
4+
from os.path import join
5+
from subprocess import run
6+
from tasks.env import EXAMPLES_DIR
7+
8+
9+
@task(default=True)
10+
def grass(ctx, clean=False, noconf=False, debug=False):
11+
"""
12+
Compile and install ImageMagick
13+
"""
14+
grass_dir = join(EXAMPLES_DIR, "grass")
15+
16+
if clean:
17+
run(
18+
"make clean distclean", shell=True, cwd=grass_dir, check=True
19+
)
20+
21+
build_env = get_faasm_build_env_dict()
22+
build_env["GIT"] = "no"
23+
24+
configure_cmd = [
25+
"GIT=no",
26+
"./configure",
27+
"CC={}".format(build_env["FAASM_WASM_CC"]),
28+
"CXX={}".format(build_env["FAASM_WASM_CXX"]),
29+
"CFLAGS='--target=wasm32-wasi {}'".format(build_env["FAASM_WASM_CFLAGS"]),
30+
"LD={}".format(build_env["FAASM_WASM_CC"]),
31+
"LDXX={}".format(build_env["FAASM_WASM_CXX"]),
32+
"LDFLAGS='{}'".format(
33+
build_env["FAASM_WASM_STATIC_LINKER_FLAGS"]
34+
),
35+
"AR={}".format(build_env["FAASM_WASM_AR"]),
36+
"RANLIB={}".format(build_env["FAASM_WASM_RANLIB"]),
37+
"NM={}".format(build_env["FAASM_WASM_NM"]),
38+
# "PKG_CONFIG_PATH={}".format(join(EXAMPLES_DIR, "libpng")),
39+
"GIT=no",
40+
"--prefix={}".format(build_env["FAASM_WASM_SYSROOT"]),
41+
"--host={}".format(build_env["FAASM_WASM_TRIPLE"]),
42+
"--disable-openmp",
43+
"--disable-w11",
44+
"--disable-shared",
45+
"--without-tiff",
46+
"--without-zstd",
47+
"--enable-cross-compile",
48+
# "--with-png=yes",
49+
# "--enable-delegate-build",
50+
# "--without-bzlib",
51+
# "--without-dps",
52+
# "--without-djvu",
53+
# "--without-fftw",
54+
# "--without-flif",
55+
# "--without-fpx",
56+
# "--without-fontconfig",
57+
# "--without-freetype",
58+
# "--without-gslib",
59+
# "--without-gnu-ld",
60+
# "--without-gvc",
61+
# "--without-heic",
62+
# "--without-jbig",
63+
# "--without-lcms",
64+
# "--without-lqr",
65+
# "--without-magick-plus-plus",
66+
# "--without-openexr",
67+
# "--without-openjp2",
68+
# "--without-pango",
69+
# "--without-perl",
70+
# "--without-raqm",
71+
# "--without-raw",
72+
# "--without-rsvg",
73+
# "--without-threads",
74+
# "--without-webp",
75+
# "--without-wmf",
76+
# "--without-x",
77+
# "--without-xml",
78+
]
79+
80+
configure_cmd = " ".join(configure_cmd)
81+
if not noconf:
82+
run(configure_cmd, shell=True, cwd=grass_dir, check=True, env=build_env)
83+
84+
"""
85+
run(
86+
"make {} -j".format("V=1" if debug else ""),
87+
shell=True,
88+
cwd=grass_dir,
89+
check=True,
90+
)
91+
92+
# Instead of installing ImageMagick, we copy the self-contained binary
93+
# (magick) to /usr/local/faasm/wasm/imagemagick/main/function.wasm
94+
wasm_copy_upload(
95+
"imagemagick", "main", join(grass_dir, "utilities", "magick")
96+
)
97+
"""

0 commit comments

Comments
 (0)