Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Commit

Permalink
Merge pull request #73 from stephentu/master
Browse files Browse the repository at this point in the history
Add conda recipes for distributions
  • Loading branch information
fritzo committed Aug 19, 2014
2 parents 156b53c + cfb18d0 commit bc9e046
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 0 deletions.
8 changes: 8 additions & 0 deletions conda/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
libprotobuf recipe is copied from:
https://github.com/stephentu/conda-recipes/tree/master/libprotobuf

it is not pushed to conda-recipes since it builds against libc++ instead of libstdc++,
and is replicated here for convenience

the protobuf recipe is pushed mainstream to conda/conda-recipes:
https://github.com/conda/conda-recipes/tree/master/protobuf
18 changes: 18 additions & 0 deletions conda/distributions/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
if [ "`uname`" = "Darwin" ]; then
export MACOSX_DEPLOYMENT_TARGET=10.7
fi
echo "Conda build env"
printenv
echo "protoc: `which protoc`"
git clone https://github.com/forcedotcom/distributions.git
cd distributions && git checkout tags/2.0.23
make protobuf
mkdir build && cd build
DISTRIBUTIONS_USE_PROTOBUF=1 cmake \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DEXTRA_INCLUDE_PATH=${PREFIX}/include \
-DEXTRA_LIBRARY_PATH=${PREFIX}/lib ..
make VERBOSE=1 && make install
cd ..
PYDISTRIBUTIONS_USE_LIB=1 LIBRARY_PATH=${PREFIX}/lib EXTRA_INCLUDE_PATH=${PREFIX}/include $PYTHON setup.py install
29 changes: 29 additions & 0 deletions conda/distributions/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package:
name: distributions
version: "2.0.23"

requirements:
build:
- cmake
- python
- numpy
- cython >=0.20.2
- libprotobuf
- pyflakes
- eigen3
run:
- python
- numpy
- protobuf
- libprotobuf
- simplejson

test:
imports:
- distributions
- distributions.lp
- distributions.lp.models
- distributions.lp.models.bb

about:
home: https://github.com/forcedotcom/distributions
16 changes: 16 additions & 0 deletions conda/libprotobuf/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
export CXXFLAGS="-I${PREFIX}/include"
export LDFLAGS="-L${PREFIX}/lib"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
if [ "`uname`" = "Darwin" ]; then
# conda sets MACOSX_DEPLOYMENT_TARGET=10.5, but we need to build with
# -stdlib=libc++; see
# https://code.google.com/p/protobuf/issues/detail?id=449
export MACOSX_DEPLOYMENT_TARGET=10.7
export CXXFLAGS="${CXXFLAGS}"
export CC=clang
export CXX="clang++ -std=c++11 -stdlib=libc++"
fi
./configure --prefix=${PREFIX} --without-zlib
make -j
make install
18 changes: 18 additions & 0 deletions conda/libprotobuf/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package:
name: libprotobuf
version: "2.5.0"

source:
fn: libprotobuf-2.5.0.tar.gz
url: https://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
sha1: 7f6ea7bc1382202fb1ce8c6933f1ef8fea0c0148

test:
files:
- schema.proto
- test.cc

about:
home: http://code.google.com/p/protobuf/
license: New BSD License
summary: 'Protocol Buffers C library/compiler'
16 changes: 16 additions & 0 deletions conda/libprotobuf/run_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh
if [ "`uname`" = "Darwin" ]; then
# conda sets MACOSX_DEPLOYMENT_TARGET=10.5, but we need to build with
# -stdlib=libc++
export MACOSX_DEPLOYMENT_TARGET=10.7
export CXX="g++ -stdlib=libc++"
else
export CXX=g++
fi
echo "Conda testing env:"
printenv
protoc schema.proto --cpp_out=.
${CXX} -v -I${PREFIX}/include -L${PREFIX}/lib -o test test.cc schema.pb.cc -lprotobuf
export DYLD_LIBRARY_PATH=${PREFIX}/lib
export LD_LIBRARY_PATH=${PREFIX}/lib
./test
3 changes: 3 additions & 0 deletions conda/libprotobuf/schema.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message HelloWorld {
required string message = 1;
}
10 changes: 10 additions & 0 deletions conda/libprotobuf/test.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "schema.pb.h"
#include <cassert>
int
main(int argc, char **argv)
{
HelloWorld m;
m.set_message("hi");
assert( m.message() == "hi" );
return 0;
}

0 comments on commit bc9e046

Please sign in to comment.