Skip to content

Commit

Permalink
Building new version of xspec-modeldonly 6.22
Browse files Browse the repository at this point in the history
  • Loading branch information
omodei committed Oct 23, 2019
1 parent 6374d9b commit c0e8af4
Show file tree
Hide file tree
Showing 11 changed files with 176 additions and 112 deletions.
125 changes: 125 additions & 0 deletions build_local.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONDA_BUILD_SYSROOT:
- /opt/MacOSX10.9.sdk # [osx]
8 changes: 0 additions & 8 deletions conda_recipe/ccfits/build.sh

This file was deleted.

21 changes: 0 additions & 21 deletions conda_recipe/ccfits/meta.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions conda_recipe/cfitsio/build.sh

This file was deleted.

19 changes: 0 additions & 19 deletions conda_recipe/cfitsio/meta.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions conda_recipe/wcslib/build.sh

This file was deleted.

21 changes: 0 additions & 21 deletions conda_recipe/wcslib/meta.yaml

This file was deleted.

29 changes: 18 additions & 11 deletions conda_recipe/xspec-modelsonly/build.sh
Original file line number Diff line number Diff line change
@@ -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

Expand Down
47 changes: 31 additions & 16 deletions conda_recipe/xspec-modelsonly/meta.yaml
Original file line number Diff line number Diff line change
@@ -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/

This file was deleted.

0 comments on commit c0e8af4

Please sign in to comment.