Merge pull request #1983 from jagerman/macos-packaging

Macos packaging
dev
majestrate 3 months ago committed by GitHub
commit d5a2616d6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      .drone.jsonnet
  2. 5
      CMakeLists.txt
  3. 14
      cmake/gui.cmake
  4. 76
      cmake/macos.cmake
  5. 3
      contrib/ci/drone-check-static-libs.sh
  6. 3
      contrib/ci/drone-static-upload.sh
  7. 12
      contrib/mac.sh
  8. 45
      contrib/macos/lokinet_macos_daemon_script.sh
  9. 53
      contrib/macos/lokinet_uninstall.sh
  10. 63
      contrib/macos/mk-icns.sh
  11. 7
      contrib/macos/notarize.py.in
  12. 38
      contrib/macos/postinstall
  13. 46
      contrib/macos/preinstall
  14. 26
      contrib/macos/seticon.swift
  15. 4
      contrib/macos/sign.sh.in
  16. 85
      contrib/macos/uninstaller/CMakeLists.txt
  17. 26
      contrib/macos/uninstaller/icon.svg
  18. 45
      contrib/macos/uninstaller/main.cpp
  19. 1
      daemon/CMakeLists.txt
  20. 4
      daemon/lokinet.swift
  21. 16
      external/CMakeLists.txt
  22. 2
      gui
  23. 9
      llarp/peerstats/peer_db.cpp
  24. 8
      test/CMakeLists.txt

@ -407,6 +407,9 @@ local docs_pipeline(name, image, extra_cmds=[], allow_fail=false) = {
deb_builder(docker_base + 'debian-sid-builder', 'sid', 'debian/sid', arch='arm64'),
// Macos builds:
mac_builder('macOS (Release)'),
mac_builder('macOS (Release)', extra_cmds=[
'../contrib/ci/drone-check-static-libs.sh',
'../contrib/ci/drone-static-upload.sh',
]),
mac_builder('macOS (Debug)', build_type='Debug'),
]

