Skip to content

Commit

Permalink
boost_unordered: init at 1.85.1
Browse files Browse the repository at this point in the history
  • Loading branch information
foolnotion committed Sep 3, 2024
1 parent 9be1a0d commit 56bb9c6
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
2 changes: 2 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

boost-hana = pkgs.callPackage ./pkgs/boost-hana { };

boost_unordered = pkgs.callPackage ./pkgs/boost_unordered { };

byte-lite = pkgs.callPackage ./pkgs/byte-lite { };

cmake-init = pkgs.python3Packages.callPackage ./pkgs/cmake-init { };
Expand Down
61 changes: 61 additions & 0 deletions pkgs/boost_unordered/cmake_install_rules.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a29446..5adf5bd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,3 +44,56 @@ if(BUS_INCLUDE_TESTS)
include(CTest)
add_subdirectory(test)
endif()
+
+if(PROJECT_IS_TOP_LEVEL)
+ include(CPack)
+endif()
+
+# install rules
+if(PROJECT_IS_TOP_LEVEL)
+ set(CMAKE_INSTALL_INCLUDEDIR include/boost CACHE PATH "")
+endif()
+
+include(CMakePackageConfigHelpers)
+include(GNUInstallDirs)
+# Allow package maintainers to freely override the path for the configs
+set(package boost_unordered)
+
+install(DIRECTORY include/ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" COMPONENT boost_unordered_Development)
+install(TARGETS boost_unordered EXPORT boost_unorderedTargets INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
+
+write_basic_package_version_file(
+ "${package}ConfigVersion.cmake"
+ COMPATIBILITY SameMajorVersion
+ ARCH_INDEPENDENT
+)
+
+set(
+ boost_unordered_INSTALL_CMAKEDIR "${CMAKE_INSTALL_DATADIR}/${package}"
+ CACHE PATH "CMake package config location relative to the install prefix"
+)
+mark_as_advanced(boost_unordered_INSTALL_CMAKEDIR)
+
+write_file(
+ "${PROJECT_BINARY_DIR}/${package}Config.cmake"
+ "include(\"${CMAKE_CURRENT_LIST_DIR}/${package}Targets.cmake\")"
+)
+
+install(
+ FILES "${PROJECT_BINARY_DIR}/${package}Config.cmake"
+ DESTINATION "${boost_unordered_INSTALL_CMAKEDIR}"
+ COMPONENT boost_unordered_Development
+)
+
+install(
+ FILES "${PROJECT_BINARY_DIR}/${package}ConfigVersion.cmake"
+ DESTINATION "${boost_unordered_INSTALL_CMAKEDIR}"
+ COMPONENT boost_unordered_Development
+)
+
+install(
+ EXPORT boost_unorderedTargets
+ NAMESPACE boost_unordered::
+ DESTINATION "${boost_unordered_INSTALL_CMAKEDIR}"
+ COMPONENT boost_unordered_Development
+)
27 changes: 27 additions & 0 deletions pkgs/boost_unordered/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{ lib, stdenv, fetchFromGitHub, cmake }:

stdenv.mkDerivation rec {
pname = "boost_unordered";
version = "1.85.1";

src = fetchFromGitHub {
owner = "MikePopoloski";
repo = "boost_unordered";
rev = "v${version}";
hash = "sha256-II3LhaZTAmqn0xcWuSF01czy/IGobvpiGAgZ4EjJ6aY=";
};

nativeBuildInputs = [ cmake ];

cmakeFlags = [ "-DBUS_INCLUDE_TESTS=OFF" ];

patches = [ ./cmake_install_rules.patch ];

meta = with lib; {
description = "Standalone version of the boost::unordered library";
homepage = "https://github.com/MikePopoloski/boost_unordered";
license = licenses.boost;
platforms = platforms.all;
#maintainers = with maintainers; [ foolnotion ];
};
}

0 comments on commit 56bb9c6

Please sign in to comment.