Files
mars-nwe/CMakeLists.txt
Mario Fetka b7999fcb7d
All checks were successful
Source release / source-package (push) Successful in 46s
tests: add Linux AFP entry id smoke test
Add an optional Linux-side smoke test for the first implemented NetWare AFP endpoint.

The WebSDK documents NCP 0x2222/35/12 AFP Get Entry ID From Path Name as taking a NetWare directory handle and path string and returning a 32-bit AFP entry id. MARS-NWE now has a guarded implementation of that probe when the optional Netatalk/libatalk backend is compiled in, but exercising it does not require a real AppleTalk workstation.

Use the ncpfs/libncp client library as the test transport. ncpfs is commonly available on Linux mars_nwe test hosts and its NWRequestSimple() helper builds the same length-prefixed subfunction request format used by normal libncp callers. The test accepts standard ncpfs connection options such as -S, -U, -P, and -n, sends NCP 0x23/0x0c, and prints the returned entry id.

Keep the test out of normal builds behind MARS_NWE_BUILD_LINUX_TESTS because it depends on host ncpfs development headers/library and on a running server. Add an --allow-invalid-namespace mode so builds without the Netatalk backend can still run a negative smoke test and verify that AFP remains unavailable.

This adds test infrastructure only and does not change server protocol behavior.
2026-05-30 02:13:59 +02:00

269 lines
9.5 KiB
CMake

