diff --git a/recipe/0001-build-Generate-and-install-etc-profile.d-mamba.sh-fo.patch b/recipe/0001-build-Generate-and-install-etc-profile.d-mamba.sh-fo.patch new file mode 100644 index 0000000..ae697d7 --- /dev/null +++ b/recipe/0001-build-Generate-and-install-etc-profile.d-mamba.sh-fo.patch @@ -0,0 +1,71 @@ +From 2adbb72410fa6e481150a4384d556ebfbe82c28e Mon Sep 17 00:00:00 2001 +From: Julien Jerphanion +Date: Fri, 3 Jan 2025 11:36:14 +0100 +Subject: [PATCH] build: Generate and install `etc/profile.d/mamba.sh` for + mamba only + +Signed-off-by: Julien Jerphanion +--- + mamba_package/CMakeLists.txt | 10 --------- + micromamba/CMakeLists.txt | 21 ++++++++++++++++++- + .../etc/profile.d/mamba.sh.in | 0 + 3 files changed, 20 insertions(+), 11 deletions(-) + rename {mamba_package => micromamba}/etc/profile.d/mamba.sh.in (100%) + +diff --git a/mamba_package/CMakeLists.txt b/mamba_package/CMakeLists.txt +index 23a23e95..cf47433a 100644 +--- a/mamba_package/CMakeLists.txt ++++ b/mamba_package/CMakeLists.txt +@@ -38,16 +38,6 @@ target_link_libraries(mamba-package PRIVATE mamba::libmamba) + + set_target_properties(mamba-package PROPERTIES CXX_STANDARD 17) + +-configure_file( +- "${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in" +- "${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh" +-) +- +-install( +- FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh +- DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/profile.d/ +-) +- + install( + TARGETS mamba-package + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +diff --git a/micromamba/CMakeLists.txt b/micromamba/CMakeLists.txt +index a4f2f152..4d313644 100644 +--- a/micromamba/CMakeLists.txt ++++ b/micromamba/CMakeLists.txt +@@ -105,4 +105,23 @@ endif() + # Installation + # ============ + +-install(TARGETS ${mambaexe_targets}) ++# The script are only needed for mamba and not for micromamba ++ ++if(BUILD_SHARED) ++ configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh" ++ ) ++ ++ install( ++ FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh ++ DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/profile.d/ ++ ) ++endif() ++ ++install( ++ TARGETS ${mambaexe_targets} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) +diff --git a/mamba_package/etc/profile.d/mamba.sh.in b/micromamba/etc/profile.d/mamba.sh.in +similarity index 100% +rename from mamba_package/etc/profile.d/mamba.sh.in +rename to micromamba/etc/profile.d/mamba.sh.in +-- +2.47.1 + diff --git a/recipe/0002-build-Only-for-Unix-systems.patch b/recipe/0002-build-Only-for-Unix-systems.patch new file mode 100644 index 0000000..7f9a65c --- /dev/null +++ b/recipe/0002-build-Only-for-Unix-systems.patch @@ -0,0 +1,32 @@ +From 33713ee0b44fea3d4ee78ab40d403bebb0e75daf Mon Sep 17 00:00:00 2001 +From: Julien Jerphanion +Date: Mon, 6 Jan 2025 13:17:03 +0100 +Subject: [PATCH] build: Only for Unix systems + +Signed-off-by: Julien Jerphanion + +Co-authored-by: Klaim +--- + micromamba/CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/micromamba/CMakeLists.txt b/micromamba/CMakeLists.txt +index 4d313644..a75d436d 100644 +--- a/micromamba/CMakeLists.txt ++++ b/micromamba/CMakeLists.txt +@@ -105,9 +105,9 @@ endif() + # Installation + # ============ + +-# The script are only needed for mamba and not for micromamba +- +-if(BUILD_SHARED) ++# This profile script is only needed for mamba on Unix systems. ++if(BUILD_SHARED AND UNIX) ++ message(STATUS "Generating profile script for mamba (i.e. `etc/profile.d/mamba.sh`)") + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in" + "${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh" +-- +2.47.1 + diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 528daa4..c93bf64 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -11,9 +11,12 @@ package: source: url: https://github.com/mamba-org/mamba/archive/refs/tags/{{ release }}.tar.gz sha256: 4960fc5aa617310fb45e309a1bcfeae74085d70782443b1d2882de4400ac6a48 + patches: + - 0001-build-Generate-and-install-etc-profile.d-mamba.sh-fo.patch + - 0002-build-Only-for-Unix-systems.patch build: - number: 1 + number: 2 outputs: - name: libmamba @@ -63,11 +66,13 @@ outputs: test: commands: + - test ! -f "${PREFIX}/etc/profile.d/mamba.sh" # [unix] - test -d ${PREFIX}/include/mamba # [unix] - test -f ${PREFIX}/include/mamba/version.hpp # [unix] - test -f ${PREFIX}/lib/cmake/libmamba/libmambaConfig.cmake # [unix] - test -f ${PREFIX}/lib/cmake/libmamba/libmambaConfigVersion.cmake # [unix] - test -e ${PREFIX}/lib/libmamba${SHLIB_EXT} # [unix] + - if exist %LIBRARY_PREFIX%\etc\profile.d\mamba.sh (exit 1) # [win] - if not exist %LIBRARY_PREFIX%\include\mamba\version.hpp (exit 1) # [win] - if not exist %LIBRARY_PREFIX%\lib\cmake\libmamba\libmambaConfig.cmake (exit 1) # [win] - if not exist %LIBRARY_PREFIX%\lib\cmake\libmamba\libmambaConfigVersion.cmake (exit 1) # [win] @@ -76,8 +81,7 @@ outputs: {% set libmamba_version_split = libmamba_version.split('.') %} - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_MAJOR {{ libmamba_version_split[0] }}" # [unix] - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_MINOR {{ libmamba_version_split[1] }}" # [unix] - # TODO: uncomment for release 2.0.0 - #- cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_PATCH {{ libmamba_version_split[2] }}" # [unix] + - cat $PREFIX/include/mamba/version.hpp | grep "LIBMAMBA_VERSION_PATCH {{ libmamba_version_split[2] }}" # [unix] - name: libmambapy version: {{ libmambapy_version }}