2015-10-24 20:50:21 +00:00
|
|
|
project(darling)
|
|
|
|
|
2016-02-26 09:59:24 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8)
|
2016-02-27 21:11:04 +00:00
|
|
|
enable_language(ASM)
|
|
|
|
|
2017-01-10 17:00:14 +00:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
include(InstallSymlink)
|
|
|
|
|
2015-10-24 20:50:21 +00:00
|
|
|
set(DARLING_TOP_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
|
2016-02-27 21:11:04 +00:00
|
|
|
set(DARLING_NO_EXECUTABLES OFF)
|
2015-11-28 23:16:31 +00:00
|
|
|
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "")
|
|
|
|
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
|
2015-10-24 20:50:21 +00:00
|
|
|
|
2016-02-27 21:11:04 +00:00
|
|
|
if (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "i686|i386")
|
|
|
|
message(FATAL_ERROR "This software can only be built on x86-64 systems")
|
|
|
|
endif (${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "i686|i386")
|
|
|
|
|
2017-01-24 21:22:04 +00:00
|
|
|
#if (NOT BITS)
|
|
|
|
# message(FATAL_ERROR "BITS is not specified (32/64)")
|
|
|
|
#endif (NOT BITS)
|
2016-02-27 21:11:04 +00:00
|
|
|
|
2017-01-24 21:22:04 +00:00
|
|
|
SET(IGNORED_WARNINGS "-Wno-nullability-completeness")
|
2016-12-04 23:19:57 +00:00
|
|
|
|
|
|
|
if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS "3.9")
|
|
|
|
SET(IGNORED_WARNINGS "${IGNORED_WARNINGS} -Wno-expansion-to-defined")
|
|
|
|
endif (${CMAKE_C_COMPILER_ID} STREQUAL "Clang" AND NOT ${CMAKE_C_COMPILER_VERSION} VERSION_LESS "3.9")
|
|
|
|
|
2017-01-24 21:22:04 +00:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${IGNORED_WARNINGS}")
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${IGNORED_WARNINGS}")
|
2016-12-04 23:25:03 +00:00
|
|
|
|
2017-01-24 21:22:04 +00:00
|
|
|
#SET(CMAKE_ASM_FLAGS "-m${BITS}")
|
|
|
|
#SET(CMAKE_ASM-ATT_FLAGS "-m${BITS}")
|
2016-02-27 21:11:04 +00:00
|
|
|
|
|
|
|
message(STATUS "Building for ${CMAKE_SYSTEM_PROCESSOR}, CFLAGS: ${CMAKE_C_FLAGS}, libdir: ${CMAKE_INSTALL_LIBDIR}")
|
|
|
|
|
2016-02-19 23:41:31 +00:00
|
|
|
# --as-needed breaks Darling
|
2017-01-02 20:26:19 +00:00
|
|
|
#set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-as-needed")
|
2016-02-19 23:41:31 +00:00
|
|
|
|
2016-02-27 21:11:04 +00:00
|
|
|
if (BITS EQUAL 32)
|
|
|
|
# Prevent building Darling executables (e.g. Bash)
|
|
|
|
set(DARLING_NO_EXECUTABLES ON)
|
|
|
|
|
|
|
|
SET(SUFFIX "32")
|
|
|
|
add_definitions(-DTARGET_CPU_X86=1 -D__LITTLE_ENDIAN__)
|
|
|
|
set(DARLING_NO_EXECUTABLES ON)
|
|
|
|
|
|
|
|
else()
|
|
|
|
|
|
|
|
set(SUFFIX "64")
|
2017-01-24 21:22:04 +00:00
|
|
|
#add_definitions(-DTARGET_CPU_X86_64=1 -D__LITTLE_ENDIAN__)
|
2016-02-27 21:11:04 +00:00
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2015-11-12 19:45:36 +00:00
|
|
|
enable_language(ASM-ATT)
|
2015-11-18 21:40:24 +00:00
|
|
|
|
2015-11-20 21:24:10 +00:00
|
|
|
option(FRAMEWORK_COREAUDIO "Enable audio-related functionality" OFF)
|
2016-02-12 17:58:28 +00:00
|
|
|
option(FRAMEWORK_APPKIT "Enable AppKit development code" OFF)
|
2015-11-20 21:24:10 +00:00
|
|
|
|
2015-10-24 20:50:21 +00:00
|
|
|
add_subdirectory(src)
|
|
|
|
|
2016-02-27 21:11:04 +00:00
|
|
|
if (NOT DARLING_NO_EXECUTABLES)
|
2017-01-10 08:07:00 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/private)
|
|
|
|
install(DIRECTORY DESTINATION libexec/darling/private/etc)
|
|
|
|
install(DIRECTORY DESTINATION libexec/darling/private/var)
|
|
|
|
InstallSymlink(private/etc ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc)
|
|
|
|
InstallSymlink(private/var ${CMAKE_INSTALL_PREFIX}/libexec/darling/var)
|
|
|
|
InstallSymlink(private/tmp ${CMAKE_INSTALL_PREFIX}/libexec/darling/tmp)
|
|
|
|
|
2016-02-27 21:11:04 +00:00
|
|
|
install(FILES etc/dylib.conf etc/version.conf
|
|
|
|
DESTINATION libexec/darling/etc/darling)
|
2017-01-05 08:08:09 +00:00
|
|
|
install(FILES etc/resolv.conf
|
|
|
|
DESTINATION libexec/darling/etc)
|
2015-10-25 10:22:01 +00:00
|
|
|
|
2017-01-03 21:04:35 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/Volumes)
|
2017-01-02 13:59:24 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/Volumes/SystemRoot)
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/ ${CMAKE_INSTALL_PREFIX}/libexec/darling/Volumes/DarlingEmulatedDrive)
|
2017-01-03 20:59:36 +00:00
|
|
|
|
2017-01-03 21:04:35 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/proc)
|
2017-01-03 20:59:36 +00:00
|
|
|
|
2017-01-03 21:04:35 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/var/root)
|
|
|
|
install(DIRECTORY DESTINATION libexec/darling/var/run)
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/dev/log ${CMAKE_INSTALL_PREFIX}/libexec/darling/var/run/syslog)
|
2017-01-03 20:59:36 +00:00
|
|
|
|
2017-01-03 21:04:35 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/usr)
|
|
|
|
install(DIRECTORY DESTINATION libexec/darling/usr/local)
|
|
|
|
install(DIRECTORY DESTINATION libexec/darling/usr/local/share)
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot${CMAKE_INSTALL_PREFIX}/share/darling ${CMAKE_INSTALL_PREFIX}/libexec/darling/usr/local/share/darling)
|
2017-01-03 20:59:36 +00:00
|
|
|
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot/dev ${CMAKE_INSTALL_PREFIX}/libexec/darling/dev)
|
2017-01-10 08:07:00 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot/tmp ${CMAKE_INSTALL_PREFIX}/libexec/darling/private/tmp)
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot/home ${CMAKE_INSTALL_PREFIX}/libexec/darling/Users)
|
2017-01-12 18:11:14 +00:00
|
|
|
InstallSymlink(Users ${CMAKE_INSTALL_PREFIX}/libexec/darling/home)
|
2017-01-03 20:59:36 +00:00
|
|
|
|
2017-01-04 20:23:36 +00:00
|
|
|
InstallSymlink(/proc/self/mounts ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/mtab)
|
|
|
|
InstallSymlink(/Volumes/SystemRoot/etc/passwd ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/passwd)
|
|
|
|
InstallSymlink(/Volumes/SystemRoot/etc/group ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/group)
|
2017-01-16 15:30:50 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot/etc/localtime ${CMAKE_INSTALL_PREFIX}/libexec/darling/etc/localtime)
|
2017-01-04 20:23:36 +00:00
|
|
|
|
2017-01-01 18:23:39 +00:00
|
|
|
install(DIRECTORY DESTINATION libexec/darling/etc/ld.so.conf.d)
|
|
|
|
install(CODE "execute_process(COMMAND bash ${DARLING_TOP_DIRECTORY}/src/setup-ld-so.sh WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/libexec/darling)")
|
2017-01-04 19:03:22 +00:00
|
|
|
InstallSymlink(/Volumes/SystemRoot/lib ${CMAKE_INSTALL_PREFIX}/libexec/darling/lib)
|
|
|
|
InstallSymlink(/Volumes/SystemRoot/lib64 ${CMAKE_INSTALL_PREFIX}/libexec/darling/lib64)
|
2017-01-01 18:23:39 +00:00
|
|
|
endif (NOT DARLING_NO_EXECUTABLES)
|