Skip to content

Commit

Permalink
Lighten run-deps, fix activation (#64)
Browse files Browse the repository at this point in the history
automerged PR by conda-forge/automerge-action
  • Loading branch information
github-actions[bot] authored Aug 3, 2024
2 parents f8438a6 + 79d0531 commit 9ef3d6c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
11 changes: 2 additions & 9 deletions recipe/activate.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
setlocal enabledelayedexpansion

set "_OLD_FC=%FC%"
set "_OLD_FFLAGS=%FFLAGS%"
set "_OLD_LD=%LD%"
Expand All @@ -9,11 +7,6 @@ set "_OLD_LDFLAGS=%LDFLAGS%"
set "FC=flang-new"
set "LD=lld-link.exe"

:: need to read clang version for path to compiler-rt
FOR /F "tokens=* USEBACKQ" %%F IN (`clang.exe -dumpversion`) DO (
SET "_CLANG_VER=%%F"
)

:: following https://github.com/conda-forge/clang-win-activation-feedstock/blob/main/recipe/activate-clang_win-64.bat
set "FFLAGS=-D_CRT_SECURE_NO_WARNINGS -nostdlib -fms-runtime-lib=dll -fuse-ld=lld -fno-aligned-allocation"
set "LDFLAGS=-nostdlib -Wl,-defaultlib:%CONDA_PREFIX:\=/%/lib/clang/!CLANG_VER:~0,2!/lib/windows/clang_rt.builtins-x86_64.lib"
set "FFLAGS=-D_CRT_SECURE_NO_WARNINGS -nostdlib -fms-runtime-lib=dll -fuse-ld=lld -fno-aligned-allocation -I%LIBRARY_INC%"
set "LDFLAGS=-nostdlib -Wl,-defaultlib:%CONDA_PREFIX:\=/%/lib/clang/@MAJOR_VER@/lib/windows/clang_rt.builtins-x86_64.lib"
2 changes: 2 additions & 0 deletions recipe/activate.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export _OLD_FC=$FC
export _OLD_CPATH=$CPATH
export _OLD_FFLAGS=$FFLAGS
export _OLD_LIBRARY_PATH=$LIBRARY_PATH
Expand All @@ -14,4 +15,5 @@ else
export FORTRANFLAGS="$FORTRANFLAGS --sysroot=$CONDA_BUILD_SYSROOT"
fi

export FC="flang-new"
export FFLAGS=$FORTRANFLAGS
1 change: 1 addition & 0 deletions recipe/deactivate.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export FC=$_OLD_FC
export CPATH=$_OLD_CPATH
export FFLAGS=$_OLD_FFLAGS
export FORTRANFLAGS=$_OLD_FORTRANFLAGS
Expand Down
7 changes: 7 additions & 0 deletions recipe/install_flang.bat
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
@echo on

cd %SRC_DIR%\build
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64

cmake --build . --target install
if %ERRORLEVEL% neq 0 exit 1

for /f "tokens=1 delims=." %%i in ("%PKG_VERSION%") do (
set "MAJOR_VER=%%i"
)

:: Copy the [de]activate scripts to %PREFIX%\etc\conda\[de]activate.d.
:: This will allow them to be run on environment activation.
FOR %%F IN (activate deactivate) DO (
IF NOT EXIST %PREFIX%\etc\conda\%%F.d MKDIR %PREFIX%\etc\conda\%%F.d
COPY %RECIPE_DIR%\%%F.bat %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.bat
sed -i 's/@MAJOR_VER@/%MAJOR_VER%/g' %PREFIX%\etc\conda\%%F.d\%PKG_NAME%_%%F.bat
)
11 changes: 9 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ source:
sha256: 09c08693a9afd6236f27a2ebae62cda656eba19021ef3f94d59e931d662d4856

build:
number: 2
number: 3
# intentionally only windows (main target) & linux (debuggability)
skip: true # [osx]

Expand Down Expand Up @@ -87,6 +87,8 @@ outputs:
build:
- cmake
- ninja
- sed # [unix]
- m2-sed # [win]
# for strong run-exports
- {{ compiler('c') }}
- {{ stdlib('c') }}
Expand All @@ -106,13 +108,16 @@ outputs:
- {{ pin_subpackage('libfortran-main', exact=True) }}
run:
- sysroot_{{ target_platform }} >={{ c_stdlib_version }} # [linux]
- clangdev =={{ version }}
- clang =={{ version }}
- compiler-rt =={{ version }}
- {{ pin_subpackage('libflang', exact=True) }}
- {{ pin_subpackage('libfortran-main', exact=True) }}
test:
requires:
- {{ compiler('c') }} # [win]
- {{ compiler('cxx') }} # [win]
- grep # [unix]
- m2-grep # [win]
files:
- hello_world.f90
commands:
Expand All @@ -121,6 +126,8 @@ outputs:
- flang-new hello_world.f90
- ./a.out # [unix]
- a.exe # [win]
# check if activation worked
- env | grep "FC="

- name: flang_{{ target_platform }}
run_exports:
Expand Down

0 comments on commit 9ef3d6c

Please sign in to comment.