diff --git a/build_local.sh b/build_local.sh new file mode 100755 index 0000000..aaf55e9 --- /dev/null +++ b/build_local.sh @@ -0,0 +1,125 @@ +#!/usr/bin/env bash +TRAVIS_OS_NAME="unknown" + +if [[ "$OSTYPE" == "linux-gnu" ]]; then + + # Linux + + TRAVIS_OS_NAME="linux" + + +elif [[ "$OSTYPE" == darwin* ]]; then + + # Mac OSX + + TRAVIS_OS_NAME="osx" + + +elif [[ "$OSTYPE" == "cygwin" ]]; then + + # POSIX compatibility layer and Linux environment emulation for Windows + + TRAVIS_OS_NAME="linux" + +else + + # Unknown. + + echo "Could not guess your OS. Exiting." + + exit 1 + +fi + +echo "Running on ${TRAVIS_OS_NAME}" + +TRAVIS_PYTHON_VERSION=2.7 +TRAVIS_BUILD_NUMBER=0 + +ENVNAME=xsmodelsonly_test_$TRAVIS_PYTHON_VERSION + +echo "Python version: ${TRAVIS_PYTHON_VERSION}" + +# Make sure we fail in case of errors +set -e + +# Environment +# libgfortranver="3.0" + +UPDATE_CONDA=true + +#if [[ ${TRAVIS_OS_NAME} == linux ]]; +#then +# miniconda_os=Linux +# compilers="gcc_linux-64 gxx_linux-64 gfortran_linux-64" +#else # osx +# miniconda_os=MacOSX +# compilers="clang_osx-64 clangxx_osx-64 gfortran_osx-64" +# # On macOS we also need the conda libx11 libraries used to build xspec +# # We also need to pin down ncurses, for now only on macos. +# xorg="xorg-libx11 ncurses=5" +#fi + + + +if $UPDATE_CONDA ; then + # Update conda + echo "Update conda..." + conda update --yes -q conda conda-build +fi + +if [[ ${TRAVIS_OS_NAME} == osx ]]; +then + conda config --add channels conda-forge +fi + +# Answer yes to all questions (non-interactive) +conda config --set always_yes true + +# We will upload explicitly at the end, if successful +conda config --set anaconda_upload no + +# Create test environment +echo "Create test environment..." + +conda create --yes --name $ENVNAME -c conda-forge python=$TRAVIS_PYTHON_VERSION + +# Make sure conda-forge is the first channel +conda config --add channels conda-forge + +conda config --add channels defaults + +# Activate test environment +echo "Activate test environment..." + +#source $HOME/work/fermi/miniconda3/etc/profile.d/conda.sh +#conda activate $ENVNAME +source activate $ENVNAME + +# Build package +echo "Build package..." +if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + conda build --python=$TRAVIS_PYTHON_VERSION conda_recipe/xspec-modelsonly + #conda index $HOME/work/fermi/miniconda3/conda-bld + conda index $HOME/miniconda/conda-bld +else + # there is some strange error about the prefix length + conda build --no-build-id --python=$TRAVIS_PYTHON_VERSION conda_recipe/xspec-modelsonly + conda index $HOME/miniconda/conda-bld +fi +echo "======> installing..." +conda install --use-local -c conda-forge xspec-modelsonly + +# Run tests +#cd astromodels/tests +#python -m pytest -vv --cov=astromodels # -k "not slow" + +# Codecov needs to run in the main git repo + +## Upload coverage measurements if we are on Linux +#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + +# echo "********************************** COVERAGE ******************************" +# codecov -t 493c9a2d-42fc-40d6-8e65-24e681efaa1e# + +#fi diff --git a/conda_build_config.yaml b/conda_build_config.yaml new file mode 100644 index 0000000..fedc7cc --- /dev/null +++ b/conda_build_config.yaml @@ -0,0 +1,2 @@ +CONDA_BUILD_SYSROOT: + - /opt/MacOSX10.9.sdk # [osx] diff --git a/conda_recipe/ccfits/build.sh b/conda_recipe/ccfits/build.sh deleted file mode 100644 index 8c8eb3d..0000000 --- a/conda_recipe/ccfits/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -export CPPFLAGS="-I${PREFIX}/include" -export LDFLAGS="-L${PREFIX}/lib" - -./configure --prefix=$PREFIX - -make - -make install diff --git a/conda_recipe/ccfits/meta.yaml b/conda_recipe/ccfits/meta.yaml deleted file mode 100644 index 9fbc8e4..0000000 --- a/conda_recipe/ccfits/meta.yaml +++ /dev/null @@ -1,21 +0,0 @@ -package: - name: ccfits - version: "2.5" - -source: - url: https://heasarc.gsfc.nasa.gov/fitsio/ccfits/CCfits-2.5.tar.gz - -build: - number: 0 - -requirements: - - build: - - cfitsio - - run: - - cfitsio - -about: - home: https://heasarc.gsfc.nasa.gov/fitsio/ccfits/ - license: GPL2 diff --git a/conda_recipe/cfitsio/build.sh b/conda_recipe/cfitsio/build.sh deleted file mode 100644 index 1ed3953..0000000 --- a/conda_recipe/cfitsio/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -./configure --prefix=$PREFIX - -make -make shared - -make install diff --git a/conda_recipe/cfitsio/meta.yaml b/conda_recipe/cfitsio/meta.yaml deleted file mode 100644 index 901ef82..0000000 --- a/conda_recipe/cfitsio/meta.yaml +++ /dev/null @@ -1,19 +0,0 @@ -package: - name: cfitsio - version: "3.410" - -source: - url: http://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio3410.tar.gz - -build: - number: 0 - -requirements: - - build: - - run: - -about: - home: https://heasarc.gsfc.nasa.gov/fitsio/ccfits/ - license: GPL2 diff --git a/conda_recipe/wcslib/build.sh b/conda_recipe/wcslib/build.sh deleted file mode 100644 index 21ffdf4..0000000 --- a/conda_recipe/wcslib/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -export CFLAGS='-fPIC' - -./configure --prefix=$PREFIX - -make - -make install diff --git a/conda_recipe/wcslib/meta.yaml b/conda_recipe/wcslib/meta.yaml deleted file mode 100644 index 0d43309..0000000 --- a/conda_recipe/wcslib/meta.yaml +++ /dev/null @@ -1,21 +0,0 @@ -package: - name: wcslib - version: "5.16" - -source: - url: ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib-5.16.tar.bz2 - -build: - number: 0 - -requirements: - - build: - - cfitsio - - run: - - cfitsio - -about: - home: https://heasarc.gsfc.nasa.gov/fitsio/ccfits/ - license: GPL2 diff --git a/conda_recipe/xspec-modelsonly/build.sh b/conda_recipe/xspec-modelsonly/build.sh index 27db64d..f8bb693 100644 --- a/conda_recipe/xspec-modelsonly/build.sh +++ b/conda_recipe/xspec-modelsonly/build.sh @@ -1,25 +1,32 @@ cd BUILD_DIR +# We need a custom include and library path to use the packages installed +# in the build environment + +export CFLAGS="-I$CONDA_PREFIX/include" +export CXXFLAGS="-std=c++11 -Wno-c++11-narrowing -I$CONDA_PREFIX/include" +export LDFLAGS="$LDFLAGS -L$CONDA_PREFIX/lib" + +#export CFLAGS="${CFLAGS} -I${PREFIX}/include -O2 -Wall --pedantic -Wno-comment -Wno-long-long -g -ffloat-store -fPIC" +#export CXXFLAGS="${CXXFLAGS} -I${PREFIX}/include -O2 -std=c++11 -Wno-c++11-narrowing -Wall --pedantic -Wno-comment -Wno-long-long -g -ffloat-store -fPIC" +#export CPPFLAGS="${CXXFLAGS} -I${PREFIX}/include" + if [ "$(uname)" == "Linux" ]; then - # We need a custom include and library path to use the packages installed - # in the build environment - export CFLAGS='-I${PREFIX}/include -O2 -Wall --pedantic -Wno-comment -Wno-long-long -g -ffloat-store -fPIC' - export CXXFLAGS='-I${PREFIX}/include -O2 -Wall --pedantic -Wno-comment -Wno-long-long -g -ffloat-store -fPIC' - export CPPFLAGS="-I${PREFIX}/include" - export LDFLAGS="-L${PREFIX}/lib" - ./configure --prefix=${SRC_DIR}/xspec-modelsonly-build - - ./hmake 'XSLM_USER_FLAGS="-I${PREFIX}/include"' 'XSLM_USER_LIBS="-L${PREFIX}/lib -lCCfits -lcfitsio -lwcslib"' + + ./hmake 'XSLM_USER_FLAGS="-I${PREFIX}/include"' 'XSLM_USER_LIBS="-L${PREFIX}/lib -lCCfits -lcfitsio -lwcslib -lgfortran"' fi if [ "$(uname)" == "Darwin" ]; then - ./configure --prefix=${SRC_DIR}/xspec-modelsonly-build + # Build for a fairly old mac to ensure portability - ./hmake 'LDFLAGS_CXX=-headerpad_max_install_names -lcfitsio -lCCfits -lccfits -lwcs' + ./configure --prefix=${SRC_DIR}/xspec-modelsonly-build + make HD_ADD_SHLIB_LIBS=yes + make install + #./hmake 'LDFLAGS_CXX=-headerpad_max_install_names -lcfitsio -lCCfits -lccfits -lwcs -lgfortran' 'XSLM_USER_LIBS="-L${PREFIX}/lib -lCCfits -lcfitsio -lwcslib -lgfortran"' fi diff --git a/conda_recipe/xspec-modelsonly/meta.yaml b/conda_recipe/xspec-modelsonly/meta.yaml index 5e9c4a0..2dd1913 100644 --- a/conda_recipe/xspec-modelsonly/meta.yaml +++ b/conda_recipe/xspec-modelsonly/meta.yaml @@ -1,26 +1,41 @@ package: name: xspec-modelsonly - version: "6.20" + version: "6.22.1" source: - #path: xspec-modelsonly-v6.20-no-big-data.tar.gz - #url: https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/release/xspec-modelsonly-v6.21.tar.gz - url: file:///work/xspec-modelsonly-v6.20-no-big-data.tar.gz +# md5: 0abea9e1609fcdc2c3e3ada92043d17b + url: https://heasarc.gsfc.nasa.gov/FTP/software/lheasoft/lheasoft6.22.1/xspec-modelsonly-v6.22.1.tar.gz + fn: xspec-modelsonly-v6.22.1.tar.gz build: number: 0 requirements: - - build: - - cfitsio - - ccfits - - wcslib - - readline - - run: - - cfitsio - - ccfits - - wcslib - - readline + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - {{ compiler('fortran') }} + - ncurses==5.* + - readline==6.2 + - cfitsio + - ccfits + - wcslib + - libgfortran + #- clang_osx-64 # [osx] + #- clangxx_osx-64 # [osx] + #- gfortran_osx-64 # [osx] + host: + - ncurses==5.* + - readline==6.2 +# Note that ncurses is only needed to build but I am not +# sure it's needed at all at run-time. To keep things +# safe and simple I am keeping it, but removing the version +# number since it was only there to make `configure` happy +# and there is no evidence ncurses is required in the +# first place. +# run: +# - readline + +about: + home: https://heasarc.gsfc.nasa.gov/xanadu/xspec/ diff --git a/conda_recipe/xspec-modelsonly/xspec-modelsonly-v6.20-no-big-data.tar.gz b/conda_recipe/xspec-modelsonly/xspec-modelsonly-v6.20-no-big-data.tar.gz deleted file mode 100644 index 588738a..0000000 --- a/conda_recipe/xspec-modelsonly/xspec-modelsonly-v6.20-no-big-data.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a45dccc77820dd85c7d9be9dbd12e8edefb302e702c51324f46792e63696ec69 -size 389712976