Skip to content

Commit

Permalink
scipy: add package
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 authored Jun 2, 2024
1 parent 8212822 commit ad20d50
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/scipy/Dockerfile.stage1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ghcr.io/bjia56/armv7l-wheel-builder:main

WORKDIR /
RUN wget -q https://github.com/OpenMathLib/OpenBLAS/releases/download/v0.3.23/OpenBLAS-0.3.23.tar.gz && \
tar xf OpenBLAS-0.3.23.tar.gz && \
cd OpenBLAS-0.3.23 && \
mkdir -p /tmp/vendor && \
make PREFIX=/tmp/vendor TARGET=ARMV7 -j4 && \
make PREFIX=/tmp/vendor TARGET=ARMV7 install

25 changes: 25 additions & 0 deletions packages/scipy/Dockerfile.stage2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM base
ARG PYTHON_VERSION
ARG VERSION
ARG OUTPUT_DIR

ENV CFLAGS='-I/usr/local/ssl/include -I/tmp/vendor/include'
ENV LDFLAGS='-L/usr/local/ssl/lib -L/tmp/vendor/lib'
ENV LD_LIBRARY_PATH=/tmp/vendor/lib:/usr/local/ssl/lib:$LD_LIBRARY_PATH
ENV PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig:/usr/local/ssl/lib/pkgconfig

ENV CC=/opt/rh/devtoolset-10/root/usr/bin/gcc
ENV FC=/opt/rh/devtoolset-10/root/usr/bin/gfortran5
ENV CXX=/opt/rh/devtoolset-10/root/usr/bin/g++
ENV LD=/opt/rh/devtoolset-10/root/usr/bin/ld

COPY . /repo

RUN mkdir /scipy
WORKDIR /scipy
RUN select_python ${PYTHON_VERSION}
RUN pip3 install setuptools==49.2.0
RUN export OPENBLAS=/tmp/vendor && /repo/armv7l_build_wheels.sh ${PYTHON_VERSION} ${VERSION}

RUN mkdir -p ${OUTPUT_DIR} && \
cp build${PYTHON_VERSION}/wheelhouse/scipy*manylinux*armv7l.whl ${OUTPUT_DIR}
31 changes: 31 additions & 0 deletions packages/scipy/armv7l_build_wheels.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

PYTHON3_VERSION=$1
PACKAGE_VERSION=$2

set -e

build_wheel() (
PY_VER=$1
VER=$2
mkdir build$PY_VER
cd build$PY_VER
pip$PY_VER wheel --no-deps scipy==$VER
)

test_wheel() (
PY_VER=$1
cd build$PY_VER
pip$PY_VER install wheelhouse/scipy*manylinux*armv7l.whl
python$PY_VER -c "import scipy; print(scipy)"
)

repair_wheel() (
PY_VER=$1
cd build$PY_VER
auditwheel repair scipy*armv7l.whl
)

build_wheel $PYTHON3_VERSION $PACKAGE_VERSION
repair_wheel $PYTHON3_VERSION
test_wheel $PYTHON3_VERSION
15 changes: 15 additions & 0 deletions packages/scipy/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
strategy: dockerfile
source:
- file: ./Dockerfile.stage1
common: true
- file: ./Dockerfile.stage2

python:
versions:
- "3.9"
- "3.10"
- "3.11"
- "3.12"

package:
versions: latest

0 comments on commit ad20d50

Please sign in to comment.