@ -32,7 +32,7 @@ project(lokinet
if(APPLE)
# Apple build number: must be incremented to submit a new build for the same lokinet version,
# should be reset to 0 when the lokinet version increments.
set(LOKINET_APPLE_BUILD 1)
set(LOKINET_APPLE_BUILD 4)
endif()
set(RELEASE_MOTTO "Our Lord And Savior" CACHE STRING "Release motto")
@ -259,7 +259,6 @@ if(WITH_SYSTEMD AND (NOT ANDROID))
endif()
add_subdirectory(external)
include_directories(SYSTEM external/sqlite_orm/include)
if(USE_JEMALLOC AND NOT STATIC_LINK)
pkg_check_modules(JEMALLOC jemalloc IMPORTED_TARGET)
@ -319,6 +318,6 @@ if(NOT TARGET uninstall)
endif()
if(BUILD_PACKAGE)
if(BUILD_PACKAGE AND NOT APPLE)
include(cmake/installer.cmake)
endif()

@ -31,19 +31,19 @@ if (BUILD_GUI)
if(APPLE)
add_custom_target(assemble_gui ALL
DEPENDS assemble lokinet-gui
COMMAND mkdir "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Helpers"
COMMAND cp -a "${PROJECT_SOURCE_DIR}/gui/release/mac/Lokinet-GUI.app" "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Helpers/"
COMMAND mkdir -p "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Resources/en.lproj"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Resources/en.lproj/"
COMMAND cp "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Resources/icon.icns" "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/icon.icns"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/en.lproj/"
COMMAND mkdir "${lokinet_app}/Contents/Helpers"
COMMAND cp -a "${PROJECT_SOURCE_DIR}/gui/release/mac/Lokinet-GUI.app" "${lokinet_app}/Contents/Helpers/"
COMMAND mkdir -p "${lokinet_app}/Contents/Resources/en.lproj"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Resources/en.lproj/"
COMMAND cp "${lokinet_app}/Contents/Resources/icon.icns" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/icon.icns"
COMMAND cp "${PROJECT_SOURCE_DIR}/contrib/macos/InfoPlist.strings" "${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Resources/en.lproj/"
COMMAND /usr/libexec/PlistBuddy
-c "Delete :CFBundleDisplayName"
-c "Add :LSHasLocalizedDisplayName bool true"
-c "Add :CFBundleDevelopmentRegion string en"
-c "Set :CFBundleShortVersionString ${lokinet_VERSION}"
-c "Set :CFBundleVersion ${lokinet_VERSION}.${LOKINET_APPLE_BUILD}"
"${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Helpers/Lokinet-GUI.app/Contents/Info.plist"
"${lokinet_app}/Contents/Helpers/Lokinet-GUI.app/Contents/Info.plist"
)
elseif(WIN32)

@ -14,6 +14,8 @@ if(MACOS_SYSTEM_EXTENSION)
endif()
set(CODESIGN_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet.${default_profile_type}.provisionprofile" CACHE FILEPATH
"Path to a .provisionprofile to use for the main app")
set(CODESIGN_EXT_PROFILE "${PROJECT_SOURCE_DIR}/contrib/macos/lokinet-extension.${default_profile_type}.provisionprofile" CACHE FILEPATH
"Path to a .provisionprofile to use for the lokinet extension")
if(CODESIGN AND NOT CODESIGN_ID)
if(MACOS_SYSTEM_EXTENSION)
@ -59,13 +61,23 @@ else()
endif()
if(NOT CODESIGN_PROFILE)
message(WARNING "Missing a CODESIGN_PROFILE provisioning profile: Apple will most likely log an uninformative error message to the system log and then kill harmless kittens if you try to run the result")
endif()
if(NOT EXISTS "${CODESIGN_PROFILE}")
message(FATAL_ERROR "Provisioning profile ${CODESIGN_PROFILE} does not exist; fix your -DCODESIGN_PROFILE path")
foreach(prof IN ITEMS CODESIGN_PROFILE CODESIGN_EXT_PROFILE)
if(NOT ${prof})
message(WARNING "Missing a ${prof} provisioning profile: Apple will most likely log an uninformative error message to the system log and then kill harmless kittens if you try to run the result")
elseif(NOT EXISTS "${${prof}}")
message(FATAL_ERROR "Provisioning profile ${${prof}} does not exist; fix your -D${prof} path")
endif()
endforeach()
message(STATUS "Using ${CODESIGN_PROFILE} app provisioning profile")
message(STATUS "Using ${CODESIGN_EXT_PROFILE} extension provisioning profile")
set(lokinet_installer "${PROJECT_BINARY_DIR}/Lokinet ${PROJECT_VERSION}")
if(NOT CODESIGN)
set(lokinet_installer "${lokinet_installer}-UNSIGNED")
endif()
message(STATUS "Using ${CODESIGN_PROFILE} provisioning profile")
set(lokinet_app "${lokinet_installer}/Lokinet.app")
if(MACOS_SYSTEM_EXTENSION)
@ -112,6 +124,35 @@ else()
add_custom_target(notarize DEPENDS sign COMMAND "true")
endif()
set(mac_icon "${PROJECT_BINARY_DIR}/lokinet.icns")
add_custom_command(OUTPUT "${mac_icon}"
COMMAND ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg "${mac_icon}"
DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh)
add_custom_target(icon DEPENDS "${mac_icon}")
if(BUILD_PACKAGE)
add_executable(seticon "${PROJECT_SOURCE_DIR}/contrib/macos/seticon.swift")
add_custom_command(OUTPUT "${lokinet_installer}.dmg"
DEPENDS notarize seticon
COMMAND create-dmg
--volname "Lokinet ${PROJECT_VERSION}"
--volicon lokinet.icns
#--background ... FIXME
--text-size 16
--icon-size 128
--window-size 500 300
--icon Lokinet.app 100 100
--hide-extension Lokinet.app
--app-drop-link 350 100
--eula "${PROJECT_SOURCE_DIR}/LICENSE"
--no-internet-enable
"${lokinet_installer}.dmg"
"${lokinet_installer}"
COMMAND ./seticon lokinet.icns "${lokinet_installer}.dmg"
)
add_custom_target(package DEPENDS "${lokinet_installer}.dmg")
endif()
# Called later to set things up, after the main lokinet targets are set up
function(macos_target_setup)
@ -140,12 +181,6 @@ function(macos_target_setup)
$<TARGET_BUNDLE_DIR:lokinet-extension>/Contents/Resources/bootstrap.signed
)
set(mac_icon ${PROJECT_BINARY_DIR}/lokinet.icns)
add_custom_command(OUTPUT ${mac_icon}
COMMAND ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh ${PROJECT_SOURCE_DIR}/contrib/lokinet-mac.svg ${mac_icon}
DEPENDS ${PROJECT_SOURCE_DIR}/contrib/lokinet.svg ${PROJECT_SOURCE_DIR}/contrib/macos/mk-icns.sh)
add_custom_target(icon DEPENDS ${mac_icon})
add_dependencies(lokinet lokinet-extension icon)
@ -162,15 +197,18 @@ function(macos_target_setup)
add_custom_target(assemble ALL
DEPENDS lokinet lokinet-extension icon copy_prov_prof copy_bootstrap
COMMAND rm -rf "${PROJECT_BINARY_DIR}/Lokinet.app"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet> "${PROJECT_BINARY_DIR}/Lokinet.app"
COMMAND mkdir -p "${PROJECT_BINARY_DIR}/Lokinet.app/${lokinet_ext_dir}"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet-extension> "${PROJECT_BINARY_DIR}/Lokinet.app/${lokinet_ext_dir}/"
COMMAND mkdir -p "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Resources"
COMMAND cp -a "${mac_icon}" "${PROJECT_BINARY_DIR}/Lokinet.app/Contents/Resources/icon.icns"
COMMAND rm -rf "${lokinet_app}"
COMMAND mkdir -p "${lokinet_installer}"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet> "${lokinet_app}"
COMMAND mkdir -p "${lokinet_app}/${lokinet_ext_dir}"
COMMAND cp -a $<TARGET_BUNDLE_DIR:lokinet-extension> "${lokinet_app}/${lokinet_ext_dir}/"
COMMAND mkdir -p "${lokinet_app}/Contents/Resources"
COMMAND cp -a "${mac_icon}" "${lokinet_app}/Contents/Resources/icon.icns"
)
if(CODESIGN)
if(BUILD_GUI)
add_dependencies(sign assemble_gui)
else()
add_dependencies(sign assemble)
endif()
endfunction()

