Skip to content

Commit

Permalink
Merge pull request #22128 from adibbley/libnvjpeg
Browse files Browse the repository at this point in the history
Add libnvjpeg recipe
  • Loading branch information
jakirkham authored Apr 15, 2023
2 parents 80a360e + e446478 commit 5a01190
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 0 deletions.
5 changes: 5 additions & 0 deletions recipes/libnvjpeg/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if not exist %PREFIX% mkdir %PREFIX%

move lib\x64\* %LIBRARY_LIB%
move bin\* %LIBRARY_BIN%
move include\* %LIBRARY_INC%
33 changes: 33 additions & 0 deletions recipes/libnvjpeg/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash

# Install to conda style directories
[[ -d lib64 ]] && mv lib64 lib
mkdir -p ${PREFIX}/lib
[[ -d pkg-config ]] && mv pkg-config ${PREFIX}/lib/pkgconfig
[[ -d "$PREFIX/lib/pkgconfig" ]] && sed -E -i "s|cudaroot=.+|cudaroot=$PREFIX|g" $PREFIX/lib/pkgconfig/nvjpeg*.pc

[[ ${target_platform} == "linux-64" ]] && targetsDir="targets/x86_64-linux"
[[ ${target_platform} == "linux-ppc64le" ]] && targetsDir="targets/ppc64le-linux"
[[ ${target_platform} == "linux-aarch64" ]] && targetsDir="targets/sbsa-linux"

