diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 875d996..d1c5b92 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -11,7 +11,7 @@ jobs: linux_64_: CONFIG: linux_64_ UPLOAD_PACKAGES: 'True' - DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 + DOCKER_IMAGE: quay.io/condaforge/linux-anvil-alma-x86_64:8 timeoutInMinutes: 360 variables: {} diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index 730a626..7708e23 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -5,7 +5,7 @@ jobs: - job: osx pool: - vmImage: macOS-11 + vmImage: macOS-12 strategy: matrix: osx_64_: diff --git a/.ci_support/linux_64_.yaml b/.ci_support/linux_64_.yaml index 665eab5..fecb282 100644 --- a/.ci_support/linux_64_.yaml +++ b/.ci_support/linux_64_.yaml @@ -5,7 +5,7 @@ c_compiler_version: c_stdlib: - sysroot c_stdlib_version: -- '2.12' +- '2.28' cdt_name: - cos6 channel_sources: @@ -17,7 +17,7 @@ cxx_compiler: cxx_compiler_version: - '12' docker_image: -- quay.io/condaforge/linux-anvil-cos7-x86_64 +- quay.io/condaforge/linux-anvil-alma-x86_64:8 target_platform: - linux-64 zip_keys: diff --git a/.ci_support/osx_64_.yaml b/.ci_support/osx_64_.yaml index 02ab069..e9969f9 100644 --- a/.ci_support/osx_64_.yaml +++ b/.ci_support/osx_64_.yaml @@ -1,7 +1,7 @@ MACOSX_DEPLOYMENT_TARGET: -- '10.9' +- '10.13' MACOSX_SDK_VERSION: -- '10.12' +- '10.13' c_compiler: - clang c_compiler_version: @@ -9,7 +9,7 @@ c_compiler_version: c_stdlib: - macosx_deployment_target c_stdlib_version: -- '10.9' +- '10.13' channel_sources: - conda-forge channel_targets: diff --git a/.ci_support/osx_arm64_.yaml b/.ci_support/osx_arm64_.yaml index ab83120..6f87852 100644 --- a/.ci_support/osx_arm64_.yaml +++ b/.ci_support/osx_arm64_.yaml @@ -1,5 +1,7 @@ MACOSX_DEPLOYMENT_TARGET: - '11.0' +MACOSX_SDK_VERSION: +- '11.0' c_compiler: - clang c_compiler_version: diff --git a/.gitattributes b/.gitattributes index 7f32763..18f114a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,8 +20,8 @@ bld.bat text eol=crlf .travis.yml linguist-generated=true .scripts/* linguist-generated=true .woodpecker.yml linguist-generated=true -LICENSE.txt linguist-generated=true -README.md linguist-generated=true +/LICENSE.txt linguist-generated=true +/README.md linguist-generated=true azure-pipelines.yml linguist-generated=true build-locally.py linguist-generated=true shippable.yml linguist-generated=true diff --git a/recipe/build.sh b/recipe/build.sh index 871f9ad..e1a7007 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -2,6 +2,32 @@ set -ex + +CUR_DIR=`pwd` +cd $HOME + +WASI_SDK_DOWNLOAD_LINK="" + +if [[ $(uname -s) == "Darwin" ]]; then + if [[ $(uname -m) == "arm64" ]]; then + WASI_SDK_DOWNLOAD_LINK="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-macos.tar.gz" + else + WASI_SDK_DOWNLOAD_LINK="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-macos.tar.gz" + fi +else + WASI_SDK_DOWNLOAD_LINK="https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-21/wasi-sdk-21.0-linux.tar.gz" +fi + +echo "WASI SDK download link: $WASI_SDK_DOWNLOAD_LINK" + +curl -o wasi-sdk.tar.gz -L $WASI_SDK_DOWNLOAD_LINK +tar -xvf wasi-sdk.tar.gz +export WASI_SDK_PATH=$HOME/wasi-sdk-21.0 +echo $WASI_SDK_PATH +$WASI_SDK_PATH/bin/clang --version + +cd $CUR_DIR + export CXXFLAGS="${CXXFLAGS} -D__STDC_FORMAT_MACROS -D_LIBCPP_DISABLE_AVAILABILITY" if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then @@ -33,6 +59,7 @@ if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then -DWITH_RUNTIME_LIBRARY=yes \ -DWITH_RUNTIME_STACKTRACE=yes \ -DCMAKE_INSTALL_LIBDIR=share/lfortran/lib \ + -DWITH_TARGET_WASM=yes \ $SRC_DIR make ) @@ -53,6 +80,7 @@ cmake ${CMAKE_ARGS} \ -DWITH_RUNTIME_LIBRARY=$WRT \ -DWITH_RUNTIME_STACKTRACE=yes \ -DCMAKE_INSTALL_LIBDIR=share/lfortran/lib \ + -DWITH_TARGET_WASM=yes \ $SRC_DIR make -j${CPU_COUNT} diff --git a/recipe/conda_build_config.yaml b/recipe/conda_build_config.yaml index f8760c8..b594724 100644 --- a/recipe/conda_build_config.yaml +++ b/recipe/conda_build_config.yaml @@ -1,2 +1,5 @@ -MACOSX_SDK_VERSION: # [osx and x86_64] - - "10.12" # [osx and x86_64] +docker_image: # [linux and x86_64] +- quay.io/condaforge/linux-anvil-alma-x86_64:8 # [linux and x86_64] + +c_stdlib_version: +- '2.28' # [linux] diff --git a/recipe/crtlib_dir.patch b/recipe/crtlib_dir.patch new file mode 100644 index 0000000..90902a6 --- /dev/null +++ b/recipe/crtlib_dir.patch @@ -0,0 +1,74 @@ +diff --git a/src/libasr/config.h b/src/libasr/config.h +new file mode 100644 +index 000000000..e45e05ea7 +--- /dev/null ++++ b/src/libasr/config.h +@@ -0,0 +1,37 @@ ++#ifndef LFORTRAN_CONFIG_H ++#define LFORTRAN_CONFIG_H ++ ++/* Define if you want to enable ASSERT testing in LFortran */ ++#define WITH_LFORTRAN_ASSERT ++ ++/* LFortran version */ ++#define LFORTRAN_VERSION "0.35.0-dirty" ++#define LFORTRAN_MAJOR 0 ++#define LFORTRAN_MINOR 35 ++#define LFORTRAN_PATCHLEVEL 0 ++ ++/* Define if LLVM is enabled */ ++#define HAVE_LFORTRAN_LLVM ++ ++/* Define if RAPIDJSON is found */ ++/* #undef HAVE_LFORTRAN_RAPIDJSON */ ++ ++/* Define if stacktrace is enabled */ ++#define HAVE_LFORTRAN_STACKTRACE ++#define HAVE_RUNTIME_STACKTRACE ++/* #undef HAVE_LFORTRAN_BFD */ ++#define HAVE_LFORTRAN_DWARFDUMP ++/* #undef HAVE_LFORTRAN_LINK */ ++#define HAVE_LFORTRAN_MACHO ++#define HAVE_LFORTRAN_UNWIND ++ ++/* Define if cxxabi.h is present */ ++#define HAVE_LFORTRAN_DEMANGLE ++ ++/* Define if XEUS is enabled */ ++/* #undef HAVE_LFORTRAN_XEUS */ ++ ++/* Define if we should use binary modfiles */ ++#define WITH_LFORTRAN_BINARY_MODFILES ++ ++#endif // LFORTRAN_CONFIG_H +diff --git a/src/runtime/legacy/CMakeLists.txt b/src/runtime/legacy/CMakeLists.txt +index 3795d800c..bebd8460f 100644 +--- a/src/runtime/legacy/CMakeLists.txt ++++ b/src/runtime/legacy/CMakeLists.txt +@@ -1,5 +1,5 @@ + set(SRC +- ../../../src/libasr/runtime/lfortran_intrinsics.c ++ ${CMAKE_CURRENT_SOURCE_DIR}/../../../src/libasr/runtime/lfortran_intrinsics.c + ) + + if(WIN32) +@@ -31,15 +31,15 @@ if(WITH_TARGET_WASM) + message(FATAL_ERROR "'WASI_SDK_PATH' must be set when building with 'WITH_TARGET_WASM'") + endif() + +- add_custom_command(OUTPUT lfortran_runtime_wasm.o ++ add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/lfortran_runtime_wasm.o + COMMAND $ENV{WASI_SDK_PATH}/bin/clang -I${libasr_SOURCE_DIR}/.. -DCOMPILE_TO_WASM +- -D_WASI_EMULATED_PROCESS_CLOCKS -c --target=wasm32-wasi ${SRC} -o lfortran_runtime_wasm.o ++ -D_WASI_EMULATED_PROCESS_CLOCKS -c --target=wasm32-wasi ${SRC} -o ${CMAKE_CURRENT_SOURCE_DIR}/lfortran_runtime_wasm.o + COMMENT "Cross compiling lfortran_intrinscs.c to lfortran_runtime_wasm.o" + DEPENDS ${SRC}) +- add_custom_target(lfortran_runtime_wasm ALL DEPENDS lfortran_runtime_wasm.o) +- install(FILES lfortran_runtime_wasm.o ++ add_custom_target(lfortran_runtime_wasm ALL DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/lfortran_runtime_wasm.o) ++ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lfortran_runtime_wasm.o + DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- install(FILES lfortran_runtime_wasm.o ++ install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/lfortran_runtime_wasm.o + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/..) + endif() diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5d02e47..f1226b6 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -8,6 +8,8 @@ package: source: url: https://github.com/lfortran/lfortran/releases/download/v{{ version }}/{{ name }}-{{ version }}.tar.gz sha256: 5ecc1ae03067b985943c45f6ec05e9f6e72efd6ad004b052e7a98ba552ff79b0 + patches: + - crtlib_dir.patch build: number: 0 @@ -15,6 +17,7 @@ build: requirements: build: - {{ compiler('c') }} + - {{ stdlib('c') }} - {{ compiler('cxx') }} - cmake =3.21.1 - make # [unix]