Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Pyproj, Proj and change libtiff #1172

Closed
wants to merge 17 commits into from
2 changes: 1 addition & 1 deletion conda_build_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ poco:
poppler:
- '22.01'
proj:
- 8.2.0
- 9.4.1
pybind11_abi:
- 4

Expand Down
3 changes: 2 additions & 1 deletion recipes/recipes_emscripten/libtiff/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ emcmake cmake .. -GNinja \
-DCMAKE_INSTALL_PREFIX=$PREFIX \
-DCMAKE_PREFIX_PATH=$PREFIX \
-DCMAKE_INSTALL_LIBDIR=lib \
-DBUILD_SHARED_LIBS=OFF
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

ninja
ninja install
2 changes: 1 addition & 1 deletion recipes/recipes_emscripten/libtiff/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source:
sha256: c7a1d9296649233979fa3eacffef3fa024d73d05d589cb622727b5b08c423464

build:
number: 0
number: 1
# Does a very good job of maintaining compatibility.
# https://abi-laboratory.pro/tracker/timeline/libtiff/
# run_exports:
Expand Down
12 changes: 7 additions & 5 deletions recipes/recipes_emscripten/proj/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mkdir -p build

cd build

export LIBS=${BUILD_PREFIX}/include


# to build without curl we need to disable projsync too
emcmake cmake ${CMAKE_ARGS} .. \
Expand All @@ -14,10 +14,12 @@ emcmake cmake ${CMAKE_ARGS} .. \
-DBUILD_TESTING=OFF \
-DENABLE_CURL=OFF \
-DBUILD_PROJSYNC=OFF \
-DSQLite3_INCLUDE_DIR=${LIBS} \
-DSQLite3_LIBRARY=${LIBS} \
-DTIFF_INCLUDE_DIR=${LIBS} \
-DTIFF_LIBRARY=${LIBS} \
-DSQLite3_INCLUDE_DIR=$PREFIX/include \
-DSQLite3_LIBRARY=$PREFIX/lib/libsqlite3.a \
-DTIFF_INCLUDE_DIR=$PREFIX/include \
-DTIFF_LIBRARY=$PREFIX/lib/libtiff.a \
-DCMAKE_PROJECT_INCLUDE=${RECIPE_DIR}/overwriteProp.cmake \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON

emmake make -j${CPU_COUNT} #${VERBOSE_CM}

Expand Down
4 changes: 4 additions & 0 deletions recipes/recipes_emscripten/proj/overwriteProp.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) # does not need to be global :)
set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-s SIDE_MODULE=1")
set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-s SIDE_MODULE=1")
set(CMAKE_STRIP FALSE) # used by default in pybind11 on .so modules # only for needed when using pybind11
3 changes: 0 additions & 3 deletions recipes/recipes_emscripten/proj/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ requirements:
- make
- ${{ compiler('c') }}
- ${{ compiler('cxx') }}
- sqlitecpp
- libtiff
- requests
host:
- sqlitecpp
Expand All @@ -32,7 +30,6 @@ requirements:
tests:
- script:
- test -f ${PREFIX}/include/proj.h
- test -f ${PREFIX}/lib/libproj.a

about:
homepage: https://proj.org/
Expand Down
18 changes: 18 additions & 0 deletions recipes/recipes_emscripten/pyproj/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

# override the wasm-ld command to a wrapper
# otherwise -R gets passed as flag
alias emcc=$PWD"/wasm-ld-wrapper.sh"

# # the binary is needed ....
# cp $BUILD_PREFIX/bin/proj $PREFIX/bin/proj
export PROJ_DIR=$PREFIX

# if version is not set, the python build script
# tries to call the proj binary to get the version
export PROJ_VERSION="9.4.1"

${PYTHON} -m pip install -vv .


# rm $PREFIX/bin/proj
41 changes: 41 additions & 0 deletions recipes/recipes_emscripten/pyproj/recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
context:
name: pyproj
version: 3.6.1

package:
name: ${{ name }}
version: ${{ version }}

source:
url: https://pypi.io/packages/source/p/pyproj/pyproj-${{ version }}.tar.gz
sha256: 44aa7c704c2b7d8fb3d483bbf75af6cb2350d30a63b144279a09b75fead501bf

build:
number: 0

requirements:
build:
- python
- cross-python_${{ target_platform }}
- cython
- ${{ compiler('c') }}
host:
- python
- pip
- proj
run:
- python
- proj
- certifi

about:
homepage: https://github.com/pyproj4/pyproj
license: MIT
license_file:
- LICENSE
- LICENSE_proj
summary: Python interface to PROJ library

extra:
recipe-maintainers:
- KGB99
26 changes: 26 additions & 0 deletions recipes/recipes_emscripten/pyproj/wasm-ld-wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

echo "Using wasm-ld wrapper..."

# Filter out the -R flags from the arguments
filtered_args=()
skip_next=false

for arg in "$@"; do
if [ "$skip_next" = true ]; then
skip_next=false
continue
fi

case "$arg" in
-R)
skip_next=true
;;
*)
filtered_args+=("$arg")
;;
esac
done

# Call the actual wasm-ld command with the filtered arguments
emcc "${filtered_args[@]}"
Loading