@ -7,7 +7,8 @@ set -o errexit
bad=
if [ "$DRONE_STAGE_OS" == "darwin" ]; then
if otool -L daemon/lokinet | grep -Ev '^daemon/lokinet:|^\t(/usr/lib/libSystem\.|/usr/lib/libc\+\+\.|/System/Library/Frameworks/CoreFoundation)'; then
if otool -L llarp/apple/org.lokinet.network-extension.systemextension/Contents/MacOS/org.lokinet.network-extension | \
grep -Ev '^llarp/apple:|^\t(/usr/lib/lib(System\.|c\+\+|objc)|/System/Library/Frameworks/(CoreFoundation|NetworkExtension|Foundation|Network)\.framework'; then
bad=1
fi
elif [ "$DRONE_STAGE_OS" == "linux" ]; then

@ -47,6 +47,9 @@ elif [ -e build-docs ]; then
archive="$base.tar.xz"
cp -av build-docs/docs/mkdocs.yml build-docs/docs/markdown "$base"
tar cJvf "$archive" "$base"
elif [ -e build-mac ]; then
archive="$base.dmg"
mv build-mac/Lokinet*.dmg "$archive"
else
cp -av daemon/lokinet daemon/lokinet-vpn "$base"
cp -av ../contrib/bootstrap/mainnet.signed "$base/bootstrap.signed"

@ -8,7 +8,8 @@
#
set -e
set +x
set -x
if ! [ -f LICENSE ] || ! [ -d llarp ]; then
echo "You need to run this as ./contrib/mac.sh from the top-level lokinet project directory"
fi
@ -24,10 +25,15 @@ cmake \
-DNATIVE_BUILD=OFF \
-DWITH_LTO=ON \
-DCMAKE_BUILD_TYPE=Release \
-DMACOS_SYSTEM_EXTENSION=ON \
-DCODESIGN=ON \
-DBUILD_PACKAGE=ON \
"$@" \
..
ninja -j1
ninja -j1 package
cd ..
echo -e "Build complete, your app is here:\n"
ls -lad $(pwd)/Lokinet.app
ls -lad $(pwd)/build-mac/Lokinet\ *
echo ""

@ -1,45 +0,0 @@
#!/bin/sh
scutil_query()
{
key=$1
scutil<<EOT
open
get $key
d.show
close
EOT
}
SERVICE_GUID=`scutil_query State:/Network/Global/IPv4 \
| grep "PrimaryService" \
| awk '{print $3}'`
SERVICE_NAME=`scutil_query Setup:/Network/Service/$SERVICE_GUID \
| grep "UserDefinedName" \
| awk -F': ' '{print $2}'`
OLD_SERVERS="$(networksetup -getdnsservers "$SERVICE_NAME" \
| tr '\n' ' ' \
| sed 's/ $//')"
# <3 Apple
#
# if there were no explicit DNS servers, this will return:
# "There aren't any DNS Servers set on Ethernet."
# This might be internationalized, so we'll suffice it to see if there's a space
pattern=" |'"
if [[ $OLD_SERVERS =~ $pattern ]]
then
# and when there aren't any explicit servers set, we want to pass the literal
# string "empty"
OLD_SERVERS="empty"
fi
networksetup -setdnsservers "$SERVICE_NAME" 127.0.0.1
trap "networksetup -setdnsservers \"$SERVICE_NAME\" $OLD_SERVERS" INT TERM EXIT
/opt/lokinet/bin/lokinet /var/lib/lokinet/lokinet.ini

