Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added recipe for LPython #883

Merged
merged 1 commit into from
Apr 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions recipes/recipes_emscripten/lpython/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

set -e
set -x

mkdir -p src/bin/asset_dir
cp src/runtime/*.py src/bin/asset_dir
cp -r src/runtime/lpython src/bin/asset_dir

emcmake cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS_RELEASE="-Wall -Wextra -fexceptions" \
-DWITH_LLVM=no \
-DLPYTHON_BUILD_ALL=no \
-DLPYTHON_BUILD_TO_WASM=yes \
-DWITH_STACKTRACE=no \
-DWITH_LSP=no \
-DWITH_LFORTRAN_BINARY_MODFILES=no \
-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH_LFORTRAN;$CONDA_PREFIX" \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
.

# Build step
emmake make -j${CPU_COUNT}

# Install step
emmake make install

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/src/lpython/parser/parser_stype.h b/src/lpython/parser/parser_stype.h
index e24f07344..8bd733379 100644
--- a/src/lpython/parser/parser_stype.h
+++ b/src/lpython/parser/parser_stype.h
@@ -113,8 +113,8 @@ static_assert(std::is_trivial<YYSTYPE>::value);
// YYSTYPE must be at least as big, but it should not be bigger, otherwise it
// would reduce performance.
// A temporary fix for PowerPC 32-bit, where the following assert fails with (16 == 12).
-#ifndef __ppc__
-static_assert(sizeof(YYSTYPE) == sizeof(Vec<LPython::AST::ast_t*>));
+#if !defined(HAVE_BUILD_TO_WASM) && !defined(__ppc__)
+static_assert(sizeof(YYSTYPE) == sizeof(Vec<AST::ast_t*>));
#endif

static_assert(std::is_standard_layout<Location>::value);
48 changes: 48 additions & 0 deletions recipes/recipes_emscripten/lpython/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
context:
name: lpython
version: "0.21.2"

package:
name: "{{ name }}"
version: '{{ version }}'

source:
url: https://github.com/lcompilers/lpython/releases/download/v{{ version }}/{{ name }}-{{ version }}.tar.gz
sha256: 7ec55e398c4007f49af0e44b3599ae3be39e831f6d7696e2b65e80514a8d15b6
patches:
- patches/remove-static-assert.patch

build:
number: 0

requirements:
build:
- "{{ compiler('c') }}"
- "{{ compiler('cxx') }}"
- cmake
- make # [unix]
- zlib=1.2.13
# - xeus =3.0.5 # [build_platform != target_platform]
# - xeus-zmq =1.0.2 # [build_platform != target_platform]
# - llvmdev =16.0.6 # [build_platform != target_platform]
# - xtl # [build_platform != target_platform]
# - nlohmann_json =3.11.2 # [build_platform != target_platform]
# - cppzmq # [build_platform != target_platform]
# - zlib # [build_platform != target_platform]
# - zstd-static =1.5.5 # [build_platform != target_platform]
host:
- zlib

about:
home: https://lpython.org
license: BSD-3-Clause
license_family: BSD
license_file: LICENSE
summary: Modern interactive LLVM-based Python compiler
dev_url: https://github.com/lcompilers/lpython.git

extra:
recipe-maintainers:
- certik
- anutosh491
- Shaikh-Ubaid