Skip to content

Commit 2feebda

Browse files
committed
Merge pull request #5 from minrk/build_libzmq
Problem: libzmq build stage should be a script
2 parents 00bdcd4 + 67bea3d commit 2feebda

File tree

4 files changed

+29
-32
lines changed

4 files changed

+29
-32
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ binding.Makefile
1111
binding.target.gyp.mk
1212
gyp-mac-tool
1313
out/
14+
zmq

.travis.yml

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,7 @@ before_install:
3030
- npm --version
3131
- test "$(uname)" = "Darwin" || export CXX=g++-4.8 CC=gcc-4.8
3232
- gcc --version
33-
- mkdir zmq
34-
- export ZMQ_PREFIX=`pwd`/zmq
35-
- export CFLAGS=-fPIC
36-
- export CXXFLAGS=-fPIC
37-
- export PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig
38-
- echo $PKG_CONFIG_PATH
39-
- wget https://github.com/zeromq/zeromq4-1/archive/$ZMQ.tar.gz -O zeromq-$ZMQ.tar.gz
40-
- tar xzvf zeromq-$ZMQ.tar.gz
41-
- cd zeromq4-1-$ZMQ
42-
- ./autogen.sh
43-
- ./configure --prefix=$ZMQ_PREFIX --with-tweetnacl --with-relaxed --enable-static --disable-shared
44-
- V=1 make -j
45-
- make install
46-
- cd ..
33+
- sh build_libzmq.sh
4734

4835
install: env PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig npm install
4936

binding.gyp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,35 +32,19 @@
3232
}
3333
},
3434
}, {
35-
'libraries': [ '<!@(pkg-config libzmq --variable=libdir)/libzmq.a' ],
35+
'libraries': [ '<(PRODUCT_DIR)/../../zmq/lib/libzmq.a' ],
36+
'include_dirs': [ '<(PRODUCT_DIR)/../../zmq/include' ],
3637
'cflags!': ['-fno-exceptions'],
3738
'cflags_cc!': ['-fno-exceptions'],
3839
}],
3940
['OS=="mac" or OS=="solaris"', {
4041
'xcode_settings': {
4142
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES'
4243
},
43-
# add macports include & lib dirs, homebrew include & lib dirs
44-
'include_dirs': [
45-
'<!@(pkg-config libzmq --cflags-only-I | sed s/-I//g)',
46-
'/opt/local/include',
47-
'/usr/local/include',
48-
],
49-
'libraries': [
50-
'-L/opt/local/lib',
51-
'-L/usr/local/lib',
52-
]
5344
}],
5445
['OS=="openbsd" or OS=="freebsd"', {
55-
'include_dirs': [
56-
'<!@(pkg-config libzmq --cflags-only-I | sed s/-I//g)',
57-
'/usr/local/include',
58-
]
5946
}],
6047
['OS=="linux"', {
61-
'cflags': [
62-
'<!(pkg-config libzmq --cflags 2>/dev/null || echo "")',
63-
],
6448
}],
6549
]
6650
}

build_libzmq.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/sh
2+
set -e
3+
4+
test -d zmq || mkdir zmq
5+
6+
export ZMQ=b539733cee0f47f9bf1a70dc7cb7ff20410d3380 # zeromq-4.1.5 prerelease for tweetnacl support
7+
realpath() {
8+
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
9+
}
10+
export ZMQ_PREFIX="$(dirname $(realpath $0))/zmq"
11+
export ZMQ_SRC_DIR=zeromq4-1-$ZMQ
12+
cd $ZMQ_PREFIX
13+
14+
export CFLAGS=-fPIC
15+
export CXXFLAGS=-fPIC
16+
export PKG_CONFIG_PATH=$ZMQ_PREFIX/lib/pkgconfig
17+
18+
test -f zeromq-$ZMQ.tar.gz || wget https://github.com/zeromq/zeromq4-1/archive/$ZMQ.tar.gz -O zeromq-$ZMQ.tar.gz
19+
test -d $ZMQ_SRC_DIR || tar xzf zeromq-$ZMQ.tar.gz
20+
cd $ZMQ_SRC_DIR
21+
22+
test -f configure || ./autogen.sh
23+
./configure --prefix=$ZMQ_PREFIX --with-tweetnacl --with-relaxed --enable-static --disable-shared
24+
V=1 make -j
25+
make install

0 commit comments

Comments
 (0)