cmake_minimum_required(VERSION 3.10)
project(mars_nwe)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
enable_language(C)
SET (VERSION_MAJOR "0")
SET (VERSION_MINOR "99")
SET (VERSION_PATCH "28")
SET (MARS_NWE_VERSION_BASE "${VERSION_MAJOR}.${VERSION_MINOR}.pl${VERSION_PATCH}")
SET (MARS_NWE_VERSION "${MARS_NWE_VERSION_BASE}")
set(MARS_NWE_BUILD_DATE "" CACHE STRING "Mars NWE build date used in server info (DD-Mon-YY)")
if(MARS_NWE_BUILD_DATE STREQUAL "")
string(TIMESTAMP MARS_NWE_BUILD_DATE "%d-%b-%y" UTC)
endif()
find_package(Git QUIET)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
execute_process(
COMMAND "${GIT_EXECUTABLE}" describe --tags --exact-match
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_EXACT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
if(GIT_EXACT_TAG STREQUAL "v${MARS_NWE_VERSION_BASE}" OR
GIT_EXACT_TAG STREQUAL "${MARS_NWE_VERSION_BASE}")
set(MARS_NWE_VERSION "${MARS_NWE_VERSION_BASE}")
else()
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-list --count HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_COUNT
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHORT_SHA
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process(
COMMAND "${GIT_EXECUTABLE}" diff --quiet
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
RESULT_VARIABLE GIT_DIRTY_RESULT
)
set(MARS_NWE_VERSION
"${MARS_NWE_VERSION_BASE}-dev.${GIT_COMMIT_COUNT}-g${GIT_SHORT_SHA}")
if(NOT GIT_DIRTY_RESULT EQUAL 0)
string(APPEND MARS_NWE_VERSION "-dirty")
endif()
endif()
endif()
INCLUDE(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
INCLUDE(${CMAKE_MODULE_PATH}/MarsNweInstallDirs.cmake)
# Add options for build
option(ENABLE_DEBUG "Compile in MARS NWE debug logging code (DO_DEBUG)" OFF)
option(ENABLE_DEBUG_BUILD "Build with debug compiler flags (-g3 -O0 -fno-omit-frame-pointer)" OFF)
option(ENABLE_DEBUG_DOSUTILS "Enable NCP 17/02 debugging support for mars_dosutils" OFF)
option(ENABLE_BURSTMODE "Enable experimental Packet Burst support" ON)
option(MAINTAINER_BUILD "Enable maintainer-only test helpers and diagnostics" OFF)
option(ENABLE_INTERNAL_RIP_SAP "Should we build Mars Nwe with Internal Router?" ON)
option(ENABLE_SHADOW_PWD "Should we build Mars Nwe with Shadow Password Support?" ON)
option(ENABLE_QUOTA_SUPPORT "Should we build Mars Nwe with Quota Support?" ON)
option(ENABLE_XATTR "Should we build Mars Nwe with extended attribute support?" ON)
option(ENABLE_NETATALK_LIBATALK "Enable optional Netatalk/libatalk AFP metadata backend" OFF)
option(MARS_NWE_INSTALL_DOSUTILS "Install DOS client utilities" ON)
option(MARS_NWE_INSTALL_NEW_DOSUTILS "Install the new/experimental DOS client utilities instead of legacy netold.exe" OFF)
option(MARS_NWE_BUILD_DOSUTILS "Build DOS client utilities with Open Watcom" OFF)
option(MARS_NWE_BUILD_LINUX_TESTS "Build optional Linux integration tests using ncpfs/libncp" OFF)
set(MARS_NWE_SMART_ADMIN_GROUP "root" CACHE STRING "Unix group allowed to log in to the SMArT/nwwebui admin interface")
# ENABLE_DEBUG controls the legacy DO_DEBUG code paths used by XDPRINTF().
# ENABLE_DEBUG_BUILD is separate and only changes compiler flags / build type.
# This allows release builds with compiled-in Mars debug logging, and also
# explicit -g/-O0 builds when debugging the server with gdb or valgrind.
if(ENABLE_DEBUG_BUILD)
if(NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
endif()
add_compile_options(
$<$<COMPILE_LANGUAGE:C>:-g3>
$<$<COMPILE_LANGUAGE:C>:-O0>
$<$<COMPILE_LANGUAGE:C>:-fno-omit-frame-pointer>
)
endif()
if(MAINTAINER_BUILD)
add_compile_definitions(MAINTAINER_BUILD)
endif()
if(NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo" "MinSizeRel")
endif()
IF (ENABLE_DEBUG)
SET (MARS_NWE_DEBUG "1")
ELSE (ENABLE_DEBUG)
SET (MARS_NWE_DEBUG "0")
ENDIF (ENABLE_DEBUG)
IF (ENABLE_DEBUG_DOSUTILS)
SET (MARS_NWE_DEBUG_DOSUTILS "1")
ELSE (ENABLE_DEBUG_DOSUTILS)
SET (MARS_NWE_DEBUG_DOSUTILS "0")
ENDIF (ENABLE_DEBUG_DOSUTILS)
IF (ENABLE_BURSTMODE)
SET (MARS_NWE_ENABLE_BURSTMODE "1")
ELSE (ENABLE_BURSTMODE)
SET (MARS_NWE_ENABLE_BURSTMODE "0")
ENDIF (ENABLE_BURSTMODE)
IF (ENABLE_INTERNAL_RIP_SAP)
SET (MARS_NWE_INTERNAL_RIP_SAP "1")
ELSE (ENABLE_INTERNAL_RIP_SAP)
SET (MARS_NWE_INTERNAL_RIP_SAP "0")
ENDIF (ENABLE_INTERNAL_RIP_SAP)
IF (ENABLE_SHADOW_PWD)
SET (MARS_NWE_SHADOW_PWD "1")
ELSE (ENABLE_SHADOW_PWD)
SET (MARS_NWE_SHADOW_PWD "0")
ENDIF (ENABLE_SHADOW_PWD)
find_package(Quota QUIET)
IF (ENABLE_QUOTA_SUPPORT AND QUOTA_FOUND)
SET (MARS_NWE_QUOTA_SUPPORT "1")
ELSE (ENABLE_QUOTA_SUPPORT AND QUOTA_FOUND)
SET (MARS_NWE_QUOTA_SUPPORT "0")
ENDIF (ENABLE_QUOTA_SUPPORT AND QUOTA_FOUND)
find_package(XAttr QUIET)
IF (ENABLE_XATTR AND XATTR_FOUND)
SET (MARS_NWE_XATTR_SUPPORT "1")
ELSE (ENABLE_XATTR AND XATTR_FOUND)
SET (MARS_NWE_XATTR_SUPPORT "0")
ENDIF (ENABLE_XATTR AND XATTR_FOUND)
find_package(Netatalk QUIET)
IF (ENABLE_NETATALK_LIBATALK AND NETATALK_FOUND)
SET (MARS_NWE_NETATALK_SUPPORT "1")
ELSE (ENABLE_NETATALK_LIBATALK AND NETATALK_FOUND)
SET (MARS_NWE_NETATALK_SUPPORT "0")
ENDIF (ENABLE_NETATALK_LIBATALK AND NETATALK_FOUND)
IF (NOT MAX_CONNECTIONS)
SET (MAX_CONNECTIONS "50")
ENDIF (NOT MAX_CONNECTIONS)
IF (NOT MAX_VOLS)
SET (MAX_VOLS "50")
ENDIF (NOT MAX_VOLS)
IF (NOT MAX_FILES)
SET (MAX_FILES "256")
ENDIF (NOT MAX_FILES)
find_package(Crypt REQUIRED)
find_package(GDBM REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(PAM REQUIRED)
find_package(DL REQUIRED)
if(MARS_NWE_QUOTA_SUPPORT)
message(STATUS "Quota support: enabled")
else()
if(ENABLE_QUOTA_SUPPORT)
message(STATUS "Quota support: disabled (required headers/symbols not found)")
else()
message(STATUS "Quota support: disabled")
endif()
endif()
if(MARS_NWE_XATTR_SUPPORT)
message(STATUS "XAttr support: enabled")
else()
message(STATUS "XAttr support: disabled")
endif()
if(MARS_NWE_NETATALK_SUPPORT)
message(STATUS "Netatalk/libatalk AFP metadata backend: enabled")
else()
if(ENABLE_NETATALK_LIBATALK)
message(STATUS "Netatalk/libatalk AFP metadata backend: disabled (headers/library not found)")
else()
message(STATUS "Netatalk/libatalk AFP metadata backend: disabled")
endif()
endif()
# we want to use systemd, if possible
set(SYSTEMD_SERVICES_INSTALL_DIR "" CACHE PATH "Directory for systemd service files")
INCLUDE(${CMAKE_MODULE_PATH}/systemdservice.cmake)
INCLUDE(${CMAKE_MODULE_PATH}/cupsutils.cmake)
message(STATUS "Mars Nwe version: ${MARS_NWE_VERSION}")
message(STATUS "bin: ${CMAKE_INSTALL_FULL_BINDIR}")
message(STATUS "sbin: ${CMAKE_INSTALL_FULL_SBINDIR}")
message(STATUS "lib: ${CMAKE_INSTALL_FULL_LIBDIR}")
message(STATUS "include: ${CMAKE_INSTALL_FULL_INCLUDEDIR}")
message(STATUS "libexec: ${CMAKE_INSTALL_FULL_LIBEXECDIR}")
message(STATUS "doc: ${CMAKE_INSTALL_FULL_DOCDIR}")
message(STATUS "man: ${CMAKE_INSTALL_FULL_MANDIR}")
message(STATUS "sysconf: ${CMAKE_INSTALL_FULL_SYSCONFDIR}")
message(STATUS "Mars Nwe libexec: ${MARS_NWE_INSTALL_FULL_LIBEXECDIR}")
message(STATUS "Mars Nwe config: ${MARS_NWE_INSTALL_FULL_CONFDIR}")
message(STATUS "Mars Nwe data: ${MARS_NWE_DATA_DIR}")
message(STATUS "Mars Nwe log: ${MARS_NWE_LOG_DIR}")
message(STATUS "Mars Nwe pid: ${MARS_NWE_PID_DIR}")
message(STATUS "SMArT admin group: ${MARS_NWE_SMART_ADMIN_GROUP}")
message(STATUS "Install DOS utilities: ${MARS_NWE_INSTALL_DOSUTILS}")
message(STATUS "Install new DOS utilities: ${MARS_NWE_INSTALL_NEW_DOSUTILS}")
message(STATUS "Build DOS utilities: ${MARS_NWE_BUILD_DOSUTILS}")
message(STATUS "Maintainer build: ${MAINTAINER_BUILD}")
message(STATUS "Packet Burst support: ${ENABLE_BURSTMODE}")
# put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake")
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(opt)
add_subdirectory(sys)
if(MARS_NWE_BUILD_LINUX_TESTS)
add_subdirectory(tests/linux)
endif()
add_subdirectory(dosutils)
add_subdirectory(mail)
add_subdirectory(smart)
add_subdirectory(admin)
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MARtin Stovers NetWare-Emulator.")
SET(CPACK_PACKAGE_VENDOR "http://www.compu-art.de/mars_nwe/")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README")
SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "pl${VERSION_PATCH}")
set(CPACK_SOURCE_GENERATOR "TBZ2")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "mars_nwe-${MARS_NWE_VERSION}")
SET(CPACK_SOURCE_IGNORE_FILES "/build/" "/_build/" CMakeCache.txt CMakeFiles progress.make cmake_install.cmake CPackConfig.cmake CPackSourceConfig.cmake "\\\\.git" "\\\\.svn" "\\\\.swp$" "\\\\.cvs" "\\\\.tar.gz" "\\\\.o")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${MARS_NWE_VERSION}")
include(CPack)