#docker run --rm -it intel/oneapi-hpckit:devel-ubuntu22.04 bash

set -eux
# remove intel repos
rm /etc/apt/sources.list.d/*.list
apt-get update
apt-get install -y \
  git \
  cmake \
  pkg-config \
  build-essential \
  autoconf \
  libtool \
  libatlas-base-dev \
  libfftw3-dev \
  libopenblas-dev \
  libcfitsio-dev \
  gawk
#. /opt/intel/oneapi/setvars.sh --force

# make link for icc (use icpx actually)
#DIR_ICC=$(dirname "$(which icpx)")
#echo 'icpx -fsycl "$@"' > "${DIR_ICC}"/icc
##echo 'dpcpp "$@"' > "${DIR_ICC}"/icc
#chmod +x "${DIR_ICC}"/icc

cp -r /sextractor /build
cd build
sh autogen.sh
./configure --enable-icc --enable-mkl --enable-auto-flags --enable-best-link
make -j
cp /build/src/sex /sextractor/sex
chown 1000:1000 /sextractor/sex


