Skip to content

Commit

Permalink
(#23387) macdylibbundler: Add build tool for macOS
Browse files Browse the repository at this point in the history
* Add recipe for macdylibbundler

* Use can_run guard for test_package
  • Loading branch information
irieger authored Apr 6, 2024
1 parent cb97391 commit f381f79
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/macdylibbundler/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"1.0.5":
url: "https://github.com/auriamg/macdylibbundler/archive/refs/tags/1.0.5.tar.gz"
sha256: "13384ebe7ca841ec392ac49dc5e50b1470190466623fa0e5cd30f1c634858530"
50 changes: 50 additions & 0 deletions recipes/macdylibbundler/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
from conan import ConanFile
from conan.tools.apple import is_apple_os
from conan.tools.files import copy, get
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
from conan.errors import ConanInvalidConfiguration

import os

required_conan_version = ">=1.53.0"


class MacDylibBundlerConan(ConanFile):
name = "macdylibbundler"
package_type = "application"
description = (
"mac dylib bundler is a tool for use when bundling mac applications"
)
topics = ("build", "dylib", "installer", "mac")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/auriamg/macdylibbundler"
license = "MIT"
settings = "os", "arch", "build_type"

def layout(self):
cmake_layout(self, src_folder="src")

def validate(self):
if not is_apple_os(self):
raise ConanInvalidConfiguration("This tool is for macOS only")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

def generate(self):
tc = CMakeToolchain(self)
tc.generate()

def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()

def package(self):
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
# The CMakeLists.txt misses the install command, so for simplicity the executable is copied manually
copy(self, "dylibbundler", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"))

def package_info(self):
self.cpp_info.includedirs = []
self.cpp_info.libdirs = []
15 changes: 15 additions & 0 deletions recipes/macdylibbundler/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from conan import ConanFile
from conan.tools.build import can_run


class TestPackageConan(ConanFile):
settings = "os", "arch", "build_type"
generators = "VirtualBuildEnv"
test_type = "explicit"

def build_requirements(self):
self.tool_requires(self.tested_reference_str)

def test(self):
if can_run(self):
self.run("dylibbundler -h")
3 changes: 3 additions & 0 deletions recipes/macdylibbundler/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"1.0.5":
folder: all

0 comments on commit f381f79

Please sign in to comment.