Skip to content

Commit

Permalink
improved detection of dependencies on mac
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Jan 5, 2025
1 parent 56036e3 commit ddc97ba
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
21 changes: 12 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,16 @@ install(TARGETS nmail DESTINATION bin)

# Platform specifics
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_compile_definitions(_XOPEN_SOURCE_EXTENDED)
list(APPEND CMAKE_PREFIX_PATH /usr/local/opt/ncurses)
list(APPEND CMAKE_PREFIX_PATH /opt/homebrew/opt/ncurses)
list(APPEND OPENSSL_ROOT_DIR /usr/local/opt/openssl)
list(APPEND OPENSSL_ROOT_DIR /opt/homebrew/opt/openssl)
add_definitions(-D_XOPEN_SOURCE_EXTENDED)
execute_process(COMMAND sh "-c"
"command -v brew &> /dev/null && brew --prefix ncurses 2> /dev/null | tr -d '\n'"
OUTPUT_VARIABLE CMAKE_PREFIX_PATH)
if (EXISTS "${CMAKE_PREFIX_PATH}")
message(STATUS "Ncurses cmake prefix '${CMAKE_PREFIX_PATH}' (detected).")
else()
set(CMAKE_PREFIX_PATH /opt/local)
message(STATUS "Ncurses cmake prefix '${CMAKE_PREFIX_PATH}' (default).")
endif()
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Android")
add_compile_definitions(_XOPEN_SOURCE_EXTENDED)
endif()
Expand Down Expand Up @@ -135,12 +140,10 @@ endif()
set(CURSES_NEED_NCURSES TRUE)
set(CURSES_NEED_WIDE TRUE)
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
target_compile_options(nmail PUBLIC ${NCURSES_CFLAGS})

# Dependency openssl
find_package(OpenSSL REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIR})

# Dependency xapian
find_package(Xapian REQUIRED)
Expand Down Expand Up @@ -229,13 +232,13 @@ endif()

# Includes
target_include_directories(nmail PRIVATE ${LIBETPAN_INCLUDE_DIR} ${XAPIAN_INCLUDE_DIR}
${MAGIC_HEADERS} ${CYRUS_SASL_INCLUDE_DIR}
${MAGIC_HEADERS} ${CYRUS_SASL_INCLUDE_DIR} ${CURSES_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR}
"ext/sqlite_modern_cpp/hdr" "ext/cereal/include" ${LIBUUID_HEADERS}
"ext/cyrus-imap/lib")

# Linking
target_link_libraries(nmail PUBLIC
${CURSES_LIBRARIES} OpenSSL::SSL SQLite::SQLite3
${CURSES_LIBRARIES} ${OPENSSL_SSL_LIBRARY} ${SQLite3_LIBRARIES}
${XAPIAN_LIBRARIES} ${LIBETPAN_LIBRARY} ${CYRUS_SASL_LIBRARY}
${MAGIC_LIBRARY} ${LIBUUID_LIBRARIES}
pthread ${CMAKE_DL_LIBS})
Expand Down
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if [[ "${DEPS}" == "1" ]]; then
fi
elif [ "${OS}" == "Darwin" ]; then
if command -v brew &> /dev/null; then
HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl ncurses xapian sqlite libmagic ossp-uuid || exiterr "deps failed (${OS} brew), exiting."
HOMEBREW_NO_AUTO_UPDATE=1 brew install cmake openssl ncurses xapian sqlite libmagic ossp-uuid || exiterr "deps failed (${OS} brew), exiting."
elif command -v port &> /dev/null; then
sudo port -N install openssl ncurses xapian-core sqlite3 libmagic ossp-uuid || exiterr "deps failed (${OS} port), exiting."
else
Expand Down
2 changes: 1 addition & 1 deletion src/nmail.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NMAIL "1" "January 2025" "nmail 5.3.3" "User Commands"
.TH NMAIL "1" "January 2025" "nmail 5.3.4" "User Commands"
.SH NAME
nmail \- ncurses mail
.SH SYNOPSIS
Expand Down
2 changes: 1 addition & 1 deletion src/version.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include "version.h"

#define NMAIL_VERSION "5.3.3"
#define NMAIL_VERSION "5.3.4"

std::string Version::GetBuildOs()
{
Expand Down

0 comments on commit ddc97ba

Please sign in to comment.