Skip to content

Commit 7d29d04

Browse files
committed
adds changes for OSX cross compile
1 parent a66d649 commit 7d29d04

File tree

4 files changed

+162
-1
lines changed

4 files changed

+162
-1
lines changed
+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
#!/bin/bash -l
2+
3+
function buildBinary(){
4+
mkdir $(pwd)/releases
5+
$DOCKERBIN run --rm -it --privileged -e MKPKG_VER=${VERSION} -v $(pwd)/repo:/root/repo -v $(pwd)/source:/opt/wine-electrum/drive_c/encompass/ mazaclub/encompass-winbuild /root/make_release $VERSION
6+
if [[ $? = 0 ]]; then
7+
echo "Build successful."
8+
else
9+
echo "Seems like the build failed. Exiting."
10+
exit
11+
fi
12+
cp $TARGETFOLDER/dist/encompass.exe $(pwd)/releases/Encompass-$VERSION.exe
13+
cp $(pwd)/source/encompass-setup.exe $(pwd)/releases/Encompass-$VERSION-setup.exe
14+
cp $(pwd)/repo/dist/* $(pwd)/releases/
15+
if [ "${TYPE}" = "SIGNED" ] ; then
16+
cd releases
17+
for release in *
18+
do
19+
sha1sum ${release} > ${release}.sha1
20+
md5sum ${release} > ${release}.md5
21+
gpg --sign --armor --detach ${release}
22+
gpg --sign --armor --detach ${release}.md5
23+
gpg --sign --armor --detach ${release}.sha1
24+
done
25+
fi
26+
echo "You can find your Encompass $VERSION binaries in the releases folder."
27+
28+
}
29+
30+
function buildImage(){
31+
echo "Building image"
32+
$DOCKERBIN build -t mazaclub/encompass-winbuild .
33+
}
34+
function buildLtcScrypt() {
35+
## this will be integrated into the main build in a later release
36+
wget https://pypi.python.org/packages/source/l/ltc_scrypt/ltc_scrypt-1.0.tar.gz
37+
tar -xpzvf ltc_scrypt-1.0.tar.gz
38+
docker run -t -i \
39+
-e WINEPREFIX="/wine/wine-py2.7.8-32" \
40+
-v $(pwd)/ltc_scrypt-1.0:/code \
41+
-v $(pwd)/helpers:/helpers \
42+
ogrisel/python-winbuilder wineconsole --backend=curses Z:\\helpers\\ltc_scrypt-build.bat
43+
cp ltc_scrypt-1.0/build/lib.win32-2.7/ltc_scrypt.pyd helpers/ltc_scrypt.pyd
44+
45+
echo "Building ltc_scrypt module for OSX"
46+
docker run -it --rm \
47+
-e LDFLAGS="-L/usr/x86_64-apple-darwin14/SDK/MacOSX10.10.sdk/usr/lib/ -L/usr/x86_64-apple-darwin14/lib -L/usr/x86_64-apple-darwin14/SDK/Mac
48+
OSX10.10.sdk/usr/libexec/" \
49+
-e PYTHONXCPREFIX="/usr/x86_64-apple-darwin14/" \
50+
-e MAC_SDK_VERSION="10.10" \
51+
-e LD_LIBRARY_PATH="/usr/lib/llvm-3.4/lib:/usr/x86_64-apple-darwin14/lib" \
52+
-e PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/x86_64-apple-darwin14/bin" \
53+
-e CROSS_TRIPLE="x86_64-apple-darwin14" \
54+
-e LDSHARED="x86_64-apple-darwin14-cc -shared" \
55+
-e CROSS_ROOT="/usr/x86_64-apple-darwin14" \
56+
-e CC="x86_64-apple-darwin14-cc" \
57+
-e CROSS_COMPILE="x86_64-apple-darwin14-" \
58+
-v $(pwd):/code \
59+
-v $(pwd)/helpers/build-darwin-ltc_scrypt.sh:/build-darwin-ltc_scrypt.sh \
60+
mazaclub/cross-compiler:darwin-x64 /build-darwin-ltc_scrypt.sh
61+
cp -v ltc_scrypt-1.0/build/lib.darwin-x64/ltc_scrypt.dylib helpers/ltc_scrypt.dylib
62+
63+
}
64+
function buildDarkcoinHash() {
65+
## this will be integrated into the main build in a later release
66+
wget https://github.com/guruvan/darkcoin_hash/archive/1.1.tar.gz
67+
tar -xpzvf 1.1.tar.gz
68+
docker run -t -i \
69+
-e WINEPREFIX="/wine/wine-py2.7.8-32" \
70+
-v $(pwd)/darkcoin_hash-1.1:/code \
71+
-v $(pwd)/helpers:/helpers \
72+
ogrisel/python-winbuilder wineconsole --backend=curses Z:\\helpers\\darkcoin_hash-build.bat
73+
cp darkcoin_hash-1.1/build/lib.win32-2.7/darkcoin_hash.pyd helpers/darkcoin_hash.pyd
74+
75+
echo "Building darkcoin_hash module for OSX"
76+
docker run -it --rm \
77+
-e LDFLAGS="-L/usr/x86_64-apple-darwin14/SDK/MacOSX10.10.sdk/usr/lib/ -L/usr/x86_64-apple-darwin14/lib -L/usr/x86_64-apple-darwin14/SDK/Mac
78+
OSX10.10.sdk/usr/libexec/" \
79+
-e PYTHONXCPREFIX="/usr/x86_64-apple-darwin14/" \
80+
-e MAC_SDK_VERSION="10.10" \
81+
-e LD_LIBRARY_PATH="/usr/lib/llvm-3.4/lib:/usr/x86_64-apple-darwin14/lib" \
82+
-e PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/x86_64-apple-darwin14/bin" \
83+
-e CROSS_TRIPLE="x86_64-apple-darwin14" \
84+
-e LDSHARED="x86_64-apple-darwin14-cc -shared" \
85+
-e CROSS_ROOT="/usr/x86_64-apple-darwin14" \
86+
-e CC="x86_64-apple-darwin14-cc" \
87+
-e CROSS_COMPILE="x86_64-apple-darwin14-" \
88+
-v $(pwd):/code \
89+
-v $(pwd)/helpers/build-darwin-darkcoin_hash.sh:/build-darwin-darkcoin_hash.sh \
90+
mazaclub/cross-compiler:darwin-x64 /build-darwin-darkcoin_hash.sh
91+
cp -v darkcoin_hash-1.1/build/lib.darwin-x64/darkcoin_hash.dylib helpers/darkcoin_hash.dylib
92+
93+
}
94+
95+
function prepareFile(){
96+
echo "Preparing file for Encompass version $VERSION"
97+
if [ -e "$TARGETPATH" ]; then
98+
echo "Version tar already downloaded."
99+
else
100+
wget https://github.com/mazaclub/encompass/archive/v${VERSION}.zip -O $TARGETPATH
101+
fi
102+
103+
if [ -d "$TARGETFOLDER" ]; then
104+
echo "Version is already extracted"
105+
else
106+
unzip -d $(pwd)/source ${TARGETPATH}
107+
# tar -xvf $TARGETPATH -C $(pwd)/source
108+
fi
109+
}
110+
111+
if [[ $# -gt 0 ]]; then
112+
VERSION=$1
113+
TYPE=$2
114+
FILENAME=Encompass-$VERSION.zip
115+
TARGETPATH=$(pwd)/source/$FILENAME
116+
TARGETFOLDER=$(pwd)/source/Encompass-$VERSION
117+
echo "Building Encompass $VERSION from $FILENAME"
118+
else
119+
echo "Usage: ./build <version>."
120+
echo "For example: ./build 1.9.8"
121+
exit
122+
fi
123+
124+
which docker
125+
if [[ $? = 0 ]]; then
126+
DOCKERBIN=$(which docker)
127+
fi
128+
129+
which docker.io
130+
if [[ $? = 0 ]]; then
131+
DOCKERBIN=$(which docker.io)
132+
fi
133+
134+
if [[ -z "$DOCKERBIN" ]]; then
135+
echo "Could not find docker binary, exiting"
136+
exit
137+
else
138+
echo "Using docker at $DOCKERBIN"
139+
fi
140+
141+
buildLtcScrypt
142+
buildDarkcoinHash
143+
# Build docker image
144+
buildImage
145+
146+
# Prepare host file system
147+
#prepareFile
148+
149+
# Build files
150+
buildBinary
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -x
2+
3+
cd /code
4+
python setup.py build -x bdist_egg --plat-name=x86_64-apple-darwin14
5+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -x
2+
3+
cd /code
4+
python setup.py build -x bdist_egg --plat-name=x86_64-apple-darwin14
5+

contrib/encompass-release/helpers/make_release

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
VERSION="$1"
33
echo "Making packages"
44
mkdir -pv /root/repo
5-
git clone https://github.com/mazaclub/encompass /root/repo
5+
#git clone https://github.com/mazaclub/encompass /root/repo
6+
git clone https://github.com/guruvan/encompass /root/repo
67
cd /root/repo
78
git checkout v$VERSION
89
cp -v /root/make_packages /root/repo/make_packages

0 commit comments

Comments
 (0)