@ -1,53 +0,0 @@
#!/bin/sh
set -x
test `whoami` == root || exit 1
# this is for dns tomfoolery
scutil_query()
{
key=$1
scutil<<EOT
open
get $key
d.show
close
EOT
}
# get guid for service
SERVICE_GUID=`scutil_query State:/Network/Global/IPv4 \
| grep "PrimaryService" \
| awk '{print $3}'`
# get name of network service
SERVICE_NAME=`scutil_query Setup:/Network/Service/$SERVICE_GUID \
| grep "UserDefinedName" \
| awk -F': ' '{print $2}'`
# tell dns to be "empty" so that it's reset
networksetup -setdnsservers "$SERVICE_NAME" empty
# Prevent restarting on exit
touch /var/lib/lokinet/suspend-launchd-service
# shut off lokinet gracefully
pgrep lokinet$ && /opt/lokinet/bin/lokinet-vpn --kill
# kill the gui and such
killall LokinetGUI
killall lokinet
# if the launch daemon is there kill it
/bin/launchctl stop network.loki.lokinet.daemon
/bin/launchctl unload /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
# kill it and make sure it's dead
killall -9 lokinet
rm -rf /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
rm -rf /Applications/Lokinet/
rm -rf /Applications/LokinetGUI.app
rm -rf /var/lib/lokinet
rm -rf /usr/local/lokinet/
rm -rf /opt/lokinet
rm -f /etc/newsyslog.d/lokinet.conf

@ -7,10 +7,69 @@ outdir="${out/%.icns/.iconset}"
set -e
# Apple's PNG encoding/decoding is buggy and likes to inject yellow lines, particularly for the
# smaller images. This is apparently a known issue since macOS 11 that apple just doesn't give a
# shit about fixing (https://en.wikipedia.org/wiki/Apple_Icon_Image_format#Known_issues).
#
# So moral of the story: we have to arse around and edit the png to put a tranparent pixel in the
# bottom-left corner but that pixel *must* be different from the preceeding color, otherwise Apple's
# garbage breaks exposing the dumpster fire that lies beneath and drops the blue channel from the
# last pixel (or run of pixels, if they are the same color (ignoring transparency). So, just to be
# consistent, we make *all* 4 corners transparent yellow, because it seems unlikely for our logo to
# have full-on yellow in the corner, and the color itself is irrelevant because it is fully
# transparent.
#
# Why is there so much broken, buggy crap in the macOS core???
no_r_kelly() {
size=$1
last=$((size - 1))
for x in 0 $last; do
for y in 0 $last; do
echo -n "color $x,$y point "
done
done
}
mkdir -p "${outdir}"
for size in 16 32 64 128 256 512 1024; do
convert -background none -resize "${size}x${size}" "$svg" -strip "png32:${outdir}/icon_${size}x${size}.png"
for size in 32 64 128 256 512 1024; do
# Yay Apple thanks for this utter trash OS.
last=$((size - 1))
convert -background none -resize "${size}x${size}" "$svg" \
-fill '#ff00' -draw "$(no_r_kelly $size)" \
-strip "png32:${outdir}/icon_${size}x${size}.png"
done
# Outputs the imagemagick -draw command to color the corner-adjacent pixels as half-transparent
# white. We use this for the 16x16 (the others pick up corner transparency from the svg).
semitransparent_off_corners() {
size=$1
for x in 1 $((size - 2)); do
for y in 0 $((size - 1)); do
echo -n "color $x,$y point "
done
done
for x in 0 $((size -1)); do
for y in 1 $((size - 2)); do
echo -n "color $x,$y point "
done
done
}
# For 16x16 we crop the image to 5/8 of its regular size before resizing which effectively zooms in
# on it a bit because if we resize the full icon it ends up a fuzzy mess, while the crop and resize
# lets us retain some detail of the logo. (We don't do this for the 16x16@2x because that is really
# 32x32 where it retains enough detail).
convert -background none -resize 512x512 "$svg" -gravity Center -extent 320x320 -resize 16x16 \
-fill '#ff00' -draw "$(no_r_kelly 16)" \
-fill '#fff8' -draw "$(semitransparent_off_corners 16)" \
-strip "png32:$outdir/icon_16x16.png"
# Create all the "@2x" versions which are just the double-size versions
rm -f "${outdir}/icon_*@2x.png"
mv "${outdir}/icon_1024x1024.png" "${outdir}/icon_512x512@2x.png"
for size in 16 32 128 256; do
double=$((size * 2))

