Skip to content

Commit

Permalink
Temporary fixes to support building Dovecot on aarch64-darwin
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiegley committed May 21, 2024
1 parent 8d350fc commit d6debba
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkgs/development/libraries/clucene-core/2.x.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ stdenv.mkDerivation rec {
url = "https://869170.bugs.gentoo.org/attachment.cgi?id=858825";
hash = "sha256-TbAfBKdXh+1HepZc8J6OhK1XGwhwBCMvO8QBDsad998=";
})
] ++ lib.optionals (stdenv.isDarwin && !stdenv.targetPlatform.isx86_64) [
./fix-darwin-aarch64.patch
];

# see https://github.com/macports/macports-ports/commit/236d43f2450c6be52dc42fd3a2bbabbaa5136201
Expand Down
47 changes: 47 additions & 0 deletions pkgs/development/libraries/clucene-core/fix-darwin-aarch64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- a/src/shared/CMakeLists.txt
+++ b/src/shared/CMakeLists.txt
@@ -103,34 +103,20 @@ CHECK_OPTIONAL_FUNCTIONS( wcsupr wcscasecmp wcsicmp wcstoll wprintf lltow
)

#make decisions about which functions to use...
-CHOOSE_FUNCTION(fileHandleStat "fstati64;_fstati64;fstat64;fstat;_fstat")
+CHOOSE_FUNCTION(fileHandleStat "fstat;_fstat")
IF ( _CL_HAVE_FUNCTION_FSTATI64 OR _CL_HAVE_FUNCTION__FSTATI64 OR _CL_HAVE_FUNCTION_FSTAT64 )
SET ( USE_STAT64 1 )
ENDIF ( _CL_HAVE_FUNCTION_FSTATI64 OR _CL_HAVE_FUNCTION__FSTATI64 OR _CL_HAVE_FUNCTION_FSTAT64 )

-IF ( USE_STAT64 )
- CHOOSE_FUNCTION(fileStat "stati64;_stati64;stat64;stat;_stat")
- CHOOSE_FUNCTION(fileSize "filelengthi64;_filelengthi64;filelength;_filelength" "#define fileSize CL_NS(util)::Misc::filelength")
- CHOOSE_FUNCTION(fileSeek "lseeki64;_lseeki64;lseek64;lseek;_lseek")
- CHOOSE_MISC(TYPE_CL_STAT_T
- HAVE_TYPE_CL_STAT_T
- "struct stati64 x\;" "#define cl_stat_t stati64" "stati64"
- "struct _stati64 x\;" "#define cl_stat_t _stati64" "_stati64"
- "struct stat64 x\;" "#define cl_stat_t stat64" "stat64"
- "struct stat x\;" "#define cl_stat_t stat" "stat"
- "struct _stat x\;" "#define cl_stat_t _stat" "_stat"
- )
-ELSE( USE_STAT64 )
- #borland doesn't have a fstat64, so we have to fallback to non 64 bit everything...
- CHOOSE_FUNCTION(fileStat "stat;_stat")
- CHOOSE_FUNCTION(fileSize "filelength;_filelength" "#define fileSize CL_NS(util)::Misc::filelength")
- CHOOSE_FUNCTION(fileSeek "lseek;_lseek")
- CHOOSE_MISC(TYPE_CL_STAT_T
- HAVE_TYPE_CL_STAT_T
- "struct stat x\;" "#define cl_stat_t stat" "stat"
- "struct _stat x\;" "#define cl_stat_t _stat" "_stat"
- )
-ENDIF( USE_STAT64 )
+#borland doesn't have a fstat64, so we have to fallback to non 64 bit everything...
+CHOOSE_FUNCTION(fileStat "stat;_stat")
+CHOOSE_FUNCTION(fileSize "filelength;_filelength" "#define fileSize CL_NS(util)::Misc::filelength")
+CHOOSE_FUNCTION(fileSeek "lseek;_lseek")
+CHOOSE_MISC(TYPE_CL_STAT_T
+ HAVE_TYPE_CL_STAT_T
+ "struct stat x\;" "#define cl_stat_t stat" "stat"
+ "struct _stat x\;" "#define cl_stat_t _stat" "_stat"
+ )

#ftell (and probably soon ftell64) are POSIX standard functions, but tell and
#tell64 are not, so we define fileTell in terms of fileSeek.
8 changes: 8 additions & 0 deletions pkgs/servers/mail/dovecot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ stdenv.mkDerivation rec {
url = "https://salsa.debian.org/debian/dovecot/-/raw/debian/1%252.3.19.1+dfsg1-2/debian/patches/Support-openssl-3.0.patch";
hash = "sha256-PbBB1jIY3jIC8Js1NY93zkV0gISGUq7Nc67Ul5tN7sw=";
})
(fetchpatch {
url = "https://github.com/dovecot/core/commit/6b2eb995da62b8eca9d8f713bd5858d3d9be8062.patch?full_index=1";
hash = "sha256-7XlLDrWlwsWNddSyVdAUPn3eA55NpF//qtPAsIfXJHQ=";
})
(fetchpatch {
url = "https://github.com/dovecot/core/commit/eca7b6b9984dd1cb5fcd28f7ebccaa5301aead1e.patch?full_index=1";
hash = "sha256-s7GpZQySJRavOL8t4BmGYaQSOD+gE7m6Tc3OMHhb3TM=";
})
] ++ lib.optionals stdenv.isDarwin [
# fix timespec calls
./timespec.patch
Expand Down

0 comments on commit d6debba

Please sign in to comment.