From 881ce53484c8fc126be0a48845185de168b5ae6d Mon Sep 17 00:00:00 2001 From: Kai Muehlbauer Date: Tue, 7 Jun 2016 15:32:53 +0200 Subject: [PATCH 1/4] FIX: Update 4.3.0 and pinning, add patch to generate ncxx4-config --- recipe/build.sh | 46 +++------ recipe/meta.yaml | 19 ++-- recipe/ncxx4-config.patch | 201 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 225 insertions(+), 41 deletions(-) create mode 100644 recipe/ncxx4-config.patch diff --git a/recipe/build.sh b/recipe/build.sh index 9142124..f8d8597 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -1,38 +1,14 @@ #!/usr/bin/env bash -if [ "$(uname)" == "Darwin" ] -then - # for Mac OSX - export CC=clang - export CXX=clang++ - export MACOSX_VERSION_MIN="10.7" - export MACOSX_DEPLOYMENT_TARGET="${MACOSX_VERSION_MIN}" - export CXXFLAGS="${CXXFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}" - export CXXFLAGS="${CXXFLAGS} -stdlib=libc++ -std=c++11" - export LDFLAGS="${LDFLAGS} -mmacosx-version-min=${MACOSX_VERSION_MIN}" - export LDFLAGS="${LDFLAGS} -stdlib=libc++ -lc++" - export LINKFLAGS="${LDFLAGS}" - # See http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg11939.html - export DYLD_LIBRARY_PATH=${PREFIX}/lib -elif [ "$(uname)" == "Linux" ] -then - # for Linux - export CC=gcc - export CXX=g++ - export CXXFLAGS="${CXXFLAGS} -DBOOST_MATH_DISABLE_FLOAT128" - export LDFLAGS="${LDFLAGS}" - export LINKFLAGS="${LDFLAGS}" -else - echo "This system is unsupported by the toolchain." - exit 1 -fi - -export CFLAGS="${CFLAGS} -m${ARCH}" -export CXXFLAGS="${CXXFLAGS} -m${ARCH}" - - -CPPFLAGS=-I$PREFIX/include LDFLAGS=-L$PREFIX/lib ./configure --prefix=$PREFIX - +# Build shared library using cmake +# works for both linux and osx, but missing ncxx4-config +# see https://github.com/Unidata/netcdf-cxx4/issues/36 +cmake -D CMAKE_INSTALL_PREFIX=$PREFIX \ + -D CMAKE_INSTALL_LIBDIR:PATH=$PREFIX/lib \ + -D BUILD_SHARED_LIBS=ON \ + -D NCXX_ENABLE_TESTS=ON \ + -D ENABLE_DOXYGEN=OFF \ + $SRC_DIR make -make check -make install \ No newline at end of file +ctest +make install diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 9b1a234..04b8386 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,22 +1,29 @@ -{% set version = "4.2.1" %} +{% set version = "4.3.0" %} package: name: netcdf-cxx4 version: {{ version }} source: - git_url: https://github.com/Unidata/netcdf-cxx4 - git_tag: v{{ version }} + fn: netcdf-cxx4-{{ version }}.tar.gz + url: https://github.com/Unidata/netcdf-cxx4/archive/v{{ version }}.tar.gz + sha256: 25da1c97d7a01bc4cee34121c32909872edd38404589c0427fefa1301743f18f + patches: + - ncxx4-config.patch build: - number: 2 + number: 0 skip: True # [win] requirements: build: - - libnetcdf 4.3* + - autoconf + - automake + - libtool + - toolchain + - libnetcdf 4.4* run: - - libnetcdf 4.3* + - libnetcdf 4.4* test: commands: diff --git a/recipe/ncxx4-config.patch b/recipe/ncxx4-config.patch new file mode 100644 index 0000000..149099a --- /dev/null +++ b/recipe/ncxx4-config.patch @@ -0,0 +1,201 @@ +Index: CMakeLists.txt +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- CMakeLists.txt (revision 50c8b89c1d01feff64b74bd4ecefb606bc9127cc) ++++ CMakeLists.txt (revision c871031e519b1a0f6255588aaff6aabd56fce145) +@@ -510,6 +510,26 @@ + ##### + + ##### ++# Begin ncxx4-config section ++##### ++ ++FILE(MAKE_DIRECTORY ${NCXX_BINARY_DIR}/tmp) ++CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ncxx4-config.cmake.in" ++ "${NCXX_BINARY_DIR}/tmp/ncxx4-config" @ONLY) ++FILE(COPY "${NCXX_BINARY_DIR}/tmp/ncxx4-config" ++ DESTINATION ${NCXX_BINARY_DIR}/ ++ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ++ ++INSTALL(PROGRAMS ${NCXX_BINARY_DIR}/ncxx4-config ++ DESTINATION ${CMAKE_INSTALL_BINDIR} ++ COMPONENT utilities) ++ ++##### ++# End ncxx4-config section ++##### ++ ++ ++##### + # Options + ##### + +Index: ncxx4-config.cmake.in +IDEA additional info: +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP +<+>UTF-8 +=================================================================== +--- ncxx4-config.cmake.in (revision 6cafb08d09bb3589deaa0a1b31a9be437ef47176) ++++ ncxx4-config.cmake.in (revision 6cafb08d09bb3589deaa0a1b31a9be437ef47176) +@@ -0,0 +1,159 @@ ++#! /bin/sh ++# ++# This forms the basis for the ncxx4-config utility, which tells you ++# various things about the netCDF C++ library installation. ++ ++prefix="@CMAKE_INSTALL_PREFIX@" ++exec_prefix="@CMAKE_INSTALL_PREFIX@" ++libdir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" ++includedir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" ++ ++cc="@CMAKE_C_COMPILER@" ++cxx="@CMAKE_CXX_COMPILER@" ++ ++cflags="-I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" ++ ++libs="-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ @NC_LIBS@" ++ ++has_dap="@USE_DAP@" ++if [ -z $has_dap ]; then ++ has_dap="no" ++else ++has_dap="yes" ++fi ++ ++has_nc2="@BUILD_V2@" ++if [ -z $has_nc2 -o "$has_nc2" = "OFF" ]; then ++ has_nc2="no" ++else ++has_nc2="yes" ++fi ++ ++has_nc4="@USE_NETCDF4@" ++if [ -z $has_nc4 ]; then ++ has_nc4="no" ++else ++has_nc4="yes" ++fi ++ ++version="@PACKAGE@ @VERSION@" ++ ++usage() ++{ ++ cat < $cc" ++ echo " --cflags -> $cflags" ++ echo " --libs -> $libs" ++ echo ++ echo " --cxx -> $cxx" ++ echo ++ echo " --has-dap -> $has_dap" ++ echo " --has-nc2 -> $has_nc2" ++ echo " --has-nc4 -> $has_nc4" ++ echo ++ echo " --prefix -> $prefix" ++ echo " --includedir-> $includedir" ++ echo " --version -> $version" ++ echo ++} ++ ++if test $# -eq 0; then ++ usage 1 ++fi ++ ++while test $# -gt 0; do ++ case "$1" in ++ # this deals with options in the style ++ # --option=value and extracts the value part ++ # [not currently used] ++ -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; ++ *) value= ;; ++ esac ++ ++ case "$1" in ++ ++ --help) ++ usage 0 ++ ;; ++ ++ --all) ++ all ++ ;; ++ ++ --cc) ++ echo $cc ++ ;; ++ ++ --cxx) ++ echo $cxx ++ ;; ++ ++ --cflags) ++ echo $cflags ++ ;; ++ ++ --libs) ++ echo $libs ++ ;; ++ ++ --has-dap) ++ echo $has_dap ++ ;; ++ ++ --has-nc2) ++ echo $has_nc2 ++ ;; ++ ++ --has-nc4) ++ echo $has_nc4 ++ ;; ++ ++ --prefix) ++ echo "${prefix}" ++ ;; ++ ++ --includedir) ++ echo "${includedir}" ++ ;; ++ ++ --version) ++ echo $version ++ ;; ++ ++ *) ++ echo "unknown option: $1" ++ usage ++ exit 1 ++ ;; ++ esac ++ shift ++done ++ ++exit 0 From d3161ddf1413984ef4716347ab72a08b423619e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=BChlbauer?= Date: Tue, 7 Jun 2016 16:02:01 +0200 Subject: [PATCH 2/4] FIX: add cmake --- recipe/meta.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 04b8386..96eaa87 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -17,9 +17,7 @@ build: requirements: build: - - autoconf - - automake - - libtool + - cmake - toolchain - libnetcdf 4.4* run: From f6c53bf136397a44c104d9b23094672a1111c025 Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Mon, 20 Jun 2016 11:08:00 -0300 Subject: [PATCH 3/4] drop ncxx4-config, test libs, build static closes #9 --- recipe/build.sh | 20 ++++ recipe/meta.yaml | 12 ++- recipe/ncxx4-config.patch | 201 -------------------------------------- recipe/run_test.py | 18 ++++ 4 files changed, 45 insertions(+), 206 deletions(-) delete mode 100644 recipe/ncxx4-config.patch create mode 100644 recipe/run_test.py diff --git a/recipe/build.sh b/recipe/build.sh index f8d8597..6aab3cd 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -3,6 +3,26 @@ # Build shared library using cmake # works for both linux and osx, but missing ncxx4-config # see https://github.com/Unidata/netcdf-cxx4/issues/36 + +# Build static. +mkdir build_static && cd build_static +cmake -D CMAKE_INSTALL_PREFIX=$PREFIX \ + -D CMAKE_INSTALL_LIBDIR:PATH=$PREFIX/lib \ + -D BUILD_SHARED_LIBS=OFF \ + -D NCXX_ENABLE_TESTS=ON \ + -D ENABLE_DOXYGEN=OFF \ + $SRC_DIR +make +# ctest # Run only for the shared lib build to save time. +make install + + +make clean + +cd .. + +# Build shared. +mkdir build_shared && cd build_shared cmake -D CMAKE_INSTALL_PREFIX=$PREFIX \ -D CMAKE_INSTALL_LIBDIR:PATH=$PREFIX/lib \ -D BUILD_SHARED_LIBS=ON \ diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 96eaa87..f3f7dd3 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -8,8 +8,6 @@ source: fn: netcdf-cxx4-{{ version }}.tar.gz url: https://github.com/Unidata/netcdf-cxx4/archive/v{{ version }}.tar.gz sha256: 25da1c97d7a01bc4cee34121c32909872edd38404589c0427fefa1301743f18f - patches: - - ncxx4-config.patch build: number: 0 @@ -19,13 +17,17 @@ requirements: build: - cmake - toolchain - - libnetcdf 4.4* + - libnetcdf 4.4.* run: - - libnetcdf 4.4* + - libnetcdf 4.4.* test: + requires: + - python {{ environ['PY_VER'] + '*' }} # [win] commands: - - ncxx4-config --all + #- ncxx4-config --all # FIXME: no ncxx4-config for cmake yet. + - test -f ${PREFIX}/lib/libnetcdf-cxx4.a # [unix] + - conda inspect linkages -n _test netcdf-cxx4 # [linux] about: home: https://github.com/Unidata/netcdf-cxx4 diff --git a/recipe/ncxx4-config.patch b/recipe/ncxx4-config.patch deleted file mode 100644 index 149099a..0000000 --- a/recipe/ncxx4-config.patch +++ /dev/null @@ -1,201 +0,0 @@ -Index: CMakeLists.txt -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- CMakeLists.txt (revision 50c8b89c1d01feff64b74bd4ecefb606bc9127cc) -+++ CMakeLists.txt (revision c871031e519b1a0f6255588aaff6aabd56fce145) -@@ -510,6 +510,26 @@ - ##### - - ##### -+# Begin ncxx4-config section -+##### -+ -+FILE(MAKE_DIRECTORY ${NCXX_BINARY_DIR}/tmp) -+CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ncxx4-config.cmake.in" -+ "${NCXX_BINARY_DIR}/tmp/ncxx4-config" @ONLY) -+FILE(COPY "${NCXX_BINARY_DIR}/tmp/ncxx4-config" -+ DESTINATION ${NCXX_BINARY_DIR}/ -+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -+ -+INSTALL(PROGRAMS ${NCXX_BINARY_DIR}/ncxx4-config -+ DESTINATION ${CMAKE_INSTALL_BINDIR} -+ COMPONENT utilities) -+ -+##### -+# End ncxx4-config section -+##### -+ -+ -+##### - # Options - ##### - -Index: ncxx4-config.cmake.in -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- ncxx4-config.cmake.in (revision 6cafb08d09bb3589deaa0a1b31a9be437ef47176) -+++ ncxx4-config.cmake.in (revision 6cafb08d09bb3589deaa0a1b31a9be437ef47176) -@@ -0,0 +1,159 @@ -+#! /bin/sh -+# -+# This forms the basis for the ncxx4-config utility, which tells you -+# various things about the netCDF C++ library installation. -+ -+prefix="@CMAKE_INSTALL_PREFIX@" -+exec_prefix="@CMAKE_INSTALL_PREFIX@" -+libdir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@" -+includedir="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" -+ -+cc="@CMAKE_C_COMPILER@" -+cxx="@CMAKE_CXX_COMPILER@" -+ -+cflags="-I@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@" -+ -+libs="-L@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ @NC_LIBS@" -+ -+has_dap="@USE_DAP@" -+if [ -z $has_dap ]; then -+ has_dap="no" -+else -+has_dap="yes" -+fi -+ -+has_nc2="@BUILD_V2@" -+if [ -z $has_nc2 -o "$has_nc2" = "OFF" ]; then -+ has_nc2="no" -+else -+has_nc2="yes" -+fi -+ -+has_nc4="@USE_NETCDF4@" -+if [ -z $has_nc4 ]; then -+ has_nc4="no" -+else -+has_nc4="yes" -+fi -+ -+version="@PACKAGE@ @VERSION@" -+ -+usage() -+{ -+ cat < $cc" -+ echo " --cflags -> $cflags" -+ echo " --libs -> $libs" -+ echo -+ echo " --cxx -> $cxx" -+ echo -+ echo " --has-dap -> $has_dap" -+ echo " --has-nc2 -> $has_nc2" -+ echo " --has-nc4 -> $has_nc4" -+ echo -+ echo " --prefix -> $prefix" -+ echo " --includedir-> $includedir" -+ echo " --version -> $version" -+ echo -+} -+ -+if test $# -eq 0; then -+ usage 1 -+fi -+ -+while test $# -gt 0; do -+ case "$1" in -+ # this deals with options in the style -+ # --option=value and extracts the value part -+ # [not currently used] -+ -*=*) value=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; -+ *) value= ;; -+ esac -+ -+ case "$1" in -+ -+ --help) -+ usage 0 -+ ;; -+ -+ --all) -+ all -+ ;; -+ -+ --cc) -+ echo $cc -+ ;; -+ -+ --cxx) -+ echo $cxx -+ ;; -+ -+ --cflags) -+ echo $cflags -+ ;; -+ -+ --libs) -+ echo $libs -+ ;; -+ -+ --has-dap) -+ echo $has_dap -+ ;; -+ -+ --has-nc2) -+ echo $has_nc2 -+ ;; -+ -+ --has-nc4) -+ echo $has_nc4 -+ ;; -+ -+ --prefix) -+ echo "${prefix}" -+ ;; -+ -+ --includedir) -+ echo "${includedir}" -+ ;; -+ -+ --version) -+ echo $version -+ ;; -+ -+ *) -+ echo "unknown option: $1" -+ usage -+ exit 1 -+ ;; -+ esac -+ shift -+done -+ -+exit 0 diff --git a/recipe/run_test.py b/recipe/run_test.py new file mode 100644 index 0000000..29ad916 --- /dev/null +++ b/recipe/run_test.py @@ -0,0 +1,18 @@ +# Load the libraries using ctypes. +import os +import sys +import ctypes + +platform = sys.platform + +if platform.startswith('linux'): + path = os.path.join(sys.prefix, 'lib', 'libnetcdf-cxx4.so') + lib = ctypes.CDLL(path) +elif platform == 'darwin': + path = os.path.join(sys.prefix, 'lib', 'libnetcdf-cxx4.dylib') + lib = ctypes.CDLL(path) +elif platform == 'win32': + path = os.path.join(sys.prefix, 'Library', 'bin', 'libnetcdf-cxx4.dll') + lib = ctypes.CDLL(path) +else: + raise ValueError('Unrecognized platform: {}'.format(platform)) From 9d261e95f2ed59880bddc4b50456e6ddc740713d Mon Sep 17 00:00:00 2001 From: ocefpaf Date: Mon, 20 Jun 2016 11:44:22 -0300 Subject: [PATCH 4/4] drop toolchain --- recipe/meta.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/recipe/meta.yaml b/recipe/meta.yaml index f3f7dd3..7f01ddf 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -16,7 +16,6 @@ build: requirements: build: - cmake - - toolchain - libnetcdf 4.4.* run: - libnetcdf 4.4.*