@ -23,8 +23,8 @@ if not all(("@MACOS_NOTARIZE_USER@", "@MACOS_NOTARIZE_PASS@", "@MACOS_NOTARIZE_A
sys.exit(1)
os.chdir("@PROJECT_BINARY_DIR@")
app = "Lokinet.app"
zipfile = f"{app}.notarize.zip"
app = "@lokinet_app@"
zipfile = f"Lokinet.app.notarize.zip"
print(f"Creating {zipfile} from {app}")
if os.path.exists(zipfile):
os.remove(zipfile)
@ -107,4 +107,7 @@ result = subprocess.run(['xcrun', 'stapler', 'staple', app])
result.check_returncode()
with open("macos-notarized.stamp", 'w'):
pass
print(" success.\n")

@ -1,38 +0,0 @@
#!/bin/sh
PERMS_OWNER=root
PERMS_GROUP=admin
CHOWN=$PERMS_OWNER:$PERMS_GROUP
# set up lokinet data dir
[ -e /var/lib/lokinet/ ] || mkdir /var/lib/lokinet
chown $CHOWN /var/lib/lokinet
chmod g+w /var/lib/lokinet
# mv files copied into $INSTALL_PREFIX/extra/ to their proper locations
mv /opt/lokinet/extra/lokinet_macos_daemon_script.sh /var/lib/lokinet
chown $CHOWN /var/lib/lokinet/lokinet_macos_daemon_script.sh
chmod 770 /var/lib/lokinet/lokinet_macos_daemon_script.sh
mv /opt/lokinet/extra/network.loki.lokinet.daemon.plist /Library/LaunchDaemons/
chown $CHOWN /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
chmod 640 /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
mv /opt/lokinet/extra/lokinet-newsyslog.conf /etc/newsyslog.d/lokinet.conf
chown $CHOWN /etc/newsyslog.d/lokinet.conf
chmod 640 /etc/newsyslog.d/lokinet.conf
# clean up by removing 'extra/' (so long as it's empty)
rmdir /opt/lokinet/extra/
# bootstrap
/opt/lokinet/bin/lokinet-bootstrap mainnet /var/lib/lokinet/bootstrap.signed
chown $CHOWN /var/lib/lokinet/bootstrap.signed
# generate configs
/opt/lokinet/bin/lokinet -g /var/lib/lokinet/lokinet.ini
chown $CHOWN /var/lib/lokinet/lokinet.ini
# register with launchd and start
launchctl load /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
launchctl start network.loki.lokinet.daemon

@ -1,46 +0,0 @@
#!/bin/sh
# this is for dns tomfoolery
scutil_query()
{
key=$1
scutil<<EOT
open
get $key
d.show
close
EOT
}
# get guid for service
SERVICE_GUID=`scutil_query State:/Network/Global/IPv4 \
| grep "PrimaryService" \
| awk '{print $3}'`
# get name of network service
SERVICE_NAME=`scutil_query Setup:/Network/Service/$SERVICE_GUID \
| grep "UserDefinedName" \
| awk -F': ' '{print $2}'`
# tell dns to be "empty" so that it's reset
networksetup -setdnsservers "$SERVICE_NAME" empty
# suspend existing lokinet if it's there
[ -e /var/lib/lokinet ] && touch /var/lib/lokinet/suspend-launchd-service
# kill it
killall lokinet || true
# wait a sec
sleep 1
# make sure it's fucking dead
killall -9 lokinet || true
# check for prexisting lokinet and kill it if it's there
[ -e /Library/LaunchDaemons/network.loki.lokinet.daemon.plist ] && (
launchctl stop network.loki.lokinet.daemon ;
launchctl unload /Library/LaunchDaemons/network.loki.lokinet.daemon.plist ;
rm -rf /Library/LaunchDaemons/network.loki.lokinet.daemon.plist
)
# clear out the install dir beforehand
rm -rf /opt/lokinet

@ -0,0 +1,26 @@
import Foundation
import AppKit
// Apple deprecated their command line tools to set images on things and replaced them with a
// barely-documented swift function. Yay!
// Usage: ./seticon /path/to/my.icns /path/to/some.dmg
let args = CommandLine.arguments
if args.count != 3 {
print("Error: usage: ./seticon /path/to/my.icns /path/to/some.dmg")
exit(1)
}
var icns = args[1]
var dmg = args[2]
var img = NSImage(byReferencingFile: icns)!
if NSWorkspace.shared.setIcon(img, forFile: dmg) {
print("Set \(dmg) icon to \(icns) [\(img.size)]")
} else {
print("Setting icon failed, don't know why")
exit(2)
}

@ -26,7 +26,7 @@ gui_entitlements="@PROJECT_SOURCE_DIR@/gui/node_modules/app-builder-lib/template
ext_entitlements="@PROJECT_SOURCE_DIR@/contrib/macos/lokinet-extension.@LOKINET_ENTITLEMENTS_TYPE@.entitlements.plist"
app_entitlements="@PROJECT_SOURCE_DIR@/contrib/macos/lokinet.@LOKINET_ENTITLEMENTS_TYPE@.entitlements.plist"
SIGN_TARGET="@PROJECT_BINARY_DIR@/Lokinet.app"
SIGN_TARGET="@PROJECT_BINARY_DIR@/Lokinet @PROJECT_VERSION@/Lokinet.app"
for ext in systemextension appex; do
netext="$SIGN_TARGET/@lokinet_ext_dir@/org.lokinet.network-extension.$ext"
@ -70,3 +70,5 @@ if [ "@BUILD_GUI@" == "ON" ]; then
fi
signit "$SIGN_TARGET" "$app_entitlements"
touch "@PROJECT_BINARY_DIR@"/macos-signed.stamp

@ -1,85 +0,0 @@
cmake_minimum_required(VERSION 3.10) # bionic's cmake version
# Has to be set before `project()`, and ignored on non-macos:
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.12 CACHE STRING "macOS deployment target (Apple clang only)")
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
foreach(lang C CXX)
if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER AND NOT CMAKE_${lang}_COMPILER MATCHES ".*/ccache")
message(STATUS "Enabling ccache for ${lang}")
set(CMAKE_${lang}_COMPILER_LAUNCHER ${CCACHE_PROGRAM} CACHE STRING "")
endif()
endforeach()
endif()
set(PROJECT_NAME lokinet-uninstaller)
project(${PROJECT_NAME}
VERSION 0.0.1
DESCRIPTION "lokinet uninstaller for macos"
LANGUAGES CXX)
add_executable(${PROJECT_NAME}
main.cpp)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE
"-framework Security"
Qt5::Core Qt5::Widgets)
set_target_properties(${PROJECT_NAME}
PROPERTIES
CXX_STANDARD 17
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
)
set(MACOS_SIGN ""
CACHE STRING "enable codesigning -- use a 'Apple Distribution' key (or key description) from `security find-identity -v`")
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/mk-icns.sh ${CMAKE_CURRENT_SOURCE_DIR}/icon.svg ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/icon.svg ${CMAKE_CURRENT_SOURCE_DIR}/mk-icns.sh)
target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns)
set_target_properties(${PROJECT_NAME}
PROPERTIES
MACOSX_BUNDLE TRUE
OUTPUT_NAME UninstallLokinet
RESOURCE "${CMAKE_CURRENT_BINARY_DIR}/lokinet-uninstall.icns")
set(MACOSX_BUNDLE_BUNDLE_NAME UninstallLokinet)
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.lokinet.lokinet-uninstaller)
set(MACOSX_BUNDLE_INFO_STRING "Lokinet uninstaller")
set(MACOSX_BUNDLE_ICON_FILE lokinet-uninstall.icns)
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION})
set(MACOSX_BUNDLE_COPYRIGHT "© 2020, The Loki Project")
get_target_property(uic_location Qt5::uic IMPORTED_LOCATION)
get_filename_component(qt_dir ${uic_location} DIRECTORY)
if(MACOS_SIGN)
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND echo "Running qt magic macos deploy script"
COMMAND "${qt_dir}/macdeployqt" UninstallLokinet.app -always-overwrite
COMMAND echo "Signing app bundle and everything inside it"
COMMAND codesign -s "${MACOS_SIGN}" --deep --strict --options runtime --force -vvv UninstallLokinet.app
)
else()
add_custom_command(TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND echo "Running qt magic macos deploy script"
COMMAND "${qt_dir}/macdeployqt" UninstallLokinet.app -always-overwrite
)
endif()
install(TARGETS lokinet-uninstaller
RUNTIME DESTINATION bin
BUNDLE DESTINATION .
RESOURCE DESTINATION .)

