Skip to content

Commit a7bf5b3

Browse files
Geod24dlang-bot
authored andcommitted
Update release LDC to v1.23.0
The LDC used for release hasn't been updated in years, and was severely lacking behind. The script used is very clearly a copy of the one in DUB, which has been overhauled in dlang/dub#1849, so copying those improvements over.
1 parent 92db048 commit a7bf5b3

File tree

2 files changed

+37
-59
lines changed

2 files changed

+37
-59
lines changed

.travis.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
dist: xenial
2-
sudo: false
32
language: d
3+
44
d:
55
- dmd
66
- ldc-beta
@@ -28,7 +28,7 @@ jobs:
2828
include:
2929
- stage: GitHub Release
3030
#if: tag IS present
31-
d: ldc-1.13.0
31+
d: ldc-1.23.0
3232
os: linux
3333
script: echo "Deploying to GitHub releases ..." && ./release.sh
3434
deploy:
@@ -42,7 +42,7 @@ jobs:
4242
tags: true
4343
- stage: GitHub Release
4444
#if: tag IS present
45-
d: ldc-1.13.0
45+
d: ldc-1.23.0
4646
os: osx
4747
script: echo "Deploying to GitHub releases ..." && ./release.sh
4848
deploy:
@@ -56,10 +56,8 @@ jobs:
5656
tags: true
5757
- stage: GitHub Release
5858
#if: tag IS present
59-
d: dmd
59+
d: ldc-1.23.0
6060
os: linux
61-
language: generic
62-
sudo: yes
6361
script: echo "Deploying to GitHub releases ..." && ./release-windows.sh
6462
addons:
6563
apt:
@@ -76,10 +74,8 @@ jobs:
7674
tags: true
7775
- stage: GitHub Release
7876
#if: tag IS present
79-
d: dmd
77+
d: ldc-1.23.0
8078
os: linux
81-
language: generic
82-
sudo: yes
8379
script: echo "Deploying to GitHub releases ..." && ARCH=64 ./release-windows.sh
8480
addons:
8581
apt:

setup-ldc-windows.sh

Lines changed: 32 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,52 @@
11
#!/usr/bin/env bash
22

3-
# sets up LDC for cross-compilation. Source this script, s.t. the new LDC is in PATH
3+
# Sets up LDC for cross-compilation. Source this script, s.t. the new LDC is in PATH
44

5-
LDC_VERSION="1.13.0"
5+
# Make sure this version matches the version of LDC2 used in .travis.yml,
6+
# otherwise the compiler and the lib used might mismatch.
7+
LDC_VERSION="1.23.0"
68
ARCH=${ARCH:-32}
79
VERSION=$(git describe --abbrev=0 --tags)
810
OS=windows
911

10-
# Step 0: install ldc
11-
if [ ! -f install.sh ] ; then
12-
wget https://dlang.org/install.sh
12+
# LDC should already be installed (see .travis.yml)
13+
# However, we need the libraries, so download them
14+
# We can't use the downloaded ldc2 itself, because obviously it's for Windows
15+
16+
if [ "${ARCH}" == 64 ]; then
17+
ARCH_SUFFIX='x86_64'
18+
ZIP_ARCH_SUFFIX='x64'
19+
else
20+
ARCH_SUFFIX='i686'
21+
ZIP_ARCH_SUFFIX='x86'
1322
fi
14-
. $(bash ./install.sh -a "ldc-${LDC_VERSION}")
1523

16-
# for the install.sh script only
17-
LDC_PATH="$(dirname $(dirname $(which ldc2)))"
24+
LDC_DIR_PATH="$(pwd)/ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}"
25+
LDC_XDFLAGS="-conf=${LDC_DIR_PATH}/etc/ldc2.conf -mtriple=${ARCH_SUFFIX}-pc-windows-msvc"
1826

19-
# Step 1a: download the LDC x64 windows binaries
20-
if [ "${ARCH}" == 64 ] && [ ! -d "ldc2-${LDC_VERSION}-windows-x64" ] ; then
21-
wget "https://github.com/ldc-developers/ldc/releases/download/v1.13.0/ldc2-${LDC_VERSION}-windows-x64.7z"
22-
7z x "ldc2-${LDC_VERSION}-windows-x64.7z" > /dev/null
23-
# Step 2a: Add LDC windows binaries to LDC Linux
24-
if [ ! -d "${LDC_PATH}/lib-win64" ] ; then
25-
cp -r ldc2-1.13.0-windows-x64/lib "${LDC_PATH}/lib-win64"
26-
cat >> "$LDC_PATH"/etc/ldc2.conf <<EOF
27-
"x86_64-.*-windows-msvc":
28-
{
29-
switches = [
30-
"-defaultlib=phobos2-ldc,druntime-ldc",
31-
"-link-defaultlib-shared=false",
32-
];
33-
lib-dirs = [
34-
"%%ldcbinarypath%%/../lib-win64",
35-
];
36-
};
37-
EOF
38-
fi
27+
# Step 1: download the LDC Windows release
28+
# Check if the user already have it (e.g. building locally)
29+
if [ ! -d ${LDC_DIR_PATH} ]; then
30+
if [ ! -d "ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z" ]; then
31+
wget "https://github.com/ldc-developers/ldc/releases/download/v${LDC_VERSION}/ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z"
32+
fi
33+
7z x "ldc2-${LDC_VERSION}-windows-${ZIP_ARCH_SUFFIX}.7z" > /dev/null
3934
fi
40-
# Step 1b: download the LDC x86 windows binaries
41-
if [ "${ARCH}" == 32 ] && [ ! -d "ldc2-${LDC_VERSION}-windows-x86" ] ; then
42-
wget "https://github.com/ldc-developers/ldc/releases/download/v1.13.0/ldc2-${LDC_VERSION}-windows-x86.7z"
43-
7z x "ldc2-${LDC_VERSION}-windows-x86.7z" > /dev/null
44-
# Step 2b: Add LDC windows binaries to LDC Linux
45-
if [ ! -d "${LDC_PATH}/lib-win32" ] ; then
46-
cp -r ldc2-1.13.0-windows-x86/lib "${LDC_PATH}/lib-win32"
47-
cat >> "$LDC_PATH"/etc/ldc2.conf <<EOF
48-
"i686-.*-windows-msvc":
35+
36+
# Step 2: Generate a config file with the proper path
37+
cat > ${LDC_DIR_PATH}/etc/ldc2.conf <<EOF
38+
default:
4939
{
5040
switches = [
5141
"-defaultlib=phobos2-ldc,druntime-ldc",
5242
"-link-defaultlib-shared=false",
5343
];
44+
post-switches = [
45+
"-I${LDC_DIR_PATH}/import",
46+
];
5447
lib-dirs = [
55-
"%%ldcbinarypath%%/../lib-win32",
48+
"${LDC_DIR_PATH}/lib/",
49+
"${LDC_DIR_PATH}/lib/mingw/",
5650
];
5751
};
5852
EOF
59-
fi
60-
fi
61-
62-
# set suffices and compilation flags
63-
if [ "$ARCH" == "64" ] ; then
64-
ARCH_SUFFIX="x86_64"
65-
export DFLAGS="-mtriple=x86_64-windows-msvc"
66-
else
67-
ARCH_SUFFIX="x86"
68-
export DFLAGS="-mtriple=i686-windows-msvc"
69-
fi
70-

0 commit comments

Comments
 (0)