2020-04-02 15:53:14 +00:00
# macos specific cpack stuff goes here
2020-04-14 21:48:33 +00:00
2020-04-18 21:37:09 +00:00
# Here we build lokinet-network-control-panel into 'lokinet-gui.app' in "extra/" where a postinstall
# script will then move it to /Applications/.
2021-01-19 12:39:53 +00:00
set ( LOKINET_GUI_REPO "https://github.com/oxen-io/loki-network-control-panel.git"
2020-04-18 21:37:09 +00:00
C A C H E S T R I N G " C a n b e s e t t o o v e r r i d e t h e d e f a u l t l o k i n e t - g u i g i t r e p o s i t o r y " )
2020-04-20 01:00:33 +00:00
set ( LOKINET_GUI_CHECKOUT "origin/master"
2020-04-18 21:37:09 +00:00
C A C H E S T R I N G " C a n b e s e t t o s p e c i f y a p a r t i c u l a r b r a n c h o r t a g t o b u i l d f r o m L O K I N E T _ G U I _ R E P O " )
2020-04-20 01:00:33 +00:00
set ( MACOS_SIGN_APP "" # FIXME: it doesn't use a Apple Distribution key because WTF knows.
C A C H E S T R I N G " e n a b l e c o d e s i g n i n g o f t h e s t u f f i n s i d e t h e . a p p a n d t h e l o k i n e t b i n a r y - - u s e a ' A p p l e D i s t r i b u t i o n ' key ( or description ) f r o m ` s e c u r i t y f i n d - i d e n t i t y - v ` " )
set ( MACOS_SIGN_PKG ""
C A C H E S T R I N G " e n a b l e c o d e s i g n i n g o f t h e . p k g - - u s e a ' D e v e l o p e r I D I n s t a l l e r ' key ( or description ) f r o m ` s e c u r i t y f i n d - i d e n t i t y - v ` " )
set ( MACOS_NOTARIZE_USER ""
C A C H E S T R I N G " s e t m a c o s n o t a r i z a t i o n u s e r n a m e ; c a n a l s o s e t i t i n ~ / . n o t a r i z a t i o n . c m a k e " )
set ( MACOS_NOTARIZE_PASS ""
C A C H E S T R I N G " s e t m a c o s n o t a r i z a t i o n p a s s w o r d ; c a n a l s o s e t i t i n ~ / . n o t a r i z a t i o n . c m a k e " )
set ( MACOS_NOTARIZE_ASC ""
C A C H E S T R I N G " s e t m a c o s n o t a r i z a t i o n a s c p r o v i d e r ; c a n a l s o s e t i t i n ~ / . n o t a r i z a t i o n . c m a k e " )
2020-04-18 21:37:09 +00:00
include ( ExternalProject )
2020-11-18 21:54:29 +00:00
message ( STATUS "Building UninstallLokinet.app" )
ExternalProject_Add ( lokinet-uninstaller
S O U R C E _ D I R $ { C M A K E _ S O U R C E _ D I R } / c o n t r i b / m a c o s / u n i n s t a l l e r
C M A K E _ A R G S - D C M A K E _ I N S T A L L _ P R E F I X = $ { P R O J E C T _ B I N A R Y _ D I R } - D M A C O S _ S I G N = $ { M A C O S _ S I G N _ A P P }
- D C M A K E _ P R E F I X _ P A T H = $ { C M A K E _ P R E F I X _ P A T H }
)
2020-11-16 12:57:03 +00:00
2020-04-20 01:00:33 +00:00
message ( STATUS "Building LokinetGUI.app from ${LOKINET_GUI_REPO} @ ${LOKINET_GUI_CHECKOUT}" )
2020-04-18 21:37:09 +00:00
2020-11-17 19:22:33 +00:00
if ( NOT BUILD_STATIC_DEPS )
message ( FATAL_ERROR "Building an installer on macos requires -DBUILD_STATIC_DEPS=ON" )
endif ( )
2020-04-18 21:37:09 +00:00
ExternalProject_Add ( lokinet-gui
2021-03-17 11:53:11 +00:00
D E P E N D S o x e n m q : : o x e n m q
2020-04-18 21:37:09 +00:00
G I T _ R E P O S I T O R Y " $ { L O K I N E T _ G U I _ R E P O } "
G I T _ T A G " $ { L O K I N E T _ G U I _ C H E C K O U T } "
2020-04-20 01:00:33 +00:00
C M A K E _ A R G S - D M A C O S _ A P P = O N - D C M A K E _ I N S T A L L _ P R E F I X = $ { P R O J E C T _ B I N A R Y _ D I R } - D M A C O S _ S I G N = $ { M A C O S _ S I G N _ A P P }
2020-11-17 19:22:33 +00:00
- D C M A K E _ P R E F I X _ P A T H = $ { C M A K E _ P R E F I X _ P A T H } - D B U I L D _ S H A R E D _ L I B S = O F F
2021-03-17 11:53:11 +00:00
" - D O X E N M Q _ L I B R A R I E S = $ < T A R G E T _ F I L E : o x e n m q : : o x e n m q > $ < S E M I C O L O N > $ < T A R G E T _ F I L E : l i b z m q > $ < S E M I C O L O N > $ < T A R G E T _ F I L E : s o d i u m > "
" - D O X E N M Q _ I N C L U D E _ D I R S = $ < T A R G E T _ P R O P E R T Y : o x e n m q : : o x e n m q , I N C L U D E _ D I R E C T O R I E S > "
2020-11-16 12:57:03 +00:00
)
2020-04-20 01:00:33 +00:00
2020-04-21 23:37:10 +00:00
install ( PROGRAMS ${ CMAKE_SOURCE_DIR } /contrib/macos/lokinet_uninstall.sh
2020-04-21 03:28:27 +00:00
D E S T I N A T I O N " b i n / "
C O M P O N E N T l o k i n e t )
2020-04-20 01:00:33 +00:00
2020-04-18 21:37:09 +00:00
install ( DIRECTORY ${ PROJECT_BINARY_DIR } /LokinetGUI.app
2020-11-16 20:34:03 +00:00
D E S T I N A T I O N " . . / . . / A p p l i c a t i o n s / L o k i n e t "
2020-04-20 01:00:33 +00:00
U S E _ S O U R C E _ P E R M I S S I O N S
2020-04-16 20:10:06 +00:00
C O M P O N E N T g u i
P A T T E R N " * "
2020-04-18 21:37:09 +00:00
)
2020-04-16 20:10:06 +00:00
2020-11-18 21:54:29 +00:00
install ( DIRECTORY ${ PROJECT_BINARY_DIR } /UninstallLokinet.app
D E S T I N A T I O N " . . / . . / A p p l i c a t i o n s / L o k i n e t "
U S E _ S O U R C E _ P E R M I S S I O N S
C O M P O N E N T g u i
P A T T E R N " * "
)
2020-04-14 21:48:33 +00:00
# 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
2020-11-16 12:57:03 +00:00
$ { C M A K E _ S O U R C E _ D I R } / c o n t r i b / m a c o s / n e t w o r k . l o k i . l o k i n e t . d a e m o n . p l i s t
2020-11-18 22:06:48 +00:00
$ { C M A K E _ S O U R C E _ D I R } / c o n t r i b / m a c o s / l o k i n e t - n e w s y s l o g . c o n f
2020-11-16 12:57:03 +00:00
D E S T I N A T I O N " e x t r a / "
C O M P O N E N T l o k i n e t )
2020-04-16 20:10:06 +00:00
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." )
2020-04-14 21:48:33 +00:00
2020-04-03 14:14:19 +00:00
set ( CPACK_GENERATOR "productbuild" )
2020-04-18 21:51:33 +00:00
set ( CPACK_PACKAGING_INSTALL_PREFIX "/opt/lokinet" )
2020-11-13 16:26:59 +00:00
set ( CPACK_PREINSTALL_LOKINET_SCRIPT ${ CMAKE_SOURCE_DIR } /contrib/macos/preinstall )
2020-04-10 19:17:11 +00:00
set ( CPACK_POSTFLIGHT_LOKINET_SCRIPT ${ CMAKE_SOURCE_DIR } /contrib/macos/postinstall )
2020-04-18 21:37:09 +00:00
2020-10-07 15:21:07 +00:00
set ( CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE.txt" )
2020-04-20 01:00:33 +00:00
set ( CPACK_PRODUCTBUILD_IDENTITY_NAME "${MACOS_SIGN_PKG}" )
if ( MACOS_SIGN_APP )
add_custom_target ( sign ALL
2020-10-07 15:21:07 +00:00
e c h o " S i g n i n g l o k i n e t a n d l o k i n e t - v p n b i n a r i e s "
C O M M A N D c o d e s i g n - s " $ { M A C O S _ S I G N _ A P P } " - - s t r i c t - - o p t i o n s r u n t i m e - - f o r c e - v v v $ < T A R G E T _ F I L E : l o k i n e t > $ < T A R G E T _ F I L E : l o k i n e t - v p n >
D E P E N D S l o k i n e t l o k i n e t - v p n
2020-04-20 01:00:33 +00:00
)
endif ( )
if ( MACOS_SIGN_APP AND MACOS_SIGN_PKG )
2020-04-20 03:28:32 +00:00
if ( NOT MACOS_NOTARIZE_USER )
2020-04-20 01:00:33 +00:00
if ( EXISTS "$ENV{HOME}/.notarization.cmake" )
include ( "$ENV{HOME}/.notarization.cmake" )
endif ( )
endif ( )
2020-04-20 03:28:32 +00:00
if ( MACOS_NOTARIZE_USER AND MACOS_NOTARIZE_PASS AND MACOS_NOTARIZE_ASC )
2020-04-20 01:00:33 +00:00
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 ( )