Skip to content

Commit

Permalink
bladeRF: fix breakage caused by 959bda7, by creating a reverse patch …
Browse files Browse the repository at this point in the history
…of the commit in issue and reinstating the prior temporary patch that fixed the issue; addresses ticket https://trac.macports.org/ticket/53480 .
  • Loading branch information
michaelld committed Feb 4, 2017
1 parent bcf2128 commit f6df8c7
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 1 deletion.
7 changes: 6 additions & 1 deletion science/bladeRF/Portfile
Expand Up @@ -19,6 +19,12 @@ platforms darwin
depends_build-append port:pkgconfig
depends_lib-append path:lib/libusb-1.0.dylib:libusb

# temporary patches to fix use of clock_gettime

patchfiles-append \
patch-reverse_b6f62672.diff \
patch-clock_gettime.diff

# do VPATH (out of source tree) build

cmake.out_of_source yes
Expand All @@ -34,7 +40,6 @@ configure.ldflags-delete -L${prefix}/lib
configure.args-append -DVERSION_INFO_OVERRIDE="MacPorts-${version}"

# do not treat compiler warnings as errors

configure.args-append -DTREAT_WARNINGS_AS_ERRORS=OFF

# do not use 'pandoc' even if it is installed
Expand Down
29 changes: 29 additions & 0 deletions science/bladeRF/files/patch-clock_gettime.diff
@@ -0,0 +1,29 @@
--- host/CMakeLists.txt.orig
+++ host/CMakeLists.txt
@@ -152,6 +152,11 @@
${CMAKE_CURRENT_LIST_DIR}/common/include/osx
)

+ # 'clock_gettime' and related are defined on OSX as of 10.12.0 (16.0.0)
+ if(${CMAKE_SYSTEM_VERSION} VERSION_LESS 16.0.0)
+ add_definitions(-D_OSX_NEED_CLOCK_GETTIME)
+ endif()
+
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(BLADERF_OS_WINDOWS 1)

--- host/common/include/osx/clock_gettime.h.orig
+++ host/common/include/osx/clock_gettime.h
@@ -35,10 +35,12 @@
# error "This file is intended for use with OSX systems only."
#endif

+#ifdef _OSX_NEED_CLOCK_GETTIME
typedef int clockid_t;
#define CLOCK_REALTIME 0

int clock_gettime(clockid_t clk_id, struct timespec *tp);
+#endif /* _OSX_NEED_CLOCK_GETTIME */

#ifdef __cplusplus
} /* extern "C" */
35 changes: 35 additions & 0 deletions science/bladeRF/files/patch-reverse_b6f62672.diff
@@ -0,0 +1,35 @@
--- host/common/include/osx/clock_gettime.h.orig
+++ host/common/include/osx/clock_gettime.h
@@ -27,10 +27,6 @@

#include <time.h>

-#include "AvailabilityMacros.h"
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -49,5 +45,3 @@ int clock_gettime(clockid_t clk_id, struct timespec *tp);
#endif

#endif
-
-#endif
--- host/common/src/osx/clock_gettime.c.orig
+++ host/common/src/osx/clock_gettime.c
@@ -1,7 +1,3 @@
-#include "AvailabilityMacros.h"
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
-
/*
* clock_gettime() wrapper for OSX based upon jbenet's github "gist":
* https://gist.github.com/jbenet/1087739
@@ -60,5 +56,3 @@ clock_gettime_out:
return 0;
}
}
-
-#endif

0 comments on commit f6df8c7

Please sign in to comment.