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
29
.travis.yml
29
.travis.yml
|
@ -13,7 +13,7 @@ os:
|
|||
env:
|
||||
- BUILD=
|
||||
- BUILD=dub
|
||||
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
@ -24,7 +24,7 @@ jobs:
|
|||
include:
|
||||
- stage: GitHub Release
|
||||
#if: tag IS present
|
||||
d: ldc-1.8.0
|
||||
d: ldc-1.13.0
|
||||
os: linux
|
||||
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
||||
deploy:
|
||||
|
@ -38,7 +38,7 @@ jobs:
|
|||
tags: true
|
||||
- stage: GitHub Release
|
||||
#if: tag IS present
|
||||
d: ldc-1.8.0
|
||||
d: ldc-1.13.0
|
||||
os: osx
|
||||
script: echo "Deploying to GitHub releases ..." && ./release.sh
|
||||
deploy:
|
||||
|
@ -56,12 +56,31 @@ jobs:
|
|||
os: linux
|
||||
language: generic
|
||||
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:
|
||||
apt:
|
||||
packages:
|
||||
- p7zip-full
|
||||
- wine
|
||||
deploy:
|
||||
provider: releases
|
||||
api_key: $GH_REPO_TOKEN
|
||||
|
|
10
makefile
10
makefile
|
@ -57,6 +57,10 @@ LDC_CLIENT_FLAGS := -Imsgpack-d/src\
|
|||
-oq\
|
||||
-of=bin/dcd-client
|
||||
|
||||
override DMD_CLIENT_FLAGS += $(DFLAGS)
|
||||
override LDC_CLIENT_FLAGS += $(DFLAGS)
|
||||
override GDC_CLIENT_FLAGS += $(DFLAGS)
|
||||
|
||||
SERVER_SRC := \
|
||||
$(shell find src/dcd/common -name "*.d")\
|
||||
$(shell find src/dcd/server -name "*.d")\
|
||||
|
@ -122,6 +126,10 @@ LDC_SERVER_FLAGS := -Icontainers/src\
|
|||
-O5\
|
||||
-release
|
||||
|
||||
override DMD_SERVER_FLAGS += $(DFLAGS)
|
||||
override LDC_SERVER_FLAGS += $(DFLAGS)
|
||||
override GDC_SERVER_FLAGS += $(DFLAGS)
|
||||
|
||||
dmdclient: githash
|
||||
mkdir -p bin
|
||||
${DMD} ${CLIENT_SRC} ${DMD_CLIENT_FLAGS}
|
||||
|
@ -143,7 +151,7 @@ gdcserver: githash
|
|||
${GDC} ${SERVER_SRC} ${GDC_SERVER_FLAGS}
|
||||
|
||||
ldcclient: githash
|
||||
${LDC} ${CLIENT_SRC} ${LDC_CLIENT_FLAGS}
|
||||
${LDC} ${CLIENT_SRC} ${LDC_CLIENT_FLAGS} -oq -of=bin/dcd-client
|
||||
|
||||
ldcserver: githash
|
||||
${LDC} $(LDC_SERVER_FLAGS) ${SERVER_SRC} -oq -of=bin/dcd-server
|
||||
|
|
|
@ -1,33 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
# Build the Windows binaries under Linux (requires wine)
|
||||
# Build the Windows binaries under Linux
|
||||
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
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR
|
||||
|
||||
# Step 1: download the DMD binaries
|
||||
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
|
||||
source setup-ldc-windows.sh
|
||||
|
||||
# Step 2: Run DMD via wineconsole
|
||||
archiveName="dcd-$VERSION-$OS-$ARCH_SUFFIX.zip"
|
||||
# Run LDC with cross-compilation
|
||||
archiveName="$BIN_NAME-$VERSION-$OS-$ARCH_SUFFIX.zip"
|
||||
echo "Building $archiveName"
|
||||
mkdir -p bin
|
||||
git describe --tags > bin/githash.txt # no git installed under Wine
|
||||
DC="$DIR/dmd2/windows/bin/dmd.exe" wine cmd /C build.bat
|
||||
DC=ldmd2 make ldcclient ldcserver
|
||||
|
||||
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