@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg data-name="Layer 1" version="1.1" viewBox="0 0 1e3 1e3" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<metadata>
<rdf:RDF>
<cc:Work rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<dc:title>lokinet icon</dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs>
<style type="text/css">.cls-1{fill:#fff;}.cls-2{fill:#6cbe45;}.cls-3{fill:none;stroke:#fff;stroke-linecap:round;stroke-miterlimit:10;stroke-width:9px;}.cls-4{fill:#1c1c1c;}</style>
</defs>
<title>lokinet icon</title>
<circle class="cls-1" cx="500" cy="500" r="500"/>
<path class="cls-2" transform="translate(.02 .11)" d="M502.6,560.44l8,7.34,14.5,13.09c.74.67,1.42,1.38,2.09,2.09L541,595.54a20.87,20.87,0,0,1,0,31l-16.8,15.2a38.3,38.3,0,0,0,4-3.08l94.71-85.73-55.92-50.64Z"/>
<path class="cls-2" transform="translate(.02 .11)" d="m754.35 415.61v-0.52a69.39 69.39 0 0 0-23.13-50.47l-187.92-167.57a20.88 20.88 0 0 1-3.77 26.39l-14.07 12.73c-0.09 0.08-0.16 0.17-0.25 0.25l-25.1 22.71 168.94 150.65-46.22 41.83 116.27 105.29a46.54 46.54 0 0 1 15.28 34.54c0 1.28-0.1 2.55-0.21 3.82a38.26 38.26 0 0 0 0.23-4v-174.88c0-0.26-0.04-0.52-0.05-0.77z"/>
<path class="cls-2" transform="translate(.02 .11)" d="m500 441.68-38.63-35a20.88 20.88 0 0 1 0-31l10.49-9.49 0.35-0.43a37.93 37.93 0 0 1 6.07-5.38 39 39 0 0 0-3.46 2.75l-95.23 86.2 56 50.57z"/>
<path class="cls-2" transform="translate(.02 .11)" d="m460.61 776.35 11.83-10.7a32.29 32.29 0 0 1 2.34-2.34l25-22.59-166.32-148.34 46.15-41.77-118.72-107.23a46.58 46.58 0 0 1-15.31-34.47c0-1.48 0.09-3 0.23-4.43a36.09 36.09 0 0 0-0.25 4.18v174.85a69.42 69.42 0 0 0 23.19 51.75l188.46 168.07a20.86 20.86 0 0 1 3.4-26.98z"/>
<path class="cls-3" transform="translate(.02 .11)" d="m525 422.75"/>
<path class="cls-4" transform="translate(.02 .11)" d="M754.38,591.44A46.54,46.54,0,0,0,739.1,556.9L525.19,363.21c-.24-.22-.51-.41-.76-.62l-10.26-9.29a20.86,20.86,0,0,0-28,0l-7.92,7.16a37.93,37.93,0,0,0-6.07,5.38l-.35.43-10.49,9.49a20.88,20.88,0,0,0,0,31l38.83,35.15,0,0,165.1,149.5-190.51,172a32.29,32.29,0,0,0-2.34,2.34l-11.83,10.7a20.87,20.87,0,0,0,0,30.95l24.82,22.48a20.87,20.87,0,0,0,28,0l41.08-37.17-.08-.08L739,625.91A46.58,46.58,0,0,0,754.38,591.44Z"/>
<path class="cls-4" transform="translate(.02 .11)" d="M541,595.54,527.21,583c-.67-.71-1.35-1.42-2.09-2.09l-14.5-13.09-8.68-7.95-.06,0-167.22-151L525.21,236.42c.09-.08.16-.17.25-.25l14.07-12.73a20.88,20.88,0,0,0,0-31L514.71,170a20.87,20.87,0,0,0-28,0l-41.08,37.18h0L260.85,374.39a46.56,46.56,0,0,0,0,69L445.27,609.91l-.06.05,42.89,39a20.87,20.87,0,0,0,28,0l24.83-22.47A20.87,20.87,0,0,0,541,595.54Z"/>
<path d="m173.66 173.36 646.24 642.31" fill="#f00" stroke="#f00" stroke-linecap="round" stroke-width="50"/>
<path d="m824.02 175.25-648.03 648.03" fill="none" stroke="#f00" stroke-linecap="round" stroke-width="50"/>
</svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

@ -1,45 +0,0 @@
#include <QApplication>
#include <QMessageBox>
#include <CoreFoundation/CoreFoundation.h>
#include <Security/Security.h>
int uninstall();
int main(int argc, char * argv[])
{
QApplication app{argc, argv};
if(QMessageBox::question(nullptr, "Lokinet Uninstaller", "Do You want to uninstall Lokinet?",
QMessageBox::Yes|QMessageBox::No)
== QMessageBox::Yes)
{
QMessageBox msgBox;
const auto retcode = uninstall();
if(retcode == 0)
{
msgBox.setText("Lokinet has been successfully uninstalled, you may now remove the uninstaller if you wish.");
}
else
{
msgBox.setText("Failed to uninstall lokinet");
}
msgBox.exec();
}
return 0;
}
int uninstall()
{
AuthorizationRef authorizationRef;
OSStatus status;
status = AuthorizationCreate(nullptr, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef);
if(status != 0)
return status;
char* tool = "/bin/sh";
char* args[] = {"/opt/lokinet/bin/lokinet_uninstall.sh", nullptr};
FILE* pipe = stdout;
return AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, args, &pipe);
}

