From 7df952be5c2212531b8a56dafd0a96cc92f692b9 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Aug 2024 09:29:52 -0500 Subject: [PATCH 1/9] version suffixed LLVM tools --- recipe/install_llvm.bat | 11 +++++++++++ recipe/install_llvm.sh | 23 ++++++++++++++++++----- recipe/meta.yaml | 32 +++++++++++++++++++++++++++++++- 3 files changed, 60 insertions(+), 6 deletions(-) diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat index b87e4cab..9209d58c 100644 --- a/recipe/install_llvm.bat +++ b/recipe/install_llvm.bat @@ -9,6 +9,17 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( REM only libLLVM-C move .\temp_prefix\bin\LLVM-C.dll %LIBRARY_BIN% move .\temp_prefix\lib\LLVM-C.lib %LIBRARY_LIB% +) else if "%PKG_NAME%" == "llvm-tools-%PKG_VERSION:~0,2%" ( + cmake --install ./build --prefix=./temp_prefix + if %ERRORLEVEL% neq 0 exit 1 + + mkdir %LIBRARY_PREFIX%\share + REM all the executables (not .dll's) in \bin with a version suffix + cd .\temp_prefix\bin + for %%f in (*.exe) do ( + echo %%~nf + copy "%%~nf.exe" %LIBRARY_BIN%\%%~nf-%PKG_VERSION:~0,2%.exe + ) ) else if "%PKG_NAME%" == "llvm-tools" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index 20a99dd2..c494a4c9 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -30,13 +30,26 @@ elif [[ "${PKG_NAME}" == libllvm* ]]; then mv ./temp_prefix/lib/libLLVM-${MAJOR_EXT}${SHLIB_EXT} $PREFIX/lib mv ./temp_prefix/lib/lib*.so.${SOVER_EXT} $PREFIX/lib || true mv ./temp_prefix/lib/lib*.${SOVER_EXT}.dylib $PREFIX/lib || true -elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then +elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then cmake --install ./build --prefix=./temp_prefix - # everything in /bin & /share - mv ./temp_prefix/bin/* $PREFIX/bin - mv ./temp_prefix/share/* $PREFIX/share + # install all binaries with a -${MAJOR_EXT} + pushd ./temp_prefix + for f in bin/*; do + cp $f $PREFIX/bin/$f-${MAJOR_EXT} + done + popd # except one binary that belongs to llvmdev - rm $PREFIX/bin/llvm-config + rm $PREFIX/bin/llvm-config-${MAJOR_EXT} +elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then + cmake --install ./build --prefix=./temp_prefix + # Install a symlink without the major version + pushd ./temp_prefix + for f in bin/*; do + ln -sf $PREFIX/bin/$f-${MAJOR_EXT} $PREFIX/bin/$f + done + popd + # opt-viewer tool + mv ./temp_prefix/share/* $PREFIX/share else # llvmdev: install everything else cmake --install ./build --prefix=$PREFIX diff --git a/recipe/meta.yaml b/recipe/meta.yaml index deb5b46c..5a02ad91 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -22,7 +22,7 @@ source: - patches/0002-lljit-respect-codemodel.patch build: - number: 1 + number: 2 merge_build_host: false requirements: @@ -149,6 +149,34 @@ outputs: commands: - echo "Hello World!" + # Contains LLVM tools with a version suffix + - name: llvm-tools-{{ major_ver }} + script: install_llvm.sh # [unix] + script: install_llvm.bat # [win] + build: + activate_in_script: true + requirements: + build: + - {{ stdlib('c') }} + - {{ compiler('cxx') }} + - cmake + - ninja + - python >=3 + - libcxx {{ cxx_compiler_version }} # [osx] + host: + - libcxx {{ cxx_compiler_version }} # [osx] + - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - libxml2 + - zlib + - zstd + run: + - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + test: + commands: + - $PREFIX/bin/llc-{{ major_ver }} -version # [not win] + - if not exist "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe exit 1 # [win] + - llc-{{ major_ver }} -version # [win] + # Contains LLVM tools - name: llvm-tools script: install_llvm.sh # [unix] @@ -166,11 +194,13 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" + major_ver, exact=True) }} - libxml2 - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" + major_ver, exact=True) }} run_constrained: - llvm {{ version }} - llvmdev {{ version }} From 5ea7b5a0a601859b151421581506699cf87d50af Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Aug 2024 13:23:25 -0500 Subject: [PATCH 2/9] Update install_llvm.sh --- recipe/install_llvm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index c494a4c9..af805f37 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -35,7 +35,7 @@ elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then # install all binaries with a -${MAJOR_EXT} pushd ./temp_prefix for f in bin/*; do - cp $f $PREFIX/bin/$f-${MAJOR_EXT} + cp $f $PREFIX/bin/$(basename $f)-${MAJOR_EXT} done popd # except one binary that belongs to llvmdev @@ -45,7 +45,7 @@ elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then # Install a symlink without the major version pushd ./temp_prefix for f in bin/*; do - ln -sf $PREFIX/bin/$f-${MAJOR_EXT} $PREFIX/bin/$f + ln -sf $PREFIX/bin/$(basename $f)-${MAJOR_EXT} $PREFIX/bin/$(basename $f) done popd # opt-viewer tool From d9d4e20db25be215a6e48f44080adc9df0ad0a6e Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Aug 2024 13:45:50 -0500 Subject: [PATCH 3/9] Use tilde Co-authored-by: h-vetinari --- recipe/meta.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 5a02ad91..fef90910 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -165,7 +165,7 @@ outputs: - libcxx {{ cxx_compiler_version }} # [osx] host: - libcxx {{ cxx_compiler_version }} # [osx] - - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} + - {{ pin_subpackage("libllvm" ~ major_ver, exact=True) }} - libxml2 - zlib - zstd From c0e3ab6474d391bfac0f2c602fb10d53dcfd92d5 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Aug 2024 16:37:42 -0500 Subject: [PATCH 4/9] Apply suggestions from code review Co-authored-by: h-vetinari --- recipe/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index fef90910..ff02c41a 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -194,13 +194,13 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("llvm-tools-" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} - libxml2 - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("llvm-tools-" + major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} run_constrained: - llvm {{ version }} - llvmdev {{ version }} From 3468dfa67b54065cedef1e363a72dab90b4093fa Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Wed, 7 Aug 2024 23:29:30 -0500 Subject: [PATCH 5/9] fix windows --- recipe/install_llvm.bat | 1 + 1 file changed, 1 insertion(+) diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat index 9209d58c..0b9db0aa 100644 --- a/recipe/install_llvm.bat +++ b/recipe/install_llvm.bat @@ -20,6 +20,7 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( echo %%~nf copy "%%~nf.exe" %LIBRARY_BIN%\%%~nf-%PKG_VERSION:~0,2%.exe ) + cd ..\.. ) else if "%PKG_NAME%" == "llvm-tools" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 From 04adb7660c2414a364a89e02527ce381360c0b9b Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 8 Aug 2024 07:53:48 -0500 Subject: [PATCH 6/9] update tests and fix typo --- recipe/install_llvm.sh | 2 +- recipe/meta.yaml | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index af805f37..eb568736 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -40,7 +40,7 @@ elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then popd # except one binary that belongs to llvmdev rm $PREFIX/bin/llvm-config-${MAJOR_EXT} -elif [[ "${PKG_NAME}" == "llvm-tools-${MAJOR_EXT}" ]]; then +elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then cmake --install ./build --prefix=./temp_prefix # Install a symlink without the major version pushd ./temp_prefix diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ff02c41a..1d320178 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -174,8 +174,9 @@ outputs: test: commands: - $PREFIX/bin/llc-{{ major_ver }} -version # [not win] - - if not exist "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe exit 1 # [win] - - llc-{{ major_ver }} -version # [win] + - "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe -version # [win] + - test ! -f $PREFIX/bin/llvm-config-{{ major_ver }} # [not win] + - if exist "%LIBRARY_BIN%"\\llvm-config-{{ major_ver }}.exe exit 1 # [win] # Contains LLVM tools - name: llvm-tools @@ -209,8 +210,9 @@ outputs: test: commands: - $PREFIX/bin/llc -version # [not win] - - if not exist "%LIBRARY_BIN%"\\llc.exe exit 1 # [win] - - llc -version # [win] + - "%LIBRARY_BIN%"\\llc.exe -version # [win] + - test ! -f $PREFIX/bin/llvm-config # [not win] + - if exist "%LIBRARY_BIN%"\\llvm-config.exe exit 1 # [win] # Contains LLVM-C shared library - name: libllvm-c{{ major_ver }} From ef9a43de22e328b9f418c9b36f4b82ae0561d297 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 8 Aug 2024 08:02:13 -0500 Subject: [PATCH 7/9] Add comment --- recipe/meta.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 1d320178..3910ae1e 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -174,7 +174,10 @@ outputs: test: commands: - $PREFIX/bin/llc-{{ major_ver }} -version # [not win] - - "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe -version # [win] + # The test for windows is split into two lines instead of having it in one line + # like its unix variant because of a YAML parsing issue. + - if not exist "%LIBRARY_BIN%"\\llc-{{ major_ver }}.exe exit 1 # [win] + - llc-{{ major_ver }} -version # [win] - test ! -f $PREFIX/bin/llvm-config-{{ major_ver }} # [not win] - if exist "%LIBRARY_BIN%"\\llvm-config-{{ major_ver }}.exe exit 1 # [win] @@ -210,7 +213,10 @@ outputs: test: commands: - $PREFIX/bin/llc -version # [not win] - - "%LIBRARY_BIN%"\\llc.exe -version # [win] + # The test for windows is split into two lines instead of having it in one line + # like its unix variant because of a YAML parsing issue. + - if not exist "%LIBRARY_BIN%"\\llc.exe exit 1 # [win] + - llc -version # [win] - test ! -f $PREFIX/bin/llvm-config # [not win] - if exist "%LIBRARY_BIN%"\\llvm-config.exe exit 1 # [win] From 768e5985b824f0e3c2d328ff2f2fd45cebbfbec0 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 8 Aug 2024 16:03:50 -0500 Subject: [PATCH 8/9] Update install_llvm.sh --- recipe/install_llvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/recipe/install_llvm.sh b/recipe/install_llvm.sh index eb568736..ee47f881 100644 --- a/recipe/install_llvm.sh +++ b/recipe/install_llvm.sh @@ -50,6 +50,7 @@ elif [[ "${PKG_NAME}" == "llvm-tools" ]]; then popd # opt-viewer tool mv ./temp_prefix/share/* $PREFIX/share + rm $PREFIX/bin/llvm-config else # llvmdev: install everything else cmake --install ./build --prefix=$PREFIX From 8cde7cc9ec35422d47c999e4fc9b47679fb0243f Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 8 Aug 2024 20:58:19 -0500 Subject: [PATCH 9/9] skip windows for versioned llvm-tools --- recipe/install_llvm.bat | 13 +------------ recipe/meta.yaml | 7 +++++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/recipe/install_llvm.bat b/recipe/install_llvm.bat index 0b9db0aa..dc0fc64f 100644 --- a/recipe/install_llvm.bat +++ b/recipe/install_llvm.bat @@ -9,18 +9,6 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( REM only libLLVM-C move .\temp_prefix\bin\LLVM-C.dll %LIBRARY_BIN% move .\temp_prefix\lib\LLVM-C.lib %LIBRARY_LIB% -) else if "%PKG_NAME%" == "llvm-tools-%PKG_VERSION:~0,2%" ( - cmake --install ./build --prefix=./temp_prefix - if %ERRORLEVEL% neq 0 exit 1 - - mkdir %LIBRARY_PREFIX%\share - REM all the executables (not .dll's) in \bin with a version suffix - cd .\temp_prefix\bin - for %%f in (*.exe) do ( - echo %%~nf - copy "%%~nf.exe" %LIBRARY_BIN%\%%~nf-%PKG_VERSION:~0,2%.exe - ) - cd ..\.. ) else if "%PKG_NAME%" == "llvm-tools" ( cmake --install ./build --prefix=./temp_prefix if %ERRORLEVEL% neq 0 exit 1 @@ -29,6 +17,7 @@ if "%PKG_NAME%" == "libllvm-c%PKG_VERSION:~0,2%" ( REM all the executables (not .dll's) in \bin & everything in \share move .\temp_prefix\bin\*.exe %LIBRARY_BIN% move .\temp_prefix\share\* %LIBRARY_PREFIX%\share + del %LIBRARY_BIN%\llvm-config.exe ) else ( REM llvmdev: everything else cmake --install .\build --prefix=%LIBRARY_PREFIX% diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 3910ae1e..ee39d76b 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -155,6 +155,9 @@ outputs: script: install_llvm.bat # [win] build: activate_in_script: true + # On Windows there are no symlinks and copying will create a new package + # that is 300MB+ + skip: true # [win] requirements: build: - {{ stdlib('c') }} @@ -198,13 +201,13 @@ outputs: host: - libcxx {{ cxx_compiler_version }} # [osx] - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] - libxml2 - zlib - zstd run: - {{ pin_subpackage("libllvm" + major_ver, exact=True) }} - - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} + - {{ pin_subpackage("llvm-tools-" ~ major_ver, exact=True) }} # [not win] run_constrained: - llvm {{ version }} - llvmdev {{ version }}