Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.1 - Backport minor fixes and packaging from dev to master #1233

Merged
merged 50 commits into from
Apr 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
cbb08c7
fix make static when TOOLCHAIN isn't set
neuroscr Mar 18, 2020
9ae743a
when we have an inbound session and we do a forward dns lookup
majestrate Mar 28, 2020
0b66441
disable accedental fec in iwp outbound messages
majestrate Mar 23, 2020
9933dad
fix use after move
majestrate Mar 23, 2020
91aa488
remove un needed check
majestrate Mar 23, 2020
dd9c8c9
add bounds check
majestrate Mar 23, 2020
8c84eac
strict check of bounds
majestrate Mar 31, 2020
7406dbc
cpack win32
majestrate Jan 10, 2020
7f59cce
set license
majestrate Jan 10, 2020
eb7ddae
initial lokinet-bootstrap in powershell for windows
majestrate Jan 10, 2020
a0b6357
make installer pull in tuntap driver
majestrate Jan 10, 2020
6c3fab8
update ci for windows installers
majestrate Jan 10, 2020
cf1cb3d
allow fail
majestrate Jan 10, 2020
744acce
update lokinet-bootstrap
majestrate Jan 10, 2020
dbaed61
make gitlab pump out 32 bit installers, no lto for builds as that is …
majestrate Mar 12, 2020
73eef04
move cmake unix down
majestrate Mar 12, 2020
b3eaf92
add mac target for release
majestrate Apr 2, 2020
53bef47
more macos installer bits
majestrate Apr 2, 2020
bc575e1
fix gitlab ci file
majestrate Apr 2, 2020
d3a5032
fix gitlab tag
majestrate Apr 2, 2020
4ce2542
fix gitlab tag (again)
majestrate Apr 2, 2020
7e82a3f
use 64 bit windows target for now
majestrate Apr 3, 2020
fc14c25
fix up cpack for macos
majestrate Apr 3, 2020
0ca8c25
remove god awful "packaging" cruft that is no longer used.
majestrate Apr 3, 2020
012c081
make gitlab mac runner poop out mac pkg builds too
majestrate Apr 3, 2020
7c81c75
static link on macos
majestrate Apr 3, 2020
cc6d4e9
turn off optimizations for releases
majestrate Apr 3, 2020
7ca8400
make apple builds build for older versions and embrace the bitrot
majestrate Apr 6, 2020
230f28f
tinker with release scripts to hopefully appease the apple gods.
majestrate Apr 6, 2020
b630a31
macos post install script that bootstraps, generates configs and regi…
majestrate Apr 10, 2020
8cfc02c
add plist
majestrate Apr 10, 2020
c2fbc28
gut ui-*
majestrate Apr 10, 2020
e80f20e
MacOS installer / runtime nonsense
notlesh Apr 14, 2020
0388a10
Bundle gui in mac installer
notlesh Apr 16, 2020
58133db
Consolidate cmake vars & definitions
jagerman Apr 18, 2020
c9a8c67
Build lokinet-gui with ExternalProject
jagerman Apr 18, 2020
16d2296
Add -DBUILD_PACKAGE=ON to make cpack code opt-in
jagerman Apr 18, 2020
1221a24
Change mac install prefix to /opt/lokinet
jagerman Apr 18, 2020
d65a0c9
Add simple installer readme
jagerman Apr 18, 2020
35197a7
codesigning and notarization
jagerman Apr 20, 2020
44b6cce
Move release motto string into CMakeLists.txt
jagerman Apr 20, 2020
6391f32
Notarize has an "a" in it
jagerman Apr 20, 2020
d49fe81
Pass CMAKE_PREFIX_PATH through to lokinet-gui
jagerman Apr 21, 2020
2036bca
NOTARIZE only has one O
jagerman Apr 21, 2020
b56ff52
Include macos uninstall script
notlesh Apr 21, 2020
dacea9a
Add stapling after notarization
jagerman Apr 21, 2020
b2bd555
Bump version to 0.7.1
jagerman Apr 21, 2020
a75015b
Disable thread safety annotations on AppleClang
jagerman Apr 21, 2020
496451e
Remove unwanted defines
jagerman Apr 21, 2020
47806b4
Handle no-explicitly-set-dns case in launchd script
notlesh Apr 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,32 @@ build:linux_debug:
- build/daemon/lokinet
- build/daemon/lokinetctl


