Skip to content

Commit

Permalink
boost181: fix build on 10.4/10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
evanmiller authored and kencu committed Jan 7, 2023
1 parent ae20458 commit b5e1d5f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions devel/boost181/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ platform darwin 8 {
patchfiles-append patch-tiger-availability.diff
}

# posix_memalign introduced in 10.6
platform darwin {
if {${os.major} < 10} {
patchfiles-append patch-boost-aligned-alloc.diff
}
}

# see https://trac.macports.org/wiki/UsingTheRightCompiler
patchfiles-append patch-compiler.diff
post-patch {
Expand Down
17 changes: 17 additions & 0 deletions devel/boost181/files/patch-boost-aligned-alloc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
posix_memalign introduced in 10.6

--- ./boost/align/detail/aligned_alloc_posix.hpp.orig
+++ ./boost/align/detail/aligned_alloc_posix.hpp
@@ -23,8 +23,10 @@
alignment = sizeof(void*);
}
void* p;
- if (::posix_memalign(&p, alignment, size) != 0) {
- p = 0;
+ if (alignment <= 16) {
+ p = ::malloc(size);
+ } else {
+ p = ::valloc(size);
}
return p;
}

0 comments on commit b5e1d5f

Please sign in to comment.