From b3c4f5d3f5700dafa33213ed0bf5b45b2807e2b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20P=C3=B6ppel?= <jpoeppel@techfak.uni-bielefeld.de>
Date: Thu, 12 Sep 2019 14:49:48 +0200
Subject: [PATCH] created recipes for ipaaca cpp and python. so far tested on
 macos

---
 conda.recipe/build.sh         | 15 --------------
 conda.recipe/cpp/build.sh     | 29 ++++++++++++++++++++++++++
 conda.recipe/cpp/meta.yaml    | 29 ++++++++++++++++++++++++++
 conda.recipe/meta.yaml        | 39 +++++++++++++++++++++--------------
 conda.recipe/python/build.sh  |  9 ++++++++
 conda.recipe/python/meta.yaml | 29 ++++++++++++++++++++++++++
 6 files changed, 120 insertions(+), 30 deletions(-)
 delete mode 100644 conda.recipe/build.sh
 create mode 100644 conda.recipe/cpp/build.sh
 create mode 100644 conda.recipe/cpp/meta.yaml
 create mode 100644 conda.recipe/python/build.sh
 create mode 100644 conda.recipe/python/meta.yaml

diff --git a/conda.recipe/build.sh b/conda.recipe/build.sh
deleted file mode 100644
index 6bec7bb..0000000
--- a/conda.recipe/build.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-
-# install rsb-python
-# Trick conda build to let rsb-python installation run
-# The url to spread in there is not used, but will still raise a RuntimeError if
-# not tricked like this...
-#unset CONDA_BUILD
-#pip install --no-dependencies rsb-python
-#set CONDA_BUILD
-
-# Since we setup subfolders for ipaaca and proto, we want to step into the ipaaca folder here
-cd ipaaca
-echo "Installing ipaaca using setup.py"
-python setup.py install --single-version-externally-managed --record=record.txt 
diff --git a/conda.recipe/cpp/build.sh b/conda.recipe/cpp/build.sh
new file mode 100644
index 0000000..5b6408e
--- /dev/null
+++ b/conda.recipe/cpp/build.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+INCLUDE_PATH="${PREFIX}/include"
+LIBRARY_PATH="${PREFIX}/lib"
+
+export CMAKE_INCLUDE_PATH=$INCLUDE_PATH
+export CMAKE_LIBRARY_PATH=$LIBRARY_PATH
+
+if [[ "$(uname)" == "Linux" ]]; then
+    # Linus needs this lrt flag
+    export LDFLAGS="$LDFLAGS -lrt"
+elif [[ "$(uname)" == "Darwin" ]]; then
+    echo "mac"
+fi
+
+# build protobuf files
+mkdir -p ipaaca-cpp/build/ipaaca
+cd proto
+protoc ipaaca.proto --cpp_out=../ipaaca-cpp/build/ipaaca
+
+# build ipaaca cpp
+cd ../ipaaca-cpp/build
+export VERBOSE=1
+
+cmake .. -DBOOST_INCLUDEDIR=${INCLUDE_PATH} -DBOOST_LIBRARYDIR=${LIBRARY_PATH}
+echo "Finished cmake, trying build now"
+make 
+make install DESTDIR=${PREFIX}
+cd ../../..
\ No newline at end of file
diff --git a/conda.recipe/cpp/meta.yaml b/conda.recipe/cpp/meta.yaml
new file mode 100644
index 0000000..993ae6d
--- /dev/null
+++ b/conda.recipe/cpp/meta.yaml
@@ -0,0 +1,29 @@
+package:
+  name: ipaaca-cpp
+  version: "0.1.0"
+
+source:
+  - path: ../../ipaacalib/cpp/
+    folder: ipaaca-cpp
+  - path: ../../ipaacalib/proto/
+    folder: proto
+
+build:
+  number: 1
+
+requirements:
+  build:
+    - {{ compiler('cxx') }} 7.3 # [linux]
+    - cmake >=3.10
+
+  host:
+    - libprotobuf
+    - mosquitto
+    - libboost
+#    - openssl 1.0.*
+
+  run:
+    - mosquitto
+    - libprotobuf
+    - libboost
+#    - openssl 1.0.*
diff --git a/conda.recipe/meta.yaml b/conda.recipe/meta.yaml
index 9b728a6..70b896d 100644
--- a/conda.recipe/meta.yaml
+++ b/conda.recipe/meta.yaml
@@ -2,24 +2,33 @@ package:
   name: ipaaca
   version: "0.1.0"
 
-source:
-  - path: ../ipaacalib/python
-    folder: ipaaca
-  - path: ../ipaacalib/proto
-    folder: proto
+# source:
+#   - path: ../ipaacalib/cpp/
+#     folder: ipaaca-cpp
+#   - path: ../ipaacalib/python/
+#     folder: ipaaca-py
+#   - path: ../ipaacalib/proto/
+#     folder: proto
 
 build:
   number: 1
 
-requirements:
-  build:
-    - python
-    - pip
-    - setuptools
+run:
+  - ipaaca-cpp
+  - ipaaca-py
 
-  run:
-    - python
-    - mosquitto
-    - protobuf
-    - paho-mqtt
+# requirements:
+#   build:
+#     - {{ compiler('cxx') }} 7.3 # [linux]
+#     - cmake >=3.10
+#   host:
+#     - libprotobuf
+#     - mosquitto
+#     - libboost
+#     - openssl 1.0.*
 
+#   run:
+#     - mosquitto
+#     - libprotobuf
+#     - libboost
+#     - openssl 1.0.*
diff --git a/conda.recipe/python/build.sh b/conda.recipe/python/build.sh
new file mode 100644
index 0000000..549a6f5
--- /dev/null
+++ b/conda.recipe/python/build.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+
+# Since we setup subfolders for ipaaca and proto, we want to step into the ipaaca folder here
+# Note: setup.py assumes protoc file to be at ../proto from here and we do not want to change
+# that for easier manual installation
+cd ipaaca-py
+echo "Installing ipaaca using setup.py"
+#python -m pip install . -vv
+python setup.py install --single-version-externally-managed --record=record.txt
\ No newline at end of file
diff --git a/conda.recipe/python/meta.yaml b/conda.recipe/python/meta.yaml
new file mode 100644
index 0000000..dfcdbf8
--- /dev/null
+++ b/conda.recipe/python/meta.yaml
@@ -0,0 +1,29 @@
+package:
+  name: ipaaca-py
+  version: "0.1.0"
+
+source:
+  - path: ../../ipaacalib/python
+    folder: ipaaca-py
+  - path: ../../ipaacalib/proto
+    folder: proto
+
+build:
+  noarch: python
+  number: 1
+#  script: "{{ PYTHON }} -m pip install ipaaca-py/ -vv"
+  
+
+requirements:
+  build:
+    - python
+    - pip
+    - setuptools
+    - libprotobuf
+
+  run:
+    - python
+    - mosquitto
+    - paho-mqtt
+    - protobuf
+
-- 
GitLab