diff --git a/.github/workflows/cctools-prebuilt.yml b/.github/workflows/cctools-prebuilt.yml index 83b0fcf..5a667eb 100644 --- a/.github/workflows/cctools-prebuilt.yml +++ b/.github/workflows/cctools-prebuilt.yml @@ -8,19 +8,20 @@ jobs: fail-fast: false matrix: arch: [ x86_64 ] - os: [ linux ] + os: [ ubuntu-18.04, ubuntu-20.04 ] include: - - os: linux + - os: ubuntu-18.04 runner: ubuntu-18.04 + - os: ubuntu-20.04 + runner: ubuntu-20.04 + steps: - name: Configure Linux runner - if: runner.os == 'Linux' run: | sudo apt update - sudo apt install git xz-utils + sudo apt install git xz-utils ninja-build sudo apt install libssl-dev libxml2-dev liblzma-dev libbz2-dev - sudo apt install ninja-build ${{matrix.multilib}} - name: Build libxar run: | diff --git a/.github/workflows/llvm-prebuilt.yml b/.github/workflows/llvm-prebuilt.yml index a22c01a..fc22e50 100644 --- a/.github/workflows/llvm-prebuilt.yml +++ b/.github/workflows/llvm-prebuilt.yml @@ -2,13 +2,13 @@ name: LLVM prebuilt on: workflow_dispatch jobs: build: - name: LLVM ${{matrix.version}} [${{matrix.arch}}-${{matrix.os}}] + name: LLVM ${{matrix.version}} [${{matrix.arch}}-${{matrix.os}}] ${{matrix.distro}} runs-on: ${{matrix.runner}} strategy: fail-fast: false matrix: arch: [ x86_64, aarch64 ] - os: [ windows, macos, linux ] + os: [ windows, macos, ubuntu-18.04, ubuntu-20.04 ] version: [ 12.0.1 ] include: @@ -19,8 +19,10 @@ jobs: runner: windows-2019 - os: macos runner: macos-10.15 - - os: linux + - os: ubuntu-18.04 runner: ubuntu-18.04 + - os: ubuntu-20.04 + runner: ubuntu-20.04 - arch: x86_64 os: windows @@ -35,9 +37,6 @@ jobs: - arch: aarch64 os: macos osx_arch: arm64 - - - arch: aarch64 - os: linux steps: - name: Configure Windows runner if: runner.os == 'Windows' @@ -50,16 +49,33 @@ jobs: brew install ninja echo "MACOSX_DEPLOYMENT_TARGET=10.12" >> $GITHUB_ENV - - name: Configure Ubuntu runner - if: runner.os == 'Linux' + - name: Configure Ubuntu 18.04 runner + if: matrix.os == 'ubuntu-18.04' + shell: pwsh + run: | + sudo apt update + sudo apt install xz-utils libxml2-dev + sudo apt install ninja-build + sudo apt install g++-aarch64-linux-gnu + mkdir libxml2-dev-arm64 && cd libxml2-dev-arm64 + $LibXmlDebFile = "libxml2-dev_2.9.4+dfsg1-6.1ubuntu1.4_arm64.deb" + wget -q "http://ports.ubuntu.com/pool/main/libx/libxml2/$LibXmlDebFile" + ar -x "$LibXmlDebFile" + tar -xf data.tar.xz + sudo cp -R ./usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu + + - name: Configure Ubuntu 20.04 runner + if: matrix.os == 'ubuntu-20.04' + shell: pwsh run: | sudo apt update sudo apt install xz-utils libxml2-dev sudo apt install ninja-build sudo apt install g++-aarch64-linux-gnu mkdir libxml2-dev-arm64 && cd libxml2-dev-arm64 - wget http://ports.ubuntu.com/pool/main/libx/libxml2/libxml2-dev_2.9.4+dfsg1-6.1ubuntu1.4_arm64.deb - ar -x libxml2-dev_2.9.4+dfsg1-6.1ubuntu1.4_arm64.deb + $LibXmlDebFile = "libxml2-dev_2.9.10+dfsg-5ubuntu0.20.04.1_arm64.deb" + wget -q "http://ports.ubuntu.com/pool/main/libx/libxml2/$LibXmlDebFile" + ar -x "$LibXmlDebFile" tar -xf data.tar.xz sudo cp -R ./usr/lib/aarch64-linux-gnu/ /usr/lib/aarch64-linux-gnu @@ -77,7 +93,7 @@ jobs: - name: Patch LLVM run: | - git -C llvm-project apply ../llvm-prebuilt/patches/0001-add-lld-headers-target.patch + git -C llvm-project apply ../llvm-prebuilt/patches/0001-add-lld-install-targets.patch - name: Enable Windows host environment if: runner.os == 'Windows' diff --git a/.github/workflows/msvc-bundle.yml b/.github/workflows/msvc-bundle.yml new file mode 100644 index 0000000..33e69c2 --- /dev/null +++ b/.github/workflows/msvc-bundle.yml @@ -0,0 +1,42 @@ +name: msvc bundle +on: workflow_dispatch +jobs: + build: + name: MSVC bundle + runs-on: windows-2019 + steps: + - name: Configure Windows runner + run: | + choco install 7zip + + - name: Enable Windows target environment + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: amd64 + + - name: Copy MSVC bundle + shell: pwsh + run: | + $BundlePath = $Env:GITHUB_WORKSPACE + Copy-Item -Recurse -Path $Env:VCToolsInstallDir\include -Destination $BundlePath\vctools\include + Copy-Item -Recurse -Path $Env:VCToolsInstallDir\lib -Destination $BundlePath\vctools\lib + Copy-Item -Recurse -Path $Env:WindowsSdkDir\Include\$Env:WindowsSDKVersion\ $BundlePath\winsdk\Include\$Env:WindowsSDKVersion + Copy-Item -Recurse -Path $Env:WindowsSdkDir\Lib\$Env:WindowsSDKVersion\ $BundlePath\winsdk\Lib\$Env:WindowsSDKVersion + + - name: Package MSVC bundle + shell: pwsh + run: | + cmd.exe /c "7z a -ttar -snl -so vctools.tar vctools | 7z a -si vctools.tar.xz" + cmd.exe /c "7z a -ttar -snl -so winsdk.tar winsdk | 7z a -si winsdk.tar.xz" + + - name: Upload vctools package + uses: actions/upload-artifact@v2 + with: + name: vctools + path: vctools.tar.xz + + - name: Upload winsdk package + uses: actions/upload-artifact@v2 + with: + name: winsdk + path: winsdk.tar.xz diff --git a/.github/workflows/xcode-bundle.yml b/.github/workflows/xcode-bundle.yml new file mode 100644 index 0000000..3791738 --- /dev/null +++ b/.github/workflows/xcode-bundle.yml @@ -0,0 +1,45 @@ +name: xcode bundle +on: workflow_dispatch +jobs: + build: + name: Xcode bundle + runs-on: macos-10.15 + steps: + - name: Configure macOS runner + run: | + brew install --cask powershell + + - name: Copy Xcode bundle + shell: pwsh + run: | + $XcodeDeveloperPath = $(xcode-select -p) + $XcodePlatformsPath = Join-Path $XcodeDeveloperPath "Platforms" + + $BundlePath = Join-Path $Env:GITHUB_WORKSPACE "xcode-bundle" + New-Item -Path $BundlePath -ItemType Directory | Out-Null + + foreach ($Platform in @('MacOSX','iPhoneOS','iPhoneSimulator')) { + Write-Host "Copying $Platform SDK" + $PlatformPath = Join-Path $XcodePlatformsPath "$Platform.platform" + $PlatformSdkPath = Join-Path $PlatformPath "Developer" "SDKs" "$Platform.sdk" + Copy-Item -Recurse -Path $PlatformSdkPath -Destination $BundlePath + } + + Write-Host "Copying Xcode xctoolchain" + $XcodeToolchainsPath = Join-Path $XcodeDeveloperPath "Toolchains" + $XcodeToolchainPath = Join-Path $XcodeToolchainsPath "XcodeDefault.xctoolchain" + $DestinationPath = Join-Path $BundlePath "XcodeDefault.xctoolchain" + New-Item -Path $DestinationPath -ItemType Directory | Out-Null + Copy-Item -Recurse -Path "$XcodeToolchainPath\usr\include" -Destination "$DestinationPath\usr\include" + Copy-Item -Recurse -Path "$XcodeToolchainPath\usr\lib" -Destination "$DestinationPath\usr\lib" + + - name: Package Xcode bundle + shell: pwsh + run: | + tar -cJf xcode-bundle.tar.xz xcode-bundle + + - name: Upload xcode-bundle package + uses: actions/upload-artifact@v2 + with: + name: xcode-bundle + path: xcode-bundle.tar.xz diff --git a/cmake/aarch64-ubuntu-18.04.cmake b/cmake/aarch64-ubuntu-18.04.cmake new file mode 100644 index 0000000..e168398 --- /dev/null +++ b/cmake/aarch64-ubuntu-18.04.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/aarch64-linux.cmake") \ No newline at end of file diff --git a/cmake/aarch64-ubuntu-20.04.cmake b/cmake/aarch64-ubuntu-20.04.cmake new file mode 100644 index 0000000..e168398 --- /dev/null +++ b/cmake/aarch64-ubuntu-20.04.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/aarch64-linux.cmake") \ No newline at end of file diff --git a/cmake/llvm-distribution.cmake b/cmake/llvm-distribution.cmake index 36defc4..f46b3bd 100644 --- a/cmake/llvm-distribution.cmake +++ b/cmake/llvm-distribution.cmake @@ -126,6 +126,7 @@ set(LLVM_DEVELOPMENT_COMPONENTS clang-resource-headers libclang-headers lld-headers # requires patch + lld-libraries # requires patch lld-cmake-exports CACHE STRING "") diff --git a/cmake/x86_64-ubuntu-18.04.cmake b/cmake/x86_64-ubuntu-18.04.cmake new file mode 100644 index 0000000..bed7aa5 --- /dev/null +++ b/cmake/x86_64-ubuntu-18.04.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/x86_64-linux.cmake") \ No newline at end of file diff --git a/cmake/x86_64-ubuntu-20.04.cmake b/cmake/x86_64-ubuntu-20.04.cmake new file mode 100644 index 0000000..bed7aa5 --- /dev/null +++ b/cmake/x86_64-ubuntu-20.04.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/x86_64-linux.cmake") \ No newline at end of file diff --git a/patches/0001-add-lld-headers-target.patch b/patches/0001-add-lld-headers-target.patch deleted file mode 100644 index 6fca958..0000000 --- a/patches/0001-add-lld-headers-target.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 65610409f3a55c9f9793fab44d76088e589ffbb3 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= -Date: Wed, 8 Sep 2021 08:49:13 -0400 -Subject: [PATCH] add lld-headers target - ---- - lld/CMakeLists.txt | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt -index 2e99564f4..2d02b0cb5 100644 ---- a/lld/CMakeLists.txt -+++ b/lld/CMakeLists.txt -@@ -189,9 +189,19 @@ include_directories(BEFORE - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - install(DIRECTORY include/ - DESTINATION include -+ COMPONENT lld-headers - FILES_MATCHING - PATTERN "*.h" - ) -+ -+ add_custom_target(lld-headers) -+ set_target_properties(lld-headers PROPERTIES FOLDER "Misc") -+ -+ if(NOT LLVM_ENABLE_IDE) -+ add_llvm_install_targets(install-lld-headers -+ DEPENDS lld-headers -+ COMPONENT lld-headers) -+ endif() - endif() - - add_subdirectory(Common) --- -2.25.1 - diff --git a/patches/0001-add-lld-install-targets.patch b/patches/0001-add-lld-install-targets.patch new file mode 100644 index 0000000..14c547e --- /dev/null +++ b/patches/0001-add-lld-install-targets.patch @@ -0,0 +1,77 @@ +From 2b6f6d9199b1a7ce9e9034df3909cddd8bcde6d0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= +Date: Wed, 8 Sep 2021 08:49:13 -0400 +Subject: [PATCH] add lld install targets + +--- + lld/CMakeLists.txt | 32 ++++++++++++++++++++++++++++++++ + lld/cmake/modules/AddLLD.cmake | 2 +- + 2 files changed, 33 insertions(+), 1 deletion(-) + +diff --git a/lld/CMakeLists.txt b/lld/CMakeLists.txt +index 2e99564f4..5bb3d9ec0 100644 +--- a/lld/CMakeLists.txt ++++ b/lld/CMakeLists.txt +@@ -189,9 +189,19 @@ include_directories(BEFORE + if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) + install(DIRECTORY include/ + DESTINATION include ++ COMPONENT lld-headers + FILES_MATCHING + PATTERN "*.h" + ) ++ ++ add_custom_target(lld-headers) ++ set_target_properties(lld-headers PROPERTIES FOLDER "Misc") ++ ++ if(NOT LLVM_ENABLE_IDE) ++ add_llvm_install_targets(install-lld-headers ++ DEPENDS lld-headers ++ COMPONENT lld-headers) ++ endif() + endif() + + add_subdirectory(Common) +@@ -210,4 +220,26 @@ add_subdirectory(MachO) + add_subdirectory(MinGW) + add_subdirectory(wasm) + ++# Custom target to install all lld libraries. ++add_custom_target(lld-libraries) ++set_target_properties(lld-libraries PROPERTIES FOLDER "Misc") ++ ++if(NOT LLVM_ENABLE_IDE) ++ add_llvm_install_targets(install-lld-libraries ++ DEPENDS lld-libraries ++ COMPONENT lld-libraries) ++endif() ++ ++get_property(LLD_EXPORTS GLOBAL PROPERTY LLD_EXPORTS) ++if(LLD_EXPORTS) ++ list(REMOVE_DUPLICATES LLD_EXPORTS) ++ foreach(lib ${LLD_EXPORTS}) ++ add_dependencies(lld-libraries ${lib}) ++ if(NOT LLVM_ENABLE_IDE) ++ add_dependencies(install-lld-libraries install-${lib}) ++ add_dependencies(install-lld-libraries-stripped install-${lib}-stripped) ++ endif() ++ endforeach() ++endif() ++ + add_subdirectory(cmake/modules) +diff --git a/lld/cmake/modules/AddLLD.cmake b/lld/cmake/modules/AddLLD.cmake +index 9883475d1..b2f597191 100644 +--- a/lld/cmake/modules/AddLLD.cmake ++++ b/lld/cmake/modules/AddLLD.cmake +@@ -21,7 +21,7 @@ macro(add_lld_library name) + ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} + RUNTIME DESTINATION bin) + +- if (${ARG_SHARED} AND NOT CMAKE_CONFIGURATION_TYPES) ++ if (NOT CMAKE_CONFIGURATION_TYPES) + add_llvm_install_targets(install-${name} + DEPENDS ${name} + COMPONENT ${name}) +-- +2.25.1 +