for i in `ls`; do
[[ $i == "build_env_setup.sh" ]] && continue
[[ $i == "conda_build.sh" ]] && continue
[[ $i == "metadata_conda_debug.yaml" ]] && continue
if [[ $i == "lib" ]] || [[ $i == "include" ]]; then
# Headers and libraries are installed to targetsDir
mkdir -p ${PREFIX}/${targetsDir}
mkdir -p ${PREFIX}/$i
cp -rv $i ${PREFIX}/${targetsDir}
if [[ $i == "lib" ]]; then
for j in "$i"/*.so*; do
# Shared libraries are symlinked in $PREFIX/lib
ln -s ${PREFIX}/${targetsDir}/$j ${PREFIX}/$j
done
fi
else
# Put all other files in targetsDir
mkdir -p ${PREFIX}/${targetsDir}/${PKG_NAME}
cp -rv $i ${PREFIX}/${targetsDir}/${PKG_NAME}
fi
done
2 changes: 2 additions & 0 deletions recipes/libnvjpeg/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
arm_variant_type: # [aarch64]
- sbsa # [aarch64]
148 changes: 148 additions & 0 deletions recipes/libnvjpeg/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
{% set name = "libnvjpeg" %}
{% set version = "12.0.0.28" %}
{% set cuda_version = "12.0" %}
{% set platform = "linux-x86_64" %} # [linux64]
{% set platform = "linux-ppc64le" %} # [ppc64le]
{% set platform = "linux-sbsa" %} # [aarch64]
{% set platform = "windows-x86_64" %} # [win]
{% set target_name = "x86_64-linux" %} # [linux64]
{% set target_name = "ppc64le-linux" %} # [ppc64le]
{% set target_name = "sbsa-linux" %} # [aarch64]
{% set target_name = "x64" %} # [win]
{% set extension = "tar.xz" %} # [not win]
{% set extension = "zip" %} # [win]

package:
name: {{ name|lower }}
version: {{ version }}

source:
url: https://developer.download.nvidia.com/compute/cuda/redist/{{ name }}/{{ platform }}/{{ name }}-{{ platform }}-{{ version }}-archive.{{ extension }}
sha256: ad3380591a4d5b97ab57d10e9bf05e23dee6429ff91ea939423a3b35ee0e35de # [linux64]
sha256: f7136bb691d794c680d77376b306bedb80eeebf687bfa4dc74355fdae5adcebb # [ppc64le]
sha256: 31fd6ee0dccc72f0d583e25b849543551eb4bc49d3285628bf3b17929e09bac1 # [aarch64]
sha256: b7cb56ab2c69e055a4b1ea41653df917153a568ab23fb0d8121e0739011989a8 # [win]

build:
number: 0
skip: true # [osx or win]

test:
commands:
- test -L $PREFIX/lib/libnvjpeg.so.{{ version.split(".")[0] }} # [linux]
- test -L $PREFIX/lib/libnvjpeg.so.{{ version }} # [linux]
- test -L $PREFIX/targets/{{ target_name }}/lib/libnvjpeg.so.{{ version.split(".")[0] }} # [linux]
- test -f $PREFIX/targets/{{ target_name }}/lib/libnvjpeg.so.{{ version }} # [linux]
- if not exist %LIBRARY_BIN%\nvjpeg64_{{ version.split(".")[0] }}.dll exit 1 # [win]

outputs:
- name: libnvjpeg
files:
- lib/libnvjpeg.so.* # [linux]
- targets/{{ target_name }}/lib/libnvjpeg.so.* # [linux]
- Library\bin\nvjpeg*.dll # [win]
requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- arm-variant * {{ arm_variant_type }} # [aarch64]
host:
- cuda-version {{ cuda_version }}
run:
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
run_constrained:
- arm-variant * {{ arm_variant_type }} # [aarch64]
# Tests are defined at the top level, due to package/output name conflicts.
about:
home: https://developer.nvidia.com/nvjpeg
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: nvJPEG native runtime libraries
description: |
nvJPEG native runtime libraries
doc_url: https://docs.nvidia.com/cuda/nvjpeg/index.html

- name: libnvjpeg-dev
build:
run_exports:
- {{ pin_subpackage("libnvjpeg", max_pin="x") }}
files:
- lib/libnvjpeg.so # [linux]
- lib/pkgconfig/nvjpeg*.pc # [linux]
- targets/{{ target_name }}/lib/libnvjpeg.so # [linux]
- targets/{{ target_name }}/lib/stubs/libnvjpeg.so # [linux]
- targets/{{ target_name }}/include/nvjpeg* # [linux]
- Library\include # [win]
- Library\lib\nvjpeg.lib # [win]
requirements:
build:
- arm-variant * {{ arm_variant_type }} # [aarch64]
host:
- cuda-version {{ cuda_version }}
run:
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
- {{ pin_subpackage("libnvjpeg", exact=True) }}
- cuda-cudart-dev
run_constrained:
- arm-variant * {{ arm_variant_type }} # [aarch64]
- libnvjpeg-static >={{ version }} # [linux]
test:
commands:
- test -L $PREFIX/lib/libnvjpeg.so # [linux]
- test -f $PREFIX/lib/pkgconfig/nvjpeg*.pc # [linux]
- test -f $PREFIX/targets/{{ target_name }}/include/nvjpeg.h # [linux]
- test -L $PREFIX/targets/{{ target_name }}/lib/libnvjpeg.so # [linux]
- test -f $PREFIX/targets/{{ target_name }}/lib/stubs/libnvjpeg.so # [linux]
- if not exist %LIBRARY_INC%\nvjpeg.h exit 1 # [win]
- if not exist %LIBRARY_LIB%\nvjpeg.lib exit 1 # [win]
about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: nvJPEG native runtime libraries
description: |
nvJPEG native runtime libraries
doc_url: https://docs.nvidia.com/cuda/nvjpeg/index.html

- name: libnvjpeg-static
build:
skip: True # [not linux]
files:
- targets/{{ target_name }}/lib/libnvjpeg_static.a # [linux]
requirements:
build:
- arm-variant * {{ arm_variant_type }} # [aarch64]
host:
- cuda-version {{ cuda_version }}
run:
- {{ pin_compatible("cuda-version", max_pin="x.x") }}
run_constrained:
- arm-variant * {{ arm_variant_type }} # [aarch64]
test:
commands:
- test -f $PREFIX/targets/{{ target_name }}/lib/libnvjpeg_static.a # [linux]
about:
home: https://developer.nvidia.com/cuda-toolkit
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: nvJPEG native runtime libraries
description: |
nvJPEG native runtime libraries
doc_url: https://docs.nvidia.com/cuda/nvjpeg/index.html

about:
home: https://developer.nvidia.com/nvjpeg
license_file: LICENSE
license: LicenseRef-NVIDIA-End-User-License-Agreement
license_url: https://docs.nvidia.com/cuda/eula/index.html
summary: nvJPEG native runtime libraries
description: |
nvJPEG native runtime libraries
doc_url: https://docs.nvidia.com/cuda/nvjpeg/index.html

extra:
recipe-maintainers:
- adibbley

0 comments on commit 5a01190

Please sign in to comment.