diff --git a/.azure-pipelines/azure-pipelines-linux.yml b/.azure-pipelines/azure-pipelines-linux.yml index 2b93a12..aef462c 100755 --- a/.azure-pipelines/azure-pipelines-linux.yml +++ b/.azure-pipelines/azure-pipelines-linux.yml @@ -21,6 +21,7 @@ jobs: UPLOAD_PACKAGES: 'True' DOCKER_IMAGE: quay.io/condaforge/linux-anvil-cos7-x86_64 timeoutInMinutes: 360 + variables: {} steps: # configure qemu binfmt-misc running. This allows us to run docker containers diff --git a/.azure-pipelines/azure-pipelines-osx.yml b/.azure-pipelines/azure-pipelines-osx.yml index f3ff063..730a626 100755 --- a/.azure-pipelines/azure-pipelines-osx.yml +++ b/.azure-pipelines/azure-pipelines-osx.yml @@ -15,6 +15,7 @@ jobs: CONFIG: osx_arm64_ UPLOAD_PACKAGES: 'True' timeoutInMinutes: 360 + variables: {} steps: # TODO: Fast finish on azure pipelines? diff --git a/.ci_support/linux_64_.yaml b/.ci_support/linux_64_.yaml index 59715f0..825cb1d 100644 --- a/.ci_support/linux_64_.yaml +++ b/.ci_support/linux_64_.yaml @@ -4,6 +4,10 @@ c_compiler: - gcc c_compiler_version: - '12' +c_stdlib: +- sysroot +c_stdlib_version: +- '2.12' cdt_name: - cos6 channel_sources: @@ -13,7 +17,7 @@ channel_targets: docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: @@ -24,6 +28,9 @@ target_platform: - linux-64 xz: - '5' +zip_keys: +- - c_stdlib_version + - cdt_name zlib: - '1.2' zstd: diff --git a/.ci_support/linux_aarch64_.yaml b/.ci_support/linux_aarch64_.yaml index f56ba2a..96daef2 100644 --- a/.ci_support/linux_aarch64_.yaml +++ b/.ci_support/linux_aarch64_.yaml @@ -6,6 +6,10 @@ c_compiler: - gcc c_compiler_version: - '12' +c_stdlib: +- sysroot +c_stdlib_version: +- '2.17' cdt_arch: - aarch64 cdt_name: @@ -17,7 +21,7 @@ channel_targets: docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: @@ -28,6 +32,9 @@ target_platform: - linux-aarch64 xz: - '5' +zip_keys: +- - c_stdlib_version + - cdt_name zlib: - '1.2' zstd: diff --git a/.ci_support/linux_ppc64le_.yaml b/.ci_support/linux_ppc64le_.yaml index efd82af..60ea7f5 100644 --- a/.ci_support/linux_ppc64le_.yaml +++ b/.ci_support/linux_ppc64le_.yaml @@ -4,6 +4,10 @@ c_compiler: - gcc c_compiler_version: - '12' +c_stdlib: +- sysroot +c_stdlib_version: +- '2.17' cdt_name: - cos7 channel_sources: @@ -13,7 +17,7 @@ channel_targets: docker_image: - quay.io/condaforge/linux-anvil-cos7-x86_64 libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: @@ -24,6 +28,9 @@ target_platform: - linux-ppc64le xz: - '5' +zip_keys: +- - c_stdlib_version + - cdt_name zlib: - '1.2' zstd: diff --git a/.ci_support/osx_64_.yaml b/.ci_support/osx_64_.yaml index bb00912..897618d 100644 --- a/.ci_support/osx_64_.yaml +++ b/.ci_support/osx_64_.yaml @@ -6,6 +6,10 @@ c_compiler: - clang c_compiler_version: - '16' +c_stdlib: +- macosx_deployment_target +c_stdlib_version: +- '10.9' channel_sources: - conda-forge channel_targets: @@ -13,7 +17,7 @@ channel_targets: libiconv: - '1' libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: diff --git a/.ci_support/osx_arm64_.yaml b/.ci_support/osx_arm64_.yaml index 5ce1697..81a9462 100644 --- a/.ci_support/osx_arm64_.yaml +++ b/.ci_support/osx_arm64_.yaml @@ -6,6 +6,10 @@ c_compiler: - clang c_compiler_version: - '16' +c_stdlib: +- macosx_deployment_target +c_stdlib_version: +- '11.0' channel_sources: - conda-forge channel_targets: @@ -13,7 +17,7 @@ channel_targets: libiconv: - '1' libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: diff --git a/.ci_support/win_64_.yaml b/.ci_support/win_64_.yaml index 27eb748..2fdc570 100644 --- a/.ci_support/win_64_.yaml +++ b/.ci_support/win_64_.yaml @@ -2,12 +2,16 @@ bzip2: - '1' c_compiler: - vs2019 +c_stdlib: +- vs +c_stdlib_version: +- '2019' channel_sources: - conda-forge channel_targets: - conda-forge main libxml2: -- '2.12' +- '2' lz4_c: - 1.9.3 lzo: diff --git a/.gitignore b/.gitignore index c89ecb7..179afe5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,24 @@ -*.pyc +# User content belongs under recipe/. +# Feedstock configuration goes in `conda-forge.yml` +# Everything else is managed by the conda-smithy rerender process. +# Please do not modify + +# Ignore all files and folders in root +* +!/conda-forge.yml + +# Don't ignore any files/folders if the parent folder is 'un-ignored' +# This also avoids warnings when adding an already-checked file with an ignored parent. +!/**/ +# Don't ignore any files/folders recursively in the following folders +!/recipe/** +!/.ci_support/** -build_artifacts +# Since we ignore files/folders recursively, any folders inside +# build_artifacts gets ignored which trips some build systems. +# To avoid that we 'un-ignore' all files/folders recursively +# and only ignore the root build_artifacts folder. +!/build_artifacts/** +/build_artifacts + +*.pyc diff --git a/.scripts/build_steps.sh b/.scripts/build_steps.sh index eba1dfd..899ba03 100755 --- a/.scripts/build_steps.sh +++ b/.scripts/build_steps.sh @@ -34,9 +34,9 @@ CONDARC export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 mamba install --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build boa conda-forge-ci-setup=4 + pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build boa conda-forge-ci-setup=4 + pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" # set up the condarc setup_conda_rc "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}" @@ -57,12 +57,6 @@ if [[ -f "${FEEDSTOCK_ROOT}/LICENSE.txt" ]]; then cp "${FEEDSTOCK_ROOT}/LICENSE.txt" "${RECIPE_ROOT}/recipe-scripts-license.txt" fi -if [[ "${sha:-}" == "" ]]; then - pushd ${FEEDSTOCK_ROOT} - sha=$(git rev-parse HEAD) - popd -fi - if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then if [[ "x${BUILD_OUTPUT_ID:-}" != "x" ]]; then EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --output-id ${BUILD_OUTPUT_ID}" @@ -74,7 +68,7 @@ if [[ "${BUILD_WITH_CONDA_DEBUG:-0}" == 1 ]]; then # Drop into an interactive shell /bin/bash else - conda mambabuild "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ + conda-build "${RECIPE_ROOT}" -m "${CI_SUPPORT}/${CONFIG}.yaml" \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file "${CI_SUPPORT}/clobber_${CONFIG}.yaml" \ --extra-meta flow_run_id="${flow_run_id:-}" remote_url="${remote_url:-}" sha="${sha:-}" diff --git a/.scripts/run_docker_build.sh b/.scripts/run_docker_build.sh index b70ef01..00f377a 100755 --- a/.scripts/run_docker_build.sh +++ b/.scripts/run_docker_build.sh @@ -21,6 +21,12 @@ if [ -z ${FEEDSTOCK_NAME} ]; then export FEEDSTOCK_NAME=$(basename ${FEEDSTOCK_ROOT}) fi +if [[ "${sha:-}" == "" ]]; then + pushd "${FEEDSTOCK_ROOT}" + sha=$(git rev-parse HEAD) + popd +fi + docker info # In order for the conda-build process in the container to write to the mounted diff --git a/.scripts/run_osx_build.sh b/.scripts/run_osx_build.sh index 9259eb9..07dff21 100755 --- a/.scripts/run_osx_build.sh +++ b/.scripts/run_osx_build.sh @@ -26,9 +26,9 @@ export CONDA_SOLVER="libmamba" export CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1 mamba install --update-specs --quiet --yes --channel conda-forge --strict-channel-priority \ - pip mamba conda-build boa conda-forge-ci-setup=4 + pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" mamba update --update-specs --yes --quiet --channel conda-forge --strict-channel-priority \ - pip mamba conda-build boa conda-forge-ci-setup=4 + pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" @@ -81,7 +81,7 @@ else EXTRA_CB_OPTIONS="${EXTRA_CB_OPTIONS:-} --no-test" fi - conda mambabuild ./recipe -m ./.ci_support/${CONFIG}.yaml \ + conda-build ./recipe -m ./.ci_support/${CONFIG}.yaml \ --suppress-variables ${EXTRA_CB_OPTIONS:-} \ --clobber-file ./.ci_support/clobber_${CONFIG}.yaml \ --extra-meta flow_run_id="$flow_run_id" remote_url="$remote_url" sha="$sha" diff --git a/.scripts/run_win_build.bat b/.scripts/run_win_build.bat index 48734de..6d54697 100755 --- a/.scripts/run_win_build.bat +++ b/.scripts/run_win_build.bat @@ -24,7 +24,7 @@ set "CONDA_LIBMAMBA_SOLVER_NO_CHANNELS_FROM_INSTALLED=1" :: Provision the necessary dependencies to build the recipe later echo Installing dependencies -mamba.exe install "python=3.10" pip mamba conda-build boa conda-forge-ci-setup=4 -c conda-forge --strict-channel-priority --yes +mamba.exe install "python=3.10" pip mamba conda-build conda-forge-ci-setup=4 "conda-build>=24.1" -c conda-forge --strict-channel-priority --yes if !errorlevel! neq 0 exit /b !errorlevel! :: Set basic configuration @@ -55,7 +55,7 @@ call :end_group :: Build the recipe echo Building recipe -conda.exe mambabuild "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% +conda-build.exe "recipe" -m .ci_support\%CONFIG%.yaml --suppress-variables %EXTRA_CB_OPTIONS% if !errorlevel! neq 0 exit /b !errorlevel! :: Prepare some environment variables for the upload step diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6b346f5..e5306da 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,5 +4,5 @@ jobs: - template: ./.azure-pipelines/azure-pipelines-linux.yml - - template: ./.azure-pipelines/azure-pipelines-win.yml - - template: ./.azure-pipelines/azure-pipelines-osx.yml \ No newline at end of file + - template: ./.azure-pipelines/azure-pipelines-osx.yml + - template: ./.azure-pipelines/azure-pipelines-win.yml \ No newline at end of file diff --git a/build-locally.py b/build-locally.py index 3f4b7a7..e0d408d 100755 --- a/build-locally.py +++ b/build-locally.py @@ -64,8 +64,9 @@ def verify_config(ns): elif ns.config.startswith("osx"): if "OSX_SDK_DIR" not in os.environ: raise RuntimeError( - "Need OSX_SDK_DIR env variable set. Run 'export OSX_SDK_DIR=SDKs' " - "to download the SDK automatically to 'SDKs/MacOSX.sdk'. " + "Need OSX_SDK_DIR env variable set. Run 'export OSX_SDK_DIR=$PWD/SDKs' " + "to download the SDK automatically to '$PWD/SDKs/MacOSX.sdk'. " + "Note: OSX_SDK_DIR must be set to an absolute path. " "Setting this variable implies agreement to the licensing terms of the SDK by Apple." ) diff --git a/recipe/build_minimal.bat b/recipe/build_minimal.bat new file mode 100644 index 0000000..b610857 --- /dev/null +++ b/recipe/build_minimal.bat @@ -0,0 +1,28 @@ +cmake -B build ^ + -G "Ninja" ^ + -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^ + -D CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS=ON ^ + -D BUILD_SHARED_LIBS=OFF ^ + -D CMAKE_RELEASE_POSTFIX="_static" ^ + -D CMAKE_FIND_LIBRARY_SUFFIXES="static.lib" ^ + -D ENABLE_ZLIB=ON ^ + -D ZLIB_USE_STATIC_LIBS=ON ^ + -D ENABLE_BZip2=ON ^ + -D BZIP2_LIBRARIES="%LIBRARY_LIB%\\bzip2_static.lib" ^ + -D ENABLE_ZSTD=ON ^ + -D ZSTD_LIBRARY="%LIBRARY_LIB%\\zstd_static.lib" ^ + -D ENABLE_LZMA=OFF ^ + -D ENABLE_LZO=OFF ^ + -D ENABLE_CNG=OFF ^ + -D ENABLE_OPENSSL=OFF ^ + -D ENABLE_NETTLE=OFF ^ + -D ENABLE_LIBXML2=OFF ^ + -D ENABLE_EXPAT=OFF ^ + %CMAKE_ARGS% +if %errorlevel% NEQ 0 exit /b %errorlevel% + +cmake --build build --parallel %CPU_COUNT% --verbose +if %errorlevel% NEQ 0 exit /b %errorlevel% + +cmake --install build +if %errorlevel% NEQ 0 exit /b %errorlevel% diff --git a/recipe/meta.yaml b/recipe/meta.yaml index c33c503..e13d6c7 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -20,11 +20,11 @@ source: - patches/0007-CMake-VC9-compatibility-ignore-some-warnings.patch build: - number: 1 + number: 2 outputs: - name: libarchive - script: build_libarchive.sh # [unix] + script: build_libarchive.sh # [unix] script: build_libarchive.bat # [win] build: @@ -59,19 +59,27 @@ outputs: - zlib - zstd test: + requires: + - {{ compiler('c') }} + - cmake + - ninja files: - - test/hello_world.xar + - test/* commands: # Verify pkg-config file is in place. - test -f "${PREFIX}/lib/pkgconfig/libarchive.pc" # [unix] # Verify headers are in place. - - test -f "${PREFIX}/include/archive.h" # [unix] - - test -f "${PREFIX}/include/archive_entry.h" # [unix] + - test -f "${PREFIX}/include/archive.h" # [unix] + - if not exist %LIBRARY_INC%\archive.h (exit 1) # [win] + - test -f "${PREFIX}/include/archive_entry.h" # [unix] + - if not exist %LIBRARY_INC%\archive_entry.h (exit 1) # [win] # Verify libraries are in place. - - test -f "${PREFIX}/lib/libarchive.a" # [unix] - - test -f "${PREFIX}/lib/libarchive${SHLIB_EXT}" # [unix] + - test -f "${PREFIX}/lib/libarchive.a" # [unix] + - test -f "${PREFIX}/lib/libarchive${SHLIB_EXT}" # [unix] + - if not exist %LIBRARY_LIB%\archive.lib (exit 1) # [win] + - if not exist %LIBRARY_BIN%\archive.dll (exit 1) # [win] # Check for commands - bsdcat --version @@ -79,36 +87,57 @@ outputs: - bsdtar --version - bsdtar -tf test/hello_world.xar + # Running a test trying to link to the library + - cmake -G Ninja -S test/ -B build/ -D LIB_NAME="libarchive{{ SHLIB_EXT }}" ${CMAKE_ARGS} # [unix] + - cmake -G Ninja -S test/ -B build/ -D LIB_NAME="archive" %CMAKE_ARGS% # [win] + - cmake --build build/ + - cmake --build build --target test - name: libarchive-minimal-static - script: build_minimal.sh - build: - skip: true # [win] + script: build_minimal.sh # [unix] + script: build_minimal.bat # [win] requirements: build: - {{ compiler('c') }} - - autoconf # [unix] - - automake # [unix] - - libtool # [unix] - - pkg-config # [unix] - - make # [unix] + - autoconf # [unix] + - automake # [unix] + - libtool # [unix] + - pkg-config # [unix] + - make # [unix] + - cmake >=3.24 # [win] + - ninja # [win] host: - - libiconv # [osx] + - libiconv # [osx] - bzip2 - zlib - - zstd + - zstd-static test: + requires: + - {{ compiler('c') }} + - cmake + - ninja + files: + - test/* commands: # Verify pkg-config file is in place. - test -f "${PREFIX}/lib/pkgconfig/libarchive.pc" # [unix] # Verify headers are in place. - - test -f "${PREFIX}/include/archive.h" # [unix] - - test -f "${PREFIX}/include/archive_entry.h" # [unix] + - test -f "${PREFIX}/include/archive.h" # [unix] + - if not exist %LIBRARY_INC%\archive.h (exit 1) # [win] + - test -f "${PREFIX}/include/archive_entry.h" # [unix] + - if not exist %LIBRARY_INC%\archive_entry.h (exit 1) # [win] # Verify libraries are in place. - - test -f "${PREFIX}/lib/libarchive.a" # [unix] + - test -f "${PREFIX}/lib/libarchive.a" # [unix] + - if not exist %LIBRARY_LIB%\archive_static.lib (exit 1) # [win] + + # Running a test trying to link to the library + - cmake -G Ninja -S test/ -B build/ -D LIB_NAME="libarchive.a" ${CMAKE_ARGS} # [unix] + - cmake -G Ninja -S test/ -B build/ -D LIB_NAME="archive_static" %CMAKE_ARGS% # [win] + - cmake --build build/ + - cmake --build build --target test about: home: http://www.libarchive.org/ diff --git a/recipe/test/CMakeLists.txt b/recipe/test/CMakeLists.txt new file mode 100644 index 0000000..da753c2 --- /dev/null +++ b/recipe/test/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.20) + +project(test-libarchive LANGUAGES C) + +add_executable(test-libarchive test.c) + +find_path(libarchive_INCLUDE_DIR NAMES archive.h) +find_library(libarchive_LIBRARY NAMES "${LIB_NAME}") +target_link_libraries(test-libarchive PRIVATE ${libarchive_LIBRARY}) +target_include_directories(test-libarchive PRIVATE ${libarchive_INCLUDE_DIR}) + +# Needed for header Marco to resolve to the correct symbol names +if(WIN32 AND LIB_NAME STREQUAL "archive_static") + target_compile_definitions(test-libarchive PRIVATE LIBARCHIVE_STATIC) +endif() + +# Needed dependency +if(APPLE) + find_package(Iconv REQUIRED) + target_link_libraries(test-libarchive PRIVATE Iconv::Iconv) +endif() + +enable_testing() +add_test(NAME test-libarchive COMMAND test-libarchive) diff --git a/recipe/test/test.c b/recipe/test/test.c new file mode 100644 index 0000000..30c1405 --- /dev/null +++ b/recipe/test/test.c @@ -0,0 +1,8 @@ +#include + +/** Dummy program to test basci compilation and link. */ +int main(int argc, const char **argv) +{ + struct archive *a = archive_read_new(); + return archive_read_free(a); +}