Skip to content

Commit

Permalink
Make depends use self built clang for darwin
Browse files Browse the repository at this point in the history
The configure script in hidapi and libsodium tried to find clang in /usr/bin,
even though the correct prefix was passed in. This sets the correct CC flag.
This was previously undetected, because clang and the sdk where
installed in the global environment.

This also fixes a subsequent error, where IOKIT and CoreFoundation are
not found, again for the reason stated above.
  • Loading branch information
TheCharlatan committed Sep 25, 2018
1 parent 689758d commit 6a78140
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -883,10 +883,14 @@ list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS})

if (HIDAPI_FOUND)
if (APPLE)
find_library(COREFOUNDATION CoreFoundation)
find_library(IOKIT IOKit)
list(APPEND EXTRA_LIBRARIES ${IOKIT})
list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION})
if(DEPENDS)
list(APPEND EXTRA_LIBRARIES "-framework Foundation -framework IOKit")
else()
find_library(COREFOUNDATION CoreFoundation)
find_library(IOKIT IOKit)
list(APPEND EXTRA_LIBRARIES ${IOKIT})
list(APPEND EXTRA_LIBRARIES ${COREFOUNDATION})
endif()
endif()
if (WIN32)
list(APPEND EXTRA_LIBRARIES setupapi)
Expand Down
2 changes: 1 addition & 1 deletion contrib/depends/packages/hidapi-darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ endef

define $(package)_config_cmds
./bootstrap &&\
$($(package)_autoconf) $($(package)_config_opts) RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar"
$($(package)_autoconf) $($(package)_config_opts) RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)"
endef

define $(package)_build_cmds
Expand Down
2 changes: 1 addition & 1 deletion contrib/depends/packages/packages.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ native_packages := native_ccache
wallet_packages=bdb

darwin_native_packages = native_biplist native_ds_store native_mac_alias
darwin_packages += sodium-darwin hidapi-darwin
darwin_packages = sodium-darwin hidapi-darwin

linux_packages = eudev libusb hidapi-linux

Expand Down
3 changes: 2 additions & 1 deletion contrib/depends/packages/sodium-darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ $(package)_file_name=libsodium-$($(package)_version).tar.gz
$(package)_sha256_hash=fb6a9e879a2f674592e4328c5d9f79f082405ee4bb05cb6e679b90afe9e178f4

define $(package)_set_vars
$(package)_build_opts_darwin=OS=Darwin LIBTOOL="$($(package)_libtool)"
$(package)_config_opts=--enable-static
$(package)_config_opts+=--prefix=$(host_prefix)
endef

define $(package)_config_cmds
./autogen.sh &&\
$($(package)_autoconf) $($(package)_config_opts) RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar"
$($(package)_autoconf) $($(package)_config_opts) RANLIB="$(host_prefix)/native/bin/x86_64-apple-darwin11-ranlib" AR="$(host_prefix)/native/bin/x86_64-apple-darwin11-ar" CC="$(host_prefix)/native/bin/$($(package)_cc)"
endef

define $(package)_build_cmds
Expand Down

0 comments on commit 6a78140

Please sign in to comment.