build:win32:
image: ubuntu:bionic
tags:
- linux
stage: build
before_script:
- apt-get update && apt-get install -y build-essential cmake nsis git g++-mingw-w64
script:
- DOWNLOAD_SODIUM=ON IS_NOTIFICATION=1 STATIC_LINK=ON WINDOWS_ARCH=64 make windows
artifacts:
paths:
- build/lokinet-*.exe

build:macos:
tags:
- osx
stage: build
script:
- IS_NOTIFICATION=1 STATIC_LINK=ON DOWNLOAD_SODIUM=ON make mac
artifacts:
paths:
- build/*.pkg
- build/daemon/lokinet


# needs libuv and libcurl
#build:freebsd:
# tags:
Expand Down
43 changes: 43 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,30 @@ matrix:
dist: xenial
env: DOCKER_FILE=docker/gcc-trunk.Dockerfile
services: docker
- name: "native windows debug"
os: windows
env: BUILD_TYPE=Debug
- name: "native windows release"
os: windows
env: BUILD_TYPE=Release
- name: "windows installer"
os: linux
env: MAKE_TARGET=windows STATIC_LINK=ON DOWNLOAD_SODIUM=ON
allow_failures:
- name: "windows installer"
os: linux
env: MAKE_TARGET=windows STATIC_LINK=ON DOWNLOAD_SODIUM=ON
- name: "make windows docker image"
os: linux
dist: xenial
env: DOCKER_FILE=docker/alpine-windows.Dockerfile
services: docker
- name: "native windows debug"
os: windows
env: BUILD_TYPE=Debug
- name: "native windows release"
os: windows
env: BUILD_TYPE=Release
# - name: "native windows debug"
# os: windows
# env: BUILD_TYPE=Debug
Expand All @@ -137,6 +161,25 @@ env:
- STATIC_LINK=OFF

addons:
apt:
packages:
- binutils-gold
- build-essential
- clang-format
- cmake
- curl
- docker-ce
- nsis
- g++-mingw-w64
- g++-mingw-w64-x86-64
- gcc-mingw-w64-base
- git
- libcap-dev
- libcurl4-openssl-dev
- libuv1-dev
- mingw-w64 mingw-w64-common
- ninja-build
- libsodium-dev
homebrew:
update: true
packages:
Expand Down
41 changes: 29 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
cmake_minimum_required(VERSION 3.5.1) # xenial's cmake version
cmake_minimum_required(VERSION 3.10) # bionic's cmake version

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

set(PROJECT_NAME lokinet)
project(${PROJECT_NAME} C CXX)
project(${PROJECT_NAME}
VERSION 0.7.1
DESCRIPTION "lokinet - IP packet onion router"
LANGUAGES C CXX)

set(RELEASE_MOTTO "I'll remember that..." CACHE STRING "Release motto")

add_definitions(-DLLARP_VERSION_MAJOR=${lokinet_VERSION_MAJOR})
add_definitions(-DLLARP_VERSION_MINOR=${lokinet_VERSION_MINOR})
add_definitions(-DLLARP_VERSION_PATCH=${lokinet_VERSION_PATCH})


# Core options
option(USE_AVX2 "enable avx2 code" OFF)
Expand All @@ -30,6 +40,7 @@ option(WARNINGS_AS_ERRORS "treat all warnings as errors. turn off for developmen
option(TRACY_ROOT "include tracy profiler source" OFF)
option(WITH_TESTS "build unit tests" ON)
#option(WITH_SYSTEMD ...) defined below
option(BUILD_PACKAGE "builds extra components for making an installer (with 'make package')" OFF)

include(cmake/target_link_libraries_system.cmake)
include(cmake/add_import_library.cmake)
Expand All @@ -45,12 +56,6 @@ if (STATIC_LINK)
message(STATUS "setting static library suffix search")
endif()

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# No in-source building
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out-of-source build. Create a build directory and run 'cmake ${CMAKE_SOURCE_DIR} [options]'.")

include(cmake/basic_definitions.cmake)

if(MSVC_VERSION)
Expand All @@ -62,9 +67,16 @@ else()
endif(MSVC_VERSION)

include(cmake/solaris.cmake)
include(cmake/unix.cmake)
include(cmake/win32.cmake)
# try detecting the target arch and set the flags needed here

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")

# No in-source building
include(MacroEnsureOutOfSourceBuild)
macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out-of-source build. Create a build directory and run 'cmake ${CMAKE_SOURCE_DIR} [options]'.")

include(cmake/unix.cmake)

if(NOT WIN32)
if(IOS OR ANDROID)
set(NON_PC_TARGET ON)
Expand Down Expand Up @@ -144,7 +156,8 @@ if (NOT MSVC_VERSION)
add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas)
endif()

if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# STREQUAL because AppleClang's libc++ doesn't yet support thread safety annotations
add_compile_options(-Wthread-safety)
endif()

Expand Down Expand Up @@ -223,7 +236,7 @@ endif(JEMALLOC)


find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
if(PKG_CONFIG_FOUND AND LINUX)
pkg_check_modules(SD libsystemd)
# Default WITH_SYSTEMD to true if we found it
option(WITH_SYSTEMD "enable systemd integration for sd_notify" ${SD_FOUND})
Expand Down Expand Up @@ -298,3 +311,7 @@ if (NOT SHADOW)
add_subdirectory(jni)
endif(ANDROID)
endif()

if(BUILD_PACKAGE)
include(cmake/installer.cmake)
endif()
File renamed without changes.
30 changes: 22 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ JAVA_HOME ?= /usr/lib/jvm/default-java

TOOLCHAIN ?=

# 64 for 64bit windows, 32 for 32bit windows
# defaults to 64 bit for now
WINDOWS_ARCH ?= 64

# native avx2 code
AVX2 ?= OFF
# statically link everything
Expand Down Expand Up @@ -132,7 +136,7 @@ ANALYZE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "$(SCA
COVERAGE_CONFIG_CMD = $(shell gecho -n "cd '$(BUILD_ROOT)' && " ; gecho -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DWITH_COVERAGE=yes $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
else
CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) -DUSE_SHELLHOOKS=$(SHELL_HOOKS) -DTRACY_ROOT=$(TRACY_ROOT) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
CONFIG_CMD_WINDOWS = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")
CONFIG_CMD_WINDOWS = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=ON -DUSE_SHELLHOOKS=$(SHELL_HOOKS) $(COMMON_CMAKE_OPTIONS)")

ANALYZE_CONFIG_CMD = $(shell /bin/echo -n "cd '$(BUILD_ROOT)' && " ; /bin/echo -n "$(SCAN_BUILD) cmake -G'$(CMAKE_GEN)' -DCMAKE_CROSSCOMPILING=$(CROSS) $(COMMON_CMAKE_OPTIONS) '$(REPO)'")

Expand Down Expand Up @@ -166,7 +170,7 @@ debug-configure:

release-configure: clean
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'
$(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)'

debug: debug-configure
$(MAKE) -C $(BUILD_ROOT)
Expand Down Expand Up @@ -230,7 +234,7 @@ check: debug
test: check

static-configure: $(LIBUV_PREFIX) $(LIBCURL_PREFIX)
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' ) || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DRELEASE_MOTTO="$(shell cat motto.txt)" -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) -DNATIVE_BUILD=OFF )
(test x$(TOOLCHAIN) = x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DNATIVE_BUILD=OFF ) || (test x$(TOOLCHAIN) != x && $(CONFIG_CMD) -DCMAKE_BUILD_TYPE=Release -DSTATIC_LINK=ON -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DLIBCURL_ROOT='$(LIBCURL_PREFIX)' -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN) -DNATIVE_BUILD=OFF )

static: static-configure
$(MAKE) -C '$(BUILD_ROOT)'
Expand Down Expand Up @@ -271,21 +275,31 @@ android: android-gradle

windows-debug-configure: $(LIBUV_PREFIX)
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD_WINDOWS) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$(LIBUV_PREFIX)
$(CONFIG_CMD_WINDOWS) -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw$(WINDOWS_ARCH).cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$'(LIBUV_PREFIX)' '$(REPO)'

windows-debug: windows-debug-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp '$(BUILD_ROOT)/daemon/lokinet.exe' '$(REPO)/lokinet.exe'

windows-release-configure: $(LIBUV_PREFIX)
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD_WINDOWS) -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw.cmake' -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT=$(LIBUV_PREFIX)
$(CONFIG_CMD_WINDOWS) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -DCMAKE_TOOLCHAIN_FILE='$(REPO)/contrib/cross/mingw$(WINDOWS_ARCH).cmake' -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DWITH_TESTS=OFF '$(REPO)'

windows-release: windows-release-configure
$(MAKE) -C '$(BUILD_ROOT)'
cp '$(BUILD_ROOT)/daemon/lokinet.exe' '$(REPO)/lokinet.exe'
cd '$(BUILD_ROOT)' && cpack -D CPACK_MONOLITHIC_INSTALL=1 -G NSIS ..

windows: windows-release

mac-release-configure: $(LIBUV_PREFIX)
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DNATIVE_BUILD=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_PACKAGE=ON -DCMAKE_ASM_FLAGS='$(ASFLAGS)' -DCMAKE_C_FLAGS='$(CFLAGS)' -DCMAKE_CXX_FLAGS='$(CXXFLAGS)' -DLIBUV_ROOT='$(LIBUV_PREFIX)' -DWITH_TESTS=OFF '$(REPO)'

mac-release: mac-release-configure
$(MAKE) -C '$(BUILD_ROOT)'

windows: windows-debug
mac: mac-release
$(MAKE) -C '$(BUILD_ROOT)' package

abyss: debug
$(ABYSS_EXE)
Expand Down Expand Up @@ -341,7 +355,7 @@ docker-fedora:

debian-configure:
mkdir -p '$(BUILD_ROOT)'
$(CONFIG_CMD) -DDEBIAN=ON -DRELEASE_MOTTO="$(shell cat $(REPO)/motto.txt)" -DCMAKE_BUILD_TYPE=Release
$(CONFIG_CMD) -DDEBIAN=ON -DCMAKE_BUILD_TYPE=Release

debian: debian-configure
$(MAKE) -C '$(BUILD_ROOT)'
Expand Down
16 changes: 16 additions & 0 deletions cmake/installer.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set(CPACK_PACKAGE_VENDOR "lokinet.org")
set(CPACK_PACKAGE_HOMEPAGE_URL "https://lokinet.org/")
set(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/contrib/readme-installer.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt")

if(WIN32)
include(cmake/win32_installer_deps.cmake)
endif()

if(APPLE)
include(cmake/macos_installer_deps.cmake)
endif()


# This must always be last!
include(CPack)
90 changes: 90 additions & 0 deletions cmake/macos_installer_deps.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# macos specific cpack stuff goes here

# Here we build lokinet-network-control-panel into 'lokinet-gui.app' in "extra/" where a postinstall
# script will then move it to /Applications/.

set(LOKINET_GUI_REPO "https://github.com/loki-project/loki-network-control-panel.git"
CACHE STRING "Can be set to override the default lokinet-gui git repository")
set(LOKINET_GUI_CHECKOUT "origin/master"
CACHE STRING "Can be set to specify a particular branch or tag to build from LOKINET_GUI_REPO")
set(MACOS_SIGN_APP "" # FIXME: it doesn't use a Apple Distribution key because WTF knows.
CACHE STRING "enable codesigning of the stuff inside the .app and the lokinet binary -- use a 'Apple Distribution' key (or description) from `security find-identity -v`")
set(MACOS_SIGN_PKG ""
CACHE STRING "enable codesigning of the .pkg -- use a 'Developer ID Installer' key (or description) from `security find-identity -v`")
set(MACOS_NOTARIZE_USER ""
CACHE STRING "set macos notarization username; can also set it in ~/.notarization.cmake")
set(MACOS_NOTARIZE_PASS ""
CACHE STRING "set macos notarization password; can also set it in ~/.notarization.cmake")
set(MACOS_NOTARIZE_ASC ""
CACHE STRING "set macos notarization asc provider; can also set it in ~/.notarization.cmake")

include(ExternalProject)

message(STATUS "Building LokinetGUI.app from ${LOKINET_GUI_REPO} @ ${LOKINET_GUI_CHECKOUT}")

ExternalProject_Add(lokinet-gui
GIT_REPOSITORY "${LOKINET_GUI_REPO}"
GIT_TAG "${LOKINET_GUI_CHECKOUT}"
CMAKE_ARGS -DMACOS_APP=ON -DCMAKE_INSTALL_PREFIX=${PROJECT_BINARY_DIR} -DMACOS_SIGN=${MACOS_SIGN_APP}
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
)



install(FILES ${CMAKE_SOURCE_DIR}/contrib/macos/lokinet_uninstall.sh
DESTINATION "bin/"
COMPONENT lokinet)

install(DIRECTORY ${PROJECT_BINARY_DIR}/LokinetGUI.app
DESTINATION "../../Applications"
USE_SOURCE_PERMISSIONS
COMPONENT gui
PATTERN "*"
)

# copy files that will be later moved by the postinstall script to proper locations
install(FILES ${CMAKE_SOURCE_DIR}/contrib/macos/lokinet_macos_daemon_script.sh
${CMAKE_SOURCE_DIR}/contrib/macos/network.loki.lokinet.daemon.plist
DESTINATION "extra/"
COMPONENT lokinet)

set(CPACK_COMPONENTS_ALL lokinet gui)

set(CPACK_COMPONENT_LOKINET_DISPLAY_NAME "Lokinet Service")
set(CPACK_COMPONENT_LOKINET_DESCRIPTION "Main Lokinet runtime service, managed by Launchd")

set(CPACK_COMPONENT_GUI_DISPLAY_NAME "Lokinet GUI")
set(CPACK_COMPONENT_GUI_DESCRIPTION "Small GUI which provides stats and limited runtime control of the Lokinet service. Resides in the system tray.")

set(CPACK_GENERATOR "productbuild")
set(CPACK_PACKAGING_INSTALL_PREFIX "/opt/lokinet")
set(CPACK_POSTFLIGHT_LOKINET_SCRIPT ${CMAKE_SOURCE_DIR}/contrib/macos/postinstall)

# The GUI is GPLv3, and so the bundled core+GUI must be as well:
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/contrib/gpl-3.0.txt")

set(CPACK_PRODUCTBUILD_IDENTITY_NAME "${MACOS_SIGN_PKG}")

if(MACOS_SIGN_APP)
add_custom_target(sign ALL
echo "Signing lokinet and lokinetctl binaries"
COMMAND codesign -s "${MACOS_SIGN_APP}" --strict --options runtime --force -vvv $<TARGET_FILE:lokinet> $<TARGET_FILE:lokinetctl>
DEPENDS lokinet lokinetctl
)
endif()

if(MACOS_SIGN_APP AND MACOS_SIGN_PKG)
if(NOT MACOS_NOTARIZE_USER)
if(EXISTS "$ENV{HOME}/.notarization.cmake")
include("$ENV{HOME}/.notarization.cmake")
endif()
endif()
if(MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC)
message(STATUS "'notarization' target enabled")
configure_file(${CMAKE_SOURCE_DIR}/contrib/macos/notarize.py.in ${CMAKE_CURRENT_BINARY_DIR}/contrib/notarize.py ESCAPE_QUOTES @ONLY)
file(COPY ${CMAKE_CURRENT_BINARY_DIR}/contrib/notarize.py DESTINATION ${PROJECT_BINARY_DIR} FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
add_custom_target(notarize ./notarize.py)
else()
message(WARNING "Not enable 'notarization' target: signing is enabled but notarization info not provided. Create ~/.notarization.cmake or set cmake parameters directly")
endif()
endif()
5 changes: 5 additions & 0 deletions cmake/unix.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ if(NOT UNIX)
return()
endif()

# because apple means embracing bitrot
if(APPLE)
add_compile_options(-mmacosx-version-min=10.13)
endif()

include(CheckCXXSourceCompiles)
include(CheckLibraryExists)

Expand Down
Loading