@ -2,6 +2,7 @@ set(exetargets lokinet)
if(APPLE)
add_executable(lokinet lokinet.swift)
target_compile_options(lokinet BEFORE PRIVATE -target x86_64-apple-macos${CMAKE_OSX_DEPLOYMENT_TARGET})
else()
add_executable(lokinet lokinet.cpp)
endif()

@ -87,7 +87,9 @@ class LokinetMain: NSObject, NSApplicationDelegate {
providerProtocol.serverAddress = "loki.loki" // Needs to be set to some non-null dummy value
providerProtocol.username = "anonymous"
providerProtocol.providerBundleIdentifier = self.netextBundleId
providerProtocol.enforceRoutes = true
if #available(macOS 11, *) {
providerProtocol.enforceRoutes = true
}
// macos seems to have trouble when this is true, and reports are that this breaks and
// doesn't do what it says on the tin in the first place. Needs more testing.
providerProtocol.includeAllNetworks = false

@ -79,14 +79,16 @@ endif()
add_subdirectory(cxxopts EXCLUDE_FROM_ALL)
add_library(sqlite_orm INTERFACE)
target_include_directories(sqlite_orm SYSTEM INTERFACE sqlite_orm/include)
if(NOT TARGET sqlite3)
add_library(sqlite3 INTERFACE)
pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3)
target_link_libraries(sqlite3 INTERFACE PkgConfig::SQLITE3)
if(WITH_PEERSTATS)
add_library(sqlite_orm INTERFACE)
target_include_directories(sqlite_orm SYSTEM INTERFACE sqlite_orm/include)
if(NOT TARGET sqlite3)
add_library(sqlite3 INTERFACE)
pkg_check_modules(SQLITE3 REQUIRED IMPORTED_TARGET sqlite3)
target_link_libraries(sqlite3 INTERFACE PkgConfig::SQLITE3)
endif()
target_link_libraries(sqlite_orm INTERFACE sqlite3)
endif()
target_link_libraries(sqlite_orm INTERFACE sqlite3)
add_library(uvw INTERFACE)
target_include_directories(uvw INTERFACE uvw/src)

2
gui

@ -1 +1 @@
Subproject commit abcd94814e261ffd88104357e3946201d0d2c8e0
Subproject commit df20623961298cf99fbdafdec70c51f3c2d84354

@ -346,12 +346,13 @@ namespace llarp
{}
void
PeerDb::configure(const RouterConfig& routerConfig)
PeerDb::configure(const RouterConfig&)
{}
bool
PeerDb::shouldFlush(llarp_time_t now)
{}
bool PeerDb::shouldFlush(llarp_time_t)
{
return false;
}
util::StatusObject
PeerDb::ExtractStatus() const

@ -28,8 +28,6 @@ add_executable(testAll
net/test_sock_addr.cpp
nodedb/test_nodedb.cpp
path/test_path.cpp
peerstats/test_peer_db.cpp
peerstats/test_peer_types.cpp
router/test_llarp_router_version.cpp
routing/test_llarp_routing_transfer_traffic.cpp
routing/test_llarp_routing_obtainexitmessage.cpp
@ -48,6 +46,12 @@ add_executable(testAll
test_llarp_encrypted_frame.cpp
test_llarp_router_contact.cpp)
if(WITH_PEERSTATS)
target_sources(testAll PRIVATE
peerstats/test_peer_db.cpp
peerstats/test_peer_types.cpp)
endif()
target_link_libraries(testAll PUBLIC liblokinet Catch2::Catch2)
target_include_directories(testAll PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(WIN32)

Loading…
Cancel
Save