diff --git a/.circleci/config.yml b/.circleci/config.yml index 4d88066bc94..4f4ac09dda5 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,95 +1,252 @@ +commonSteps: &commonSteps + steps: + # Each step starts in working dir `/project` (containing the cloned LDC repo). + - run: + name: Install dependencies + command: | + cd .. + if [ "$CI_OS" = "linux" ]; then + export DEBIAN_FRONTEND=noninteractive + dpkg --add-architecture i386 + apt-get -y update + apt-get -yq install software-properties-common + add-apt-repository -y ppa:ubuntu-toolchain-r/test + apt-get -y update + apt-get -yq install curl git-core g++-6-multilib ninja-build gdb python-pip unzip zip libcurl4-openssl-dev libcurl3:i386 + echo "export CC=gcc-6" >> $BASH_ENV + echo "export CXX=g++-6" >> $BASH_ENV + # install CMake + curl -L -o cmake-x64.tar.gz https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.tar.gz + mkdir cmake-x64 + tar -xf cmake-x64.tar.gz --strip 1 -C cmake-x64 + echo "export PATH=$PWD/cmake-x64/bin:$PATH" >> $BASH_ENV + # use ld.gold per default, so that LTO is tested + update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 99 + else + # install CMake + curl -L -o cmake-x64.tar.gz https://cmake.org/files/v3.10/cmake-3.10.0-Darwin-x86_64.tar.gz + mkdir cmake-x64 + tar -xf cmake-x64.tar.gz --strip 3 -C cmake-x64 + # install Ninja + curl -OL https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-mac.zip + mkdir ninja + tar -xf ninja-mac.zip -C ninja + echo "export PATH=$PWD/cmake-x64/bin:$PWD/ninja:$PATH" >> $BASH_ENV + # install Python pip + curl -OL https://bootstrap.pypa.io/get-pip.py + python get-pip.py + fi + # install lit + pip install --user lit + - checkout + - run: + name: Checkout git submodules + command: git submodule update --init + - run: + name: Install LDC-flavoured LLVM + command: | + cd .. + mkdir llvm-$LLVM_VERSION + assertsSuffix="" + if [ -z "$CIRCLE_TAG" ]; then + echo "Using LLVM with enabled assertions" + assertsSuffix="-withAsserts" + fi + curl -L -o llvm.tar.xz https://github.com/ldc-developers/llvm/releases/download/ldc-v$LLVM_VERSION/llvm-$LLVM_VERSION-$CI_OS-x86_64$assertsSuffix.tar.xz + tar -xf llvm.tar.xz --strip 1 -C llvm-$LLVM_VERSION + rm llvm.tar.xz + - run: + name: Install LDC host compiler + command: | + cd .. + curl -L -o ldc2.tar.xz https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-$CI_OS-x86_64.tar.xz + mkdir ldc2-$HOST_LDC_VERSION + tar -xf ldc2.tar.xz --strip 1 -C ldc2-$HOST_LDC_VERSION + rm ldc2.tar.xz + - run: + name: Build bootstrap LDC + command: | + cd .. + # output versions + cmake --version + ninja --version + if [ "$CI_OS" = "linux" ]; then gdb --version; fi + python -c "import lit; lit.main();" --version | head -n 1 + # build + HOST_LDMD=$PWD/ldc2-$HOST_LDC_VERSION/bin/ldmd2 + mkdir bootstrap + cd bootstrap + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION -DBUILD_SHARED_LIBS=OFF -DD_COMPILER=$HOST_LDMD $BOOTSTRAP_CMAKE_FLAGS $CIRCLE_WORKING_DIRECTORY + ninja -j3 + bin/ldc2 -version + cd .. + - run: + name: Build LDC and stdlib unittest runners + command: | + cd .. + INSTALL_DIR=$PWD/ldc2-x64 + HOST_LDMD=$PWD/bootstrap/bin/ldmd2 + mkdir ninja-ldc + cd ninja-ldc + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR -DINCLUDE_INSTALL_DIR=$INSTALL_DIR/import -DD_COMPILER=$HOST_LDMD $EXTRA_CMAKE_FLAGS $CIRCLE_WORKING_DIRECTORY + # compiling the std.regex.internal.tests unittests eats large amounts of memory + if [ "$CI_OS" = "linux" ]; then + ninja -j2 all runtime/objects-unittest-debug/std/regex/internal/tests.o runtime/objects-unittest/std/regex/internal/tests.o runtime/objects-unittest-debug_32/std/regex/internal/tests.o runtime/objects-unittest_32/std/regex/internal/tests.o + else + ninja -j2 all runtime/objects-unittest-debug_64/std/regex/internal/tests.o runtime/objects-unittest_64/std/regex/internal/tests.o runtime/objects-unittest-debug_32/std/regex/internal/tests.o runtime/objects-unittest_32/std/regex/internal/tests.o + fi + ninja -j3 all-test-runners + bin/ldc2 -version + cd .. + - run: + name: Build and run LDC D unittests + when: always + command: cd ../ninja-ldc && ctest --output-on-failure -R ldc2-unittest + - run: + name: Run LIT testsuite + when: always + command: cd ../ninja-ldc && ctest -V -R lit-tests + - run: + name: Run DMD testsuite + when: always + command: | + cd ../ninja-ldc + if [ "$CI_OS" = "linux" ]; then + DMD_TESTSUITE_MAKE_ARGS=-j3 ctest -V -R dmd-testsuite + else + # FIXME: 32-bit runnable/test13613.d fails due to output containing linker warnings like: + # ld: warning: could not create compact unwind for __D3std11parallelism16submitAndExecuteFCQBlQBk8TaskPoolMDFZvZv: stack subl instruction is too different from dwarf stack size + rm ../project/tests/d2/dmd-testsuite/runnable/test13613.d + DMD_TESTSUITE_MAKE_ARGS=-j3 ctest -V -R dmd-testsuite + fi + - run: + name: Run stdlib unittests + when: always + command: | + cd ../ninja-ldc + if [ "$CI_OS" = "linux" ]; then + # FIXME: Exclude std.process unittests for now. + # CircleCI doesn't throw an expected ProcessException when spawning a + # process in a working dir with 0400 permissions (no search permissions). + ctest -j3 --output-on-failure -E "std\.process|dmd-testsuite|ldc2-unittest|lit-tests" + else + ctest -j3 --output-on-failure -E "dmd-testsuite|ldc2-unittest|lit-tests" + fi + - run: + name: Install LDC + command: | + cd ../ninja-ldc + ninja install + cd .. + perl -pi -e s?$PWD/ldc2-x64/?%%ldcbinarypath%%/../?g ldc2-x64/etc/ldc2.conf + cp project/LICENSE ldc2-x64 + git clone https://github.com/ldc-developers/ldc-scripts.git + cp ldc-scripts/ldc2-packaging/pkgfiles/README ldc2-x64 + cp -r ldc-scripts/ldc2-packaging/pkgfiles/dub ldc2-x64/etc + - run: + name: Build dub + command: | + cd .. + LDC_INSTALL_DIR=$PWD/ldc2-x64 + export DMD=$LDC_INSTALL_DIR/bin/ldmd2 + git clone --recursive https://github.com/dlang/dub.git + cd dub + git checkout $DUB_VERSION + if [ -z "$CIRCLE_TAG" ]; then + # FIXME: dub is built with `-g -O`, which leads to issue #2361 with enabled + # assertions, at least on Linux. So strip `-g` for untagged builds. + perl -pi -e "s? -g -O ? -O ?g" build.sh + fi + ./build.sh + cp bin/dub $LDC_INSTALL_DIR/bin + cd .. + - run: + name: Build dlang tools + command: | + cd .. + LDC_INSTALL_DIR=$PWD/ldc2-x64 + git clone --recursive https://github.com/dlang/tools.git + cd tools + make -f posix.mak install DMD=$LDC_INSTALL_DIR/bin/ldmd2 INSTALL_DIR=$PWD + cp bin/rdmd bin/ddemangle bin/dustmite $LDC_INSTALL_DIR/bin + cd .. + - run: + name: Pack installation dir + command: | + cd .. + mkdir artifacts + if [ -z "$CIRCLE_TAG" ]; then + artifactBasename="ldc2-${CIRCLE_SHA1:0:8}-$CI_OS-x86_64-$(date "+%Y%m%d")" + else + artifactBasename="ldc2-${CIRCLE_TAG:1}-$CI_OS-x86_64" + fi + mv ldc2-x64 $artifactBasename + XZ_OPT=-9 tar -cJf "artifacts/$artifactBasename.tar.xz" $artifactBasename + - run: + name: Pack source dir + command: | + cd .. + if [ "$CI_OS" = "linux" ]; then + if [ -z "$CIRCLE_TAG" ]; then + artifactBasename="ldc-${CIRCLE_SHA1:0:8}-src" + else + artifactBasename="ldc-${CIRCLE_TAG:1}-src" + fi + XZ_OPT=-9 tar -czf "artifacts/$artifactBasename.tar.gz" --exclude-vcs --transform=s/project/$artifactBasename/ project + tar -xf "artifacts/$artifactBasename.tar.gz" + zip -r -9 "artifacts/$artifactBasename.zip" $artifactBasename + fi + - store_artifacts: + path: ../artifacts + - run: + name: Deploy to GitHub CI release + command: | + cd .. + if [[ -n "$CIRCLE_TAG" || ( "$CIRCLE_BRANCH" = "master" && -z "$CIRCLE_PR_NUMBER" ) ]]; then + if [ "$CI_OS" = "linux" ]; then + curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 + else + curl -L -o github-release.tar.bz2 https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2 + fi + tar -xf github-release.tar.bz2 --strip 3 + if [ -z "$CIRCLE_TAG" ]; then CIRCLE_TAG="CI"; fi + # Note: needs GITHUB_TOKEN environment variable + ./github-release upload --user ldc-developers --repo ldc --tag $CIRCLE_TAG --name "$(cd artifacts && ls ldc2-*.tar.xz)" --file artifacts/ldc2-*.tar.xz + if [ -n "$CIRCLE_TAG"] && [ "$CI_OS" = "linux" ]; then + ./github-release upload --user ldc-developers --repo ldc --tag $CIRCLE_TAG --name "$(cd artifacts && ls ldc-*-src.tar.gz)" --file artifacts/ldc-*-src.tar.gz + ./github-release upload --user ldc-developers --repo ldc --tag $CIRCLE_TAG --name "$(cd artifacts && ls ldc-*-src.zip)" --file artifacts/ldc-*-src.zip + fi + fi + version: 2 jobs: - build: + build-linux: + <<: *commonSteps docker: - - image: gcc + - image: ubuntu:14.04 environment: - - LLVM_VERSION: 5.0.0 - - HOST_LDC_VERSION: 1.3.0 - steps: - - checkout - - run: - name: Checkout git submodules - command: git submodule update --init - - run: - name: Install basic dependencies - command: | - apt update - apt install -y software-properties-common cmake ninja-build gdb python-pip unzip - pip install --user lit - # Use ld.gold per default, so that LTO is tested. - update-alternatives --install /usr/bin/ld ld /usr/bin/ld.gold 99 - g++ --version - ld --version - cmake --version - ninja --version - gdb --version - python -c "import lit; lit.main();" --version | head -n 1 - - restore_cache: - keys: - - llvm-5.0.0 - - host-ldc-{{ .Environment.HOST_LDC_VERSION }} - - run: - name: Install LLVM 5.0.0 - command: | - if [[ ! -d llvm-$LLVM_VERSION ]]; then - wget -O llvm-$LLVM_VERSION.tar.xz http://releases.llvm.org/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-linux-x86_64-ubuntu16.04.tar.xz - mkdir llvm-$LLVM_VERSION - tar -xpf llvm-$LLVM_VERSION.tar.xz --strip 1 -C llvm-$LLVM_VERSION - fi - - save_cache: - key: llvm-5.0.0 - paths: - - llvm-5.0.0 - - run: - name: Install LDC host compiler - command: | - if [[ ! -e ldc2-$HOST_LDC_VERSION-linux-x86_64/bin/ldmd2 ]]; then - wget https://github.com/ldc-developers/ldc/releases/download/v$HOST_LDC_VERSION/ldc2-$HOST_LDC_VERSION-linux-x86_64.tar.xz - tar -xf ldc2-$HOST_LDC_VERSION-linux-x86_64.tar.xz - fi - - save_cache: - key: host-ldc-{{ .Environment.HOST_LDC_VERSION }} - paths: - - ldc2-$HOST_LDC_VERSION-linux-x86_64 - - run: - name: Build bootstrap LDC - command: | - export HOST_LDMD=$PWD/ldc2-$HOST_LDC_VERSION-linux-x86_64/bin/ldmd2 - mkdir bootstrap - cd bootstrap - cmake -G Ninja -DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION -DBUILD_SHARED_LIBS=OFF -DD_COMPILER=$HOST_LDMD .. - ninja -j3 - bin/ldc2 -version - cd .. - - run: - name: Build LDC and stdlib unittest runners - command: | - export HOST_LDMD=$PWD/bootstrap/bin/ldmd2 - mkdir build - cd build - cmake -G Ninja -DLLVM_ROOT_DIR=$PWD/../llvm-$LLVM_VERSION -DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON -DD_COMPILER=$HOST_LDMD .. - # compiling the std.regex.internal.tests unittests eats large amounts of memory - ninja -j2 all runtime/objects-unittest-debug/std/regex/internal/tests.o runtime/objects-unittest/std/regex/internal/tests.o - ninja -j3 all-test-runners - bin/ldc2 -version - cd .. - - run: - name: Build and run LDC D unittests - command: cd build && ctest --output-on-failure -R ldc2-unittest - when: always - - run: - name: Run LIT testsuite - command: cd build && ctest -V -R lit-tests - when: always - - run: - name: Run DMD testsuite - command: cd build && DMD_TESTSUITE_MAKE_ARGS=-j3 ctest -V -R dmd-testsuite - when: always - - run: - name: Run stdlib unittests - # FIXME: Exclude std.process unittests for now. - # CircleCI doesn't throw an expected ProcessException when spawning a - # process in a working dir with 0400 permissions (no search permissions). - command: cd build && ctest -j3 --output-on-failure -E "std\.process|dmd-testsuite|ldc2-unittest|lit-tests" - when: always + - CI_OS: "linux" + - LLVM_VERSION: 5.0.0-2 + - HOST_LDC_VERSION: 1.6.0 + - EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DCMAKE_EXE_LINKER_FLAGS=-static-libstdc++ -DLDC_INSTALL_LTOPLUGIN=ON -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON" + - DUB_VERSION: v1.6.0 + build-osx: + <<: *commonSteps + macos: + xcode: "9.0" + environment: + - CI_OS: "osx" + - MACOSX_DEPLOYMENT_TARGET: 10.8 + - USE_LIBCPP: "true" + - LLVM_VERSION: 5.0.0-2 + - HOST_LDC_VERSION: 1.6.0 + - BOOTSTRAP_CMAKE_FLAGS: "-DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS=-lc++" + - EXTRA_CMAKE_FLAGS: "-DMULTILIB=ON -DCMAKE_CXX_FLAGS='-stdlib=libc++' -DCMAKE_EXE_LINKER_FLAGS=-lc++" + - DUB_VERSION: v1.6.0 + +workflows: + version: 2 + build: + jobs: + - build-linux + - build-osx diff --git a/.travis.yml b/.travis.yml index 40aff5c8d4e..9c1d5e30272 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,7 @@ cache: - llvm-3.9.1 - llvm-3.8.1 - llvm-3.7.1 + addons: apt: sources: @@ -45,38 +46,33 @@ addons: - g++-4.9 - gdb - ninja-build + before_install: - - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then - if [ "${LLVM_VERSION}" = "5.0.0" ]; then - export LLVM_ARCH="linux-x86_64-ubuntu14.04"; - elif [ "${LLVM_VERSION}" = "4.0.1" ]; then - export LLVM_ARCH="x86_64-linux-gnu-debian8"; - else - export LLVM_ARCH="x86_64-linux-gnu-ubuntu-14.04"; - fi; - else - export LLVM_ARCH="x86_64-apple-darwin"; - fi; - if [ -z "$(ls -A llvm-$LLVM_VERSION)" ]; then + export LLVM_ROOT_DIR="$PWD/llvm-$LLVM_VERSION"; + if [ -n "${LLVM_SPIRV_AVAILABLE}" ]; then export LLVM_ROOT_DIR="$PWD/llvm-spirv-$LLVM_VERSION"; fi + - + if [ ! -d "$LLVM_ROOT_DIR" ]; then if [ -n "${LLVM_SPIRV_AVAILABLE}" ]; then - wget -O llvm-spirv-$LLVM_VERSION.tar.bz2 https://github.com/thewilsonator/llvm/releases/download/pre-intrinsics/LLVM-6.0.0svn-Darwin.tar.bz2; - mkdir llvm-spirv-$LLVM_VERSION; - tar -xjf llvm-spirv-$LLVM_VERSION.tar.bz2 --strip 1 -C llvm-spirv-$LLVM_VERSION; + wget -O llvm.tar.bz2 https://github.com/thewilsonator/llvm/releases/download/pre-intrinsics/LLVM-6.0.0svn-Darwin.tar.bz2; else - wget -O llvm-$LLVM_VERSION.tar.xz http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-${LLVM_ARCH}.tar.xz; - mkdir llvm-$LLVM_VERSION; - tar -xf llvm-$LLVM_VERSION.tar.xz --strip 1 -C llvm-$LLVM_VERSION; + if [ "${TRAVIS_OS_NAME}" = "linux" ]; then + if [ "${LLVM_VERSION}" = "5.0.0" ]; then + export LLVM_ARCH="linux-x86_64-ubuntu14.04"; + elif [ "${LLVM_VERSION}" = "4.0.1" ]; then + export LLVM_ARCH="x86_64-linux-gnu-debian8"; + else + export LLVM_ARCH="x86_64-linux-gnu-ubuntu-14.04"; + fi; + else + export LLVM_ARCH="x86_64-apple-darwin"; + fi; + wget -O llvm.tar.xz http://llvm.org/releases/$LLVM_VERSION/clang+llvm-$LLVM_VERSION-${LLVM_ARCH}.tar.xz; fi; - fi; - - if [ -n "${LLVM_SPIRV_AVAILABLE}" ]; then - llvm-spirv-$LLVM_VERSION/bin/llvm-config --version; - export LLVM_CONFIG="llvm-spirv-$LLVM_VERSION/bin/llvm-config"; - else - llvm-$LLVM_VERSION/bin/llvm-config --version; - export LLVM_CONFIG="llvm-$LLVM_VERSION/bin/llvm-config"; - fi; + mkdir $LLVM_ROOT_DIR; + tar -xf llvm.tar.* --strip 1 -C $LLVM_ROOT_DIR; + rm llvm.tar.*; + fi install: - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then export CC="gcc-4.9"; export CXX="g++-4.9"; fi @@ -97,10 +93,8 @@ install: - eval "${DC} --version" script: - # Invoke CMake with MULTILIB=ON just to make sure the Makefiles can be generated. - - mkdir multilibCMakeTest && cd multilibCMakeTest && cmake -DMULTILIB=ON -DLLVM_CONFIG=$(which ../${LLVM_CONFIG}) $OPTS .. && cd .. - # Invoke CMake again for the actual build. - - cmake -G Ninja -DLLVM_CONFIG=$(which ${LLVM_CONFIG}) -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON $OPTS . + # Invoke CMake to generate the Ninja build files. + - cmake -G Ninja -DLLVM_ROOT_DIR=$LLVM_ROOT_DIR -DLDC_INSTALL_LLVM_RUNTIME_LIBS=ON $OPTS . # Build LDC and stdlib unittest runners. # [Compiling the std.regex.internal.tests unittests eats large amounts of memory.] - ninja -j2 all runtime/objects-unittest-debug/std/regex/internal/tests.o runtime/objects-unittest/std/regex/internal/tests.o diff --git a/appveyor.yml b/appveyor.yml index 11eed6eaa77..19e7d239846 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,25 +4,22 @@ #version: 1.0.{build}-{branch} -# Do not build on tags (GitHub only) -skip_tags: true - #---------------------------------# # environment configuration # #---------------------------------# environment: matrix: - - APPVEYOR_JOB_ARCH: x64 + - APPVEYOR_JOB_ARCH: x64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - D_COMPILER: ldc - - APPVEYOR_JOB_ARCH: x86 + LLVM_VERSION: 5.0.0-2 + HOST_LDC_VERSION: 1.6.0 + DUB_VERSION: v1.6.0 + - APPVEYOR_JOB_ARCH: x86 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - D_COMPILER: ldc - -#matrix: -# allow_failures: -# - APPVEYOR_JOB_ARCH: x86 + LLVM_VERSION: 5.0.0-2 + HOST_LDC_VERSION: 1.6.0 + DUB_VERSION: v1.6.0 # scripts that are called at very beginning, before repo cloning init: @@ -41,13 +38,19 @@ install: - cd libcurl - 7z x ..\libcurl.zip > nul - cd .. - # Copy libcurl.dll to final LDC installation directory and add to PATH - - md ldc-%APPVEYOR_JOB_ARCH% && md ldc-%APPVEYOR_JOB_ARCH%\bin - - if "%APPVEYOR_JOB_ARCH%"=="x64" ( copy libcurl\dmd2\windows\bin64\libcurl.dll ldc-x64\bin ) - - if "%APPVEYOR_JOB_ARCH%"=="x86" ( copy libcurl\dmd2\windows\bin\libcurl.dll ldc-x86\bin ) - - set PATH=%CD%\ldc-%APPVEYOR_JOB_ARCH%\bin;%PATH% + # Copy libcurl.{dll,lib} to final LDC installation directory and add to PATH + - md ldc2-%APPVEYOR_JOB_ARCH% && md ldc2-%APPVEYOR_JOB_ARCH%\bin && md ldc2-%APPVEYOR_JOB_ARCH%\lib + - ps: | + If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') { + cp libcurl\dmd2\windows\bin64\libcurl.dll ldc2-x64\bin + cp libcurl\dmd2\windows\lib64\curl.lib ldc2-x64\lib + } Else { + cp libcurl\dmd2\windows\bin\libcurl.dll ldc2-x86\bin + cp libcurl\dmd2\windows\lib32mscoff\curl.lib ldc2-x86\lib + } + - set PATH=%CD%\ldc2-%APPVEYOR_JOB_ARCH%\bin;%PATH% # Download & extract Ninja - - appveyor DownloadFile "https://github.com/ninja-build/ninja/releases/download/v1.7.2/ninja-win.zip" -FileName ninja.zip + - appveyor DownloadFile "https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip" -FileName ninja.zip - md ninja - cd ninja - 7z x ..\ninja.zip > nul @@ -59,24 +62,16 @@ install: - python -c "import lit; lit.main();" --version # Download & extract D compiler - ps: | - If ($Env:D_COMPILER -eq 'dmd') { - $dmdVersion = '2.075.1' - appveyor DownloadFile "http://downloads.dlang.org/releases/2.x/$dmdVersion/dmd.$dmdVersion.windows.7z" -FileName dmd2.7z - 7z x dmd2.7z > $null - Set-Item -path env:DMD -value c:\projects\dmd2\windows\bin\dmd.exe + $ldcVersion = $Env:HOST_LDC_VERSION + If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') { + appveyor DownloadFile "http://github.com/ldc-developers/ldc/releases/download/v$ldcVersion/ldc2-$ldcVersion-win64-msvc.zip" -FileName ldc2.zip + 7z x ldc2.zip > $null + ren "ldc2-$ldcVersion-win64-msvc" ldc2-host } Else { - $ldcVersion = '1.3.0' - If ($Env:APPVEYOR_JOB_ARCH -eq 'x64') { - appveyor DownloadFile "http://github.com/ldc-developers/ldc/releases/download/v$ldcVersion/ldc2-$ldcVersion-win64-msvc.zip" -FileName ldc2.zip - 7z x ldc2.zip > $null - Set-Item -path env:DMD -value c:\projects\ldc2-$ldcVersion-win64-msvc\bin\ldmd2.exe - } Else { - appveyor DownloadFile "http://github.com/ldc-developers/ldc/releases/download/v$ldcVersion/ldc2-$ldcVersion-win32-msvc.zip" -FileName ldc2.zip - 7z x ldc2.zip > $null - Set-Item -path env:DMD -value c:\projects\ldc2-$ldcVersion-win32-msvc\bin\ldmd2.exe - } + appveyor DownloadFile "http://github.com/ldc-developers/ldc/releases/download/v$ldcVersion/ldc2-$ldcVersion-win32-msvc.zip" -FileName ldc2.zip + 7z x ldc2.zip > $null + ren "ldc2-$ldcVersion-win32-msvc" ldc2-host } - & $Env:DMD --version # Download & extract GNU make + utils (for dmd-testsuite) - bash --version - appveyor DownloadFile "https://dl.dropboxusercontent.com/s/4y36f5ydgrk4p5g/make-4.2.1.7z?dl=0" -FileName make.7z @@ -85,8 +80,14 @@ install: - 7z x ..\make.7z > nul - make --version - cd .. - # Download & extract a pre-built LLVM (CMAKE_BUILD_TYPE=Release, LLVM_ENABLE_ASSERTIONS=ON) - - appveyor DownloadFile "https://github.com/ldc-developers/llvm/releases/download/ldc-v5.0.0-2/appveyor-llvm-5.0.0-2-%APPVEYOR_JOB_ARCH%.7z" -FileName llvm.7z + # Download & extract LDC-flavoured LLVM + - ps: | + $assertsSuffix = '' + If (!(Test-Path Env:APPVEYOR_REPO_TAG_NAME)) { + echo 'Using LLVM with enabled assertions' + $assertsSuffix = '-withAsserts' + } + appveyor DownloadFile "https://github.com/ldc-developers/llvm/releases/download/ldc-v$Env:LLVM_VERSION/llvm-$Env:LLVM_VERSION-windows-$Env:APPVEYOR_JOB_ARCH$assertsSuffix.7z" -FileName llvm.7z - md llvm - cd llvm - 7z x ..\llvm.7z > nul @@ -105,66 +106,15 @@ install: # build configuration # #---------------------------------# -before_build: - build_script: - cd c:\projects # Generate build files for LDC - md ninja-ldc - cd ninja-ldc - - cmake -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=c:\projects\ldc-%APPVEYOR_JOB_ARCH% -DLLVM_ROOT_DIR=c:/projects/llvm ..\ldc + - cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=c:\projects\ldc2-%APPVEYOR_JOB_ARCH% -DINCLUDE_INSTALL_DIR=c:/projects/ldc2-%APPVEYOR_JOB_ARCH%/import -DLLVM_ROOT_DIR=c:/projects/llvm -DD_COMPILER=c:\projects\ldc2-host\bin\ldmd2.exe ..\ldc # Build LDC and stdlib unittest runners - ninja -j2 all all-test-runners -after_build: - # install LDC, compress & publish as artifact - - ps: | - echo 'Preparing artifact...' - cd c:\projects\ninja-ldc - ninja install > $null - copy bin\ldc2.pdb "..\ldc-$Env:APPVEYOR_JOB_ARCH\bin" - cd "..\ldc-$Env:APPVEYOR_JOB_ARCH" - (gc etc\ldc2.conf).replace("C:/projects/ldc-$Env:APPVEYOR_JOB_ARCH/", '%%ldcbinarypath%%/../') | sc etc\ldc2.conf - $artifactFilename = "LDC-master-$Env:APPVEYOR_BUILD_NUMBER-$Env:APPVEYOR_JOB_ARCH.7z" - 7z a "..\$artifactFilename" * > $null - cd .. - Push-AppveyorArtifact $artifactFilename - # x86 job: Create a 32/64-bit multilib artifact if the commit is on the master branch. - # It consists of the x64 artifact (published by a successful x64 job) downloaded from - # GitHub, augmented by the 32-bit libs and an extra section in the ldc2.conf file for `-m32` - # (using the lib32 directory). - - ps: | - If (($Env:APPVEYOR_REPO_BRANCH -eq 'master') -And !(Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER) -And ($Env:APPVEYOR_JOB_ARCH -eq 'x86')) { - echo 'Preparing 32/64-bit multilib artifact...' - cd c:\projects - $artifact64Downloaded = $True - Try { - (New-Object Net.WebClient).DownloadFile("https://github.com/ldc-developers/ldc/releases/download/LDC-Win64-master/LDC-master-$Env:APPVEYOR_BUILD_NUMBER-x64.7z", 'c:\projects\LDC-master-x64.7z') - } - Catch { - echo 'Failed to download the 64-bit artifact from GitHub (the x64 job probably failed).' - echo 'Skipping the 32/64-bit multilib artifact.' - $artifact64Downloaded = $False - } - If ($artifact64Downloaded) { - md ldc-multilib > $null - cd ldc-multilib - 7z x ..\LDC-master-x64.7z > $null - ren lib lib64 - copy ..\ldc-x86\lib -Recurse - ren lib lib32 - (gc etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | sc etc\ldc2.conf - $conf32 = gc ..\ldc-x86\etc\ldc2.conf -Raw - $conf32 = "`r`ni686-pc-windows-msvc:" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10) - $conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32') - ac etc\ldc2.conf $conf32 - $artifactFilename = "LDC-master-$Env:APPVEYOR_BUILD_NUMBER-multilib.7z" - 7z a "..\$artifactFilename" * > $null - cd .. - Push-AppveyorArtifact $artifactFilename - } - } - #---------------------------------# # test configuration # #---------------------------------# @@ -187,25 +137,112 @@ test_script: # deployment configuration # #---------------------------------# +after_test: + # Install LDC + - ps: | + cd c:\projects\ninja-ldc + $ldcInstallDir = "c:\projects\ldc2-$Env:APPVEYOR_JOB_ARCH" + ninja install > $null + cd "$ldcInstallDir" + (cat etc\ldc2.conf).replace("C:/projects/ldc2-$Env:APPVEYOR_JOB_ARCH/", '%%ldcbinarypath%%/../') | Set-Content etc\ldc2.conf + cd .. + cp ldc/LICENSE "$ldcInstallDir" + git clone https://github.com/ldc-developers/ldc-scripts.git + cp ldc-scripts\ldc2-packaging\pkgfiles\README.txt "$ldcInstallDir" + # Build dub + - ps: | + cd c:\projects + $ldcInstallDir = "c:\projects\ldc2-$Env:APPVEYOR_JOB_ARCH" + Set-Item -path env:DC -value "$ldcInstallDir\bin\ldmd2" + git clone --recursive https://github.com/dlang/dub.git + cd dub + git checkout $Env:DUB_VERSION + (cat build.cmd).replace('curl.lib', "$ldcInstallDir\lib\curl.lib") | Set-Content build.cmd + .\build.cmd + cp bin\dub.exe "$ldcInstallDir\bin" + # Build dlang tools + - ps: | + cd c:\projects + $ldcInstallDir = "c:\projects\ldc2-$Env:APPVEYOR_JOB_ARCH" + git clone --recursive https://github.com/dlang/tools.git + cd tools + & "$ldcInstallDir\bin\ldmd2" -w rdmd.d + & "$ldcInstallDir\bin\ldmd2" -w ddemangle.d + & "$ldcInstallDir\bin\ldmd2" -w DustMite\dustmite.d DustMite\splitter.d + cp *.exe "$ldcInstallDir\bin" + # Pack installation dir & publish as artifact + - ps: | + cd c:\projects + If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) { + $artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows-$Env:APPVEYOR_JOB_ARCH" + } Else { + $artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows-$Env:APPVEYOR_JOB_ARCH" + } + ren "ldc2-$Env:APPVEYOR_JOB_ARCH" $artifactBasename + 7z a -mx=9 "$artifactBasename.7z" $artifactBasename > $null + ren $artifactBasename "ldc2-$Env:APPVEYOR_JOB_ARCH" + Push-AppveyorArtifact "$artifactBasename.7z" + # x86 job: Create a 32/64-bit multilib artifact if the commit is on the master branch + # (or a tag). It consists of the x64 artifact (published by a successful x64 job) + # downloaded from GitHub, augmented by the 32-bit libs and an extra section in the + # ldc2.conf file for `-m32` (using the lib32 directory). + - ps: | + If (($Env:APPVEYOR_JOB_ARCH -eq 'x86') -And + ( (Test-Path Env:APPVEYOR_REPO_TAG_NAME) -Or + ( ($Env:APPVEYOR_REPO_BRANCH -eq 'master') -And !(Test-Path Env:APPVEYOR_PULL_REQUEST_NUMBER) ) ) ) { + echo 'Preparing 32/64-bit multilib artifact...' + cd c:\projects + If (Test-Path Env:APPVEYOR_REPO_TAG_NAME) { + $artifact64 = "https://github.com/ldc-developers/ldc/releases/download/$Env:APPVEYOR_REPO_TAG_NAME/ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows-x64.7z" + $artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_TAG_NAME.Substring(1))-windows" + } Else { + $artifact64 = "https://github.com/ldc-developers/ldc/releases/download/CI/ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows-x64.7z" + $artifactBasename = "ldc2-$($Env:APPVEYOR_REPO_COMMIT.Substring(0, 8))-windows" + } + $artifact64Downloaded = $True + Try { + (New-Object Net.WebClient).DownloadFile("$artifact64", 'c:\projects\ldc2-x64.7z') + } Catch { + echo 'Failed to download the 64-bit artifact from GitHub (the x64 job probably failed).' + echo 'Skipping the 32/64-bit multilib artifact.' + $artifact64Downloaded = $False + } + If ($artifact64Downloaded) { + 7z x ldc2-x64.7z > $null + del ldc2-x64.7z + ren "$artifactBasename-x64" "$artifactBasename-multilib" + cd "$artifactBasename-multilib" + ren lib lib64 + copy ..\ldc2-x86\lib -Recurse + ren lib lib32 + (cat etc\ldc2.conf).replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib64') | Set-Content etc\ldc2.conf + $conf32 = cat ..\ldc2-x86\etc\ldc2.conf -Raw + $conf32 = "`r`ni686-pc-windows-msvc:" + $conf32.Substring($conf32.IndexOf("`r`ndefault:") + 10) + $conf32 = $conf32.Replace('%%ldcbinarypath%%/../lib', '%%ldcbinarypath%%/../lib32') + Add-Content etc\ldc2.conf $conf32 + cd .. + 7z a -mx=9 "$artifactBasename-multilib.7z" "$artifactBasename-multilib" > $null + Push-AppveyorArtifact "$artifactBasename-multilib.7z" + } + } + deploy: - - provider: GitHub - release: 'LDC Win64 master' - description: "Latest successful Windows CI builds of branch 'master'" - draft: true + - release: CI prerelease: true + provider: GitHub auth_token: secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy - artifact: LDC-master-$(APPVEYOR_BUILD_NUMBER)-$(APPVEYOR_JOB_ARCH).7z + artifact: /ldc2-.*\.7z/ on: branch: master - - provider: GitHub - release: 'LDC Win64 master' - description: "Latest successful Windows CI builds of branch 'master'" - draft: true + appveyor_repo_tag: false + - release: $(APPVEYOR_REPO_TAG_NAME) + description: $(APPVEYOR_REPO_TAG_NAME) prerelease: true + draft: true + provider: GitHub auth_token: secure: qnbD8agL9mr0SFvy/sMkR2E29oQQ427T5zYwVVZkjRS3IZ361tG+9jlSiyEkyULy - artifact: LDC-master-$(APPVEYOR_BUILD_NUMBER)-multilib.7z + artifact: /ldc2-.*\.7z/ on: - branch: master - APPVEYOR_JOB_ARCH: x86 + appveyor_repo_tag: true diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt index e3bd3798773..b1f291c6893 100644 --- a/runtime/CMakeLists.txt +++ b/runtime/CMakeLists.txt @@ -659,8 +659,13 @@ if(MULTILIB AND "${TARGET_SYSTEM}" MATCHES "APPLE") build_all_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${hostsuffix}" libtargets) build_all_runtime_variants("-m${MULTILIB_SUFFIX}" "-m${MULTILIB_SUFFIX} ${RT_CFLAGS}" "-m${MULTILIB_SUFFIX} ${LD_FLAGS}" "${MULTILIB_SUFFIX}" libtargets) - # Do not build multilib version of jit runtime - build_jit_runtime ("${D_FLAGS};${D_FLAGS_RELEASE}" "${RT_CFLAGS}" "${LD_FLAGS}" "${hostsuffix}" libtargets) + # Only build the host version of the jit runtime due to LLVM dependency. + set(libtargets_jit) + build_jit_runtime("${D_FLAGS};${D_FLAGS_RELEASE}" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libtargets_jit) + list(APPEND libtargets ${libtargets_jit}) + # Install separately. + install(TARGETS ${libtargets_jit} + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) # KLUDGE: Cannot use `$` in custom command. # Set up the list of generated libs (without 'lib' prefix) to be merged manually. @@ -701,9 +706,11 @@ else() set(libs_to_install) build_all_runtime_variants("" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libs_to_install) - set(libs_to_install_no_multilib) - # Do not build multilib version of jit runtime - build_jit_runtime ("${D_FLAGS};${D_FLAGS_RELEASE}" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libs_to_install_no_multilib) + # Only build the host version of the jit runtime due to LLVM dependency. + set(libtargets_jit) + build_jit_runtime("${D_FLAGS};${D_FLAGS_RELEASE}" "${RT_CFLAGS}" "${LD_FLAGS}" "${LIB_SUFFIX}" libtargets_jit) + install(TARGETS ${libtargets_jit} + DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) # don't add multilib targets to libs_to_install if(MULTILIB) @@ -718,11 +725,6 @@ else() DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${MULTILIB_SUFFIX}) endif() endforeach() - - foreach(libname ${libs_to_install_no_multilib}) - install(TARGETS ${libname} - DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}) - endforeach() endif() set(DRUNTIME_PACKAGES core etc ldc) diff --git a/runtime/jit-rt/DefineBuildJitRT.cmake b/runtime/jit-rt/DefineBuildJitRT.cmake index 3c0e031bd21..9a30ff3be19 100644 --- a/runtime/jit-rt/DefineBuildJitRT.cmake +++ b/runtime/jit-rt/DefineBuildJitRT.cmake @@ -33,7 +33,7 @@ if(LDC_DYNAMIC_COMPILE) endmacro() function(build_jit_runtime d_flags c_flags ld_flags path_suffix outlist_targets) - # Jit runtime need a differens set of libraries from compiler and we + # Jit runtime needs a different set of libraries from compiler and we # can't do find_package(LLVM) because we already have one in top-level cmake # Also we don't have access to llvm_map_components_to_libnames because we need # to do find_package(LLVM CONFIG) for it so here is a hackish way to get it @@ -59,14 +59,13 @@ if(LDC_DYNAMIC_COMPILE) set_target_properties( ldc-jit-rt-so${target_suffix} PROPERTIES OUTPUT_NAME ldc-jit - VERSION ${LDC_VERSION} - LINKER_LANGUAGE C ARCHIVE_OUTPUT_DIRECTORY ${output_path} LIBRARY_OUTPUT_DIRECTORY ${output_path} RUNTIME_OUTPUT_DIRECTORY ${output_path} COMPILE_FLAGS "${c_flags} ${LDC_CXXFLAGS} ${LLVM_CXXFLAGS} ${JITRT_EXTRA_FLAGS}" LINK_FLAGS "${ld_flags} ${JITRT_EXTRA_LDFLAGS}" - ) + ) + set_common_library_properties(ldc-jit-rt-so${target_suffix} ON) target_link_libraries(ldc-jit-rt-so${target_suffix} ${JITRT_LLVM_LIBS}) @@ -78,14 +77,13 @@ if(LDC_DYNAMIC_COMPILE) set_target_properties( ldc-jit-rt${target_suffix} PROPERTIES OUTPUT_NAME ldc-jit-rt - VERSION ${LDC_VERSION} - LINKER_LANGUAGE C ARCHIVE_OUTPUT_DIRECTORY ${output_path} LIBRARY_OUTPUT_DIRECTORY ${output_path} RUNTIME_OUTPUT_DIRECTORY ${output_path} COMPILE_FLAGS "${c_flags} ${JITRT_EXTRA_FLAGS}" LINK_FLAGS "${ld_flags} ${JITRT_EXTRA_LDFLAGS}" - ) + ) + set_common_library_properties(ldc-jit-rt${target_suffix} OFF) target_link_libraries(ldc-jit-rt${target_suffix} ldc-jit-rt-so${target_suffix})