Build win{32,64} binaries with LDC (#568)
Build win{32,64} binaries with LDC merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
parent
1252484660
commit
06e0dd51c4
27
.travis.yml
27
.travis.yml
|
@ -24,7 +24,7 @@ jobs:
|
||||||
include:
|
include:
|
||||||
- stage: GitHub Release
|
- stage: GitHub Release
|
||||||
#if: tag IS present
|
#if: tag IS present
|
||||||
d: ldc-1.8.0
|
d: ldc-1.13.0
|
||||||
os: linux
|
os: linux
|
||||||
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
||||||
deploy:
|
deploy:
|
||||||
|
@ -38,7 +38,7 @@ jobs:
|
||||||
tags: true
|
tags: true
|
||||||
- stage: GitHub Release
|
- stage: GitHub Release
|
||||||
#if: tag IS present
|
#if: tag IS present
|
||||||
d: ldc-1.8.0
|
d: ldc-1.13.0
|
||||||
os: osx
|
os: osx
|
||||||
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
||||||
deploy:
|
deploy:
|
||||||
|
@ -56,12 +56,31 @@ jobs:
|
||||||
os: linux
|
os: linux
|
||||||
language: generic
|
language: generic
|
||||||
sudo: yes
|
sudo: yes
|
||||||
script: echo "Deploying to GitHub releases ..." && ./release-windows.sh && ARCH=64 ./release-windows.sh
|
script: echo "Deploying to GitHub releases ..." && ./release-windows.sh
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- p7zip-full
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key: $GH_REPO_TOKEN
|
||||||
|
file_glob: true
|
||||||
|
file: bin/dcd-*.zip
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
repo: dlang-community/DCD
|
||||||
|
tags: true
|
||||||
|
- stage: GitHub Release
|
||||||
|
#if: tag IS present
|
||||||
|
d: dmd
|
||||||
|
os: linux
|
||||||
|
language: generic
|
||||||
|
sudo: yes
|
||||||
|
script: echo "Deploying to GitHub releases ..." && ARCH=64 ./release-windows.sh
|
||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
packages:
|
packages:
|
||||||
- p7zip-full
|
- p7zip-full
|
||||||
- wine
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key: $GH_REPO_TOKEN
|
api_key: $GH_REPO_TOKEN
|
||||||
|
|
10
makefile
10
makefile
|
@ -57,6 +57,10 @@ LDC_CLIENT_FLAGS := -Imsgpack-d/src\
|
||||||
-oq\
|
-oq\
|
||||||
-of=bin/dcd-client
|
-of=bin/dcd-client
|
||||||
|
|
||||||
|
override DMD_CLIENT_FLAGS += $(DFLAGS)
|
||||||
|
override LDC_CLIENT_FLAGS += $(DFLAGS)
|
||||||
|
override GDC_CLIENT_FLAGS += $(DFLAGS)
|
||||||
|
|
||||||
SERVER_SRC := \
|
SERVER_SRC := \
|
||||||
$(shell find src/dcd/common -name "*.d")\
|
$(shell find src/dcd/common -name "*.d")\
|
||||||
$(shell find src/dcd/server -name "*.d")\
|
$(shell find src/dcd/server -name "*.d")\
|
||||||
|
@ -122,6 +126,10 @@ LDC_SERVER_FLAGS := -Icontainers/src\
|
||||||
-O5\
|
-O5\
|
||||||
-release
|
-release
|
||||||
|
|
||||||
|
override DMD_SERVER_FLAGS += $(DFLAGS)
|
||||||
|
override LDC_SERVER_FLAGS += $(DFLAGS)
|
||||||
|
override GDC_SERVER_FLAGS += $(DFLAGS)
|
||||||
|
|
||||||
dmdclient: githash
|
dmdclient: githash
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
${DMD} ${CLIENT_SRC} ${DMD_CLIENT_FLAGS}
|
${DMD} ${CLIENT_SRC} ${DMD_CLIENT_FLAGS}
|
||||||
|
@ -143,7 +151,7 @@ gdcserver: githash
|
||||||
${GDC} ${SERVER_SRC} ${GDC_SERVER_FLAGS}
|
${GDC} ${SERVER_SRC} ${GDC_SERVER_FLAGS}
|
||||||
|
|
||||||
ldcclient: githash
|
ldcclient: githash
|
||||||
${LDC} ${CLIENT_SRC} ${LDC_CLIENT_FLAGS}
|
${LDC} ${CLIENT_SRC} ${LDC_CLIENT_FLAGS} -oq -of=bin/dcd-client
|
||||||
|
|
||||||
ldcserver: githash
|
ldcserver: githash
|
||||||
${LDC} $(LDC_SERVER_FLAGS) ${SERVER_SRC} -oq -of=bin/dcd-server
|
${LDC} $(LDC_SERVER_FLAGS) ${SERVER_SRC} -oq -of=bin/dcd-server
|
||||||
|
|
|
@ -1,33 +1,22 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build the Windows binaries under Linux (requires wine)
|
# Build the Windows binaries under Linux
|
||||||
set -eux -o pipefail
|
set -eux -o pipefail
|
||||||
VERSION=$(git describe --abbrev=0 --tags)
|
|
||||||
OS=windows
|
|
||||||
if [ "${ARCH:-32}" == "64" ] ; then
|
|
||||||
ARCH_SUFFIX="x86_64"
|
|
||||||
export MFLAGS="-m64"
|
|
||||||
else
|
|
||||||
ARCH_SUFFIX="x86"
|
|
||||||
export MFLAGS="-m32"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
BIN_NAME=dcd
|
||||||
|
|
||||||
# Allow the script to be run from anywhere
|
# Allow the script to be run from anywhere
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
cd $DIR
|
cd $DIR
|
||||||
|
|
||||||
# Step 1: download the DMD binaries
|
source setup-ldc-windows.sh
|
||||||
if [ ! -d dmd2 ] ; then
|
|
||||||
wget http://downloads.dlang.org/releases/2.x/2.080.0/dmd.2.080.0.windows.7z
|
|
||||||
7z x dmd.2.080.0.windows.7z > /dev/null
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2: Run DMD via wineconsole
|
# Run LDC with cross-compilation
|
||||||
archiveName="dcd-$VERSION-$OS-$ARCH_SUFFIX.zip"
|
archiveName="$BIN_NAME-$VERSION-$OS-$ARCH_SUFFIX.zip"
|
||||||
echo "Building $archiveName"
|
echo "Building $archiveName"
|
||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
git describe --tags > bin/githash.txt # no git installed under Wine
|
DC=ldmd2 make ldcclient ldcserver
|
||||||
DC="$DIR/dmd2/windows/bin/dmd.exe" wine cmd /C build.bat
|
|
||||||
|
|
||||||
cd bin
|
cd bin
|
||||||
zip "$archiveName" dcd-server.exe dcd-client.exe
|
mv dcd-client dcd-client.exe
|
||||||
|
mv dcd-server dcd-server.exe
|
||||||
|
zip "$archiveName" "dcd-client.exe" "dcd-server.exe"
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# sets up LDC for cross-compilation. Source this script, s.t. the new LDC is in PATH
|
||||||
|
|
||||||
|
LDC_VERSION="1.13.0"
|
||||||
|
ARCH=${ARCH:-32}
|
||||||
|
VERSION=$(git describe --abbrev=0 --tags)
|
||||||
|
OS=windows
|
||||||
|
|
||||||
|
# Step 0: install ldc
|
||||||
|
if [ ! -f install.sh ] ; then
|
||||||
|
wget https://dlang.org/install.sh
|
||||||
|
fi
|
||||||
|
. $(bash ./install.sh -a "ldc-${LDC_VERSION}")
|
||||||
|
|
||||||
|
# for the install.sh script only
|
||||||
|
LDC_PATH="$(dirname $(dirname $(which ldc2)))"
|
||||||
|
|
||||||
|
# Step 1a: download the LDC x64 windows binaries
|
||||||
|
if [ "${ARCH}" == 64 ] && [ ! -d "ldc2-${LDC_VERSION}-windows-x64" ] ; then
|
||||||
|
wget "https://github.com/ldc-developers/ldc/releases/download/v1.13.0/ldc2-${LDC_VERSION}-windows-x64.7z"
|
||||||
|
7z x "ldc2-${LDC_VERSION}-windows-x64.7z" > /dev/null
|
||||||
|
# Step 2a: Add LDC windows binaries to LDC Linux
|
||||||
|
if [ ! -d "${LDC_PATH}/lib-win64" ] ; then
|
||||||
|
cp -r ldc2-1.13.0-windows-x64/lib "${LDC_PATH}/lib-win64"
|
||||||
|
cat >> "$LDC_PATH"/etc/ldc2.conf <<EOF
|
||||||
|
"x86_64-.*-windows-msvc":
|
||||||
|
{
|
||||||
|
switches = [
|
||||||
|
"-defaultlib=phobos2-ldc,druntime-ldc",
|
||||||
|
"-link-defaultlib-shared=false",
|
||||||
|
];
|
||||||
|
lib-dirs = [
|
||||||
|
"%%ldcbinarypath%%/../lib-win64",
|
||||||
|
];
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
# Step 1b: download the LDC x86 windows binaries
|
||||||
|
if [ "${ARCH}" == 32 ] && [ ! -d "ldc2-${LDC_VERSION}-windows-x86" ] ; then
|
||||||
|
wget "https://github.com/ldc-developers/ldc/releases/download/v1.13.0/ldc2-${LDC_VERSION}-windows-x86.7z"
|
||||||
|
7z x "ldc2-${LDC_VERSION}-windows-x86.7z" > /dev/null
|
||||||
|
# Step 2b: Add LDC windows binaries to LDC Linux
|
||||||
|
if [ ! -d "${LDC_PATH}/lib-win32" ] ; then
|
||||||
|
cp -r ldc2-1.13.0-windows-x86/lib "${LDC_PATH}/lib-win32"
|
||||||
|
cat >> "$LDC_PATH"/etc/ldc2.conf <<EOF
|
||||||
|
"i686-.*-windows-msvc":
|
||||||
|
{
|
||||||
|
switches = [
|
||||||
|
"-defaultlib=phobos2-ldc,druntime-ldc",
|
||||||
|
"-link-defaultlib-shared=false",
|
||||||
|
];
|
||||||
|
lib-dirs = [
|
||||||
|
"%%ldcbinarypath%%/../lib-win32",
|
||||||
|
];
|
||||||
|
};
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set suffices and compilation flags
|
||||||
|
if [ "$ARCH" == "64" ] ; then
|
||||||
|
ARCH_SUFFIX="x86_64"
|
||||||
|
export DFLAGS="-mtriple=x86_64-windows-msvc"
|
||||||
|
else
|
||||||
|
ARCH_SUFFIX="x86"
|
||||||
|
export DFLAGS="-mtriple=i686-windows-msvc"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue