Add option to drop privileges with pledge(). From https://github.com/mgba-emu/mgba/pull/1271. Index: CMakeLists.txt --- CMakeLists.txt.orig +++ CMakeLists.txt @@ -47,6 +47,7 @@ if(NOT LIBMGBA_ONLY) set(USE_EDITLINE ON CACHE BOOL "Whether or not to enable the CLI-mode debugger") endif() set(USE_GDB_STUB ON CACHE BOOL "Whether or not to enable the GDB stub ARM debugger") + set(USE_PLEDGE_UNVEIL OFF CACHE BOOL "Whether or not to drop privileges with pledge and unveil") set(USE_FFMPEG ON CACHE BOOL "Whether or not to enable FFmpeg support") set(USE_ZLIB ON CACHE BOOL "Whether or not to enable zlib support") set(USE_MINIZIP ON CACHE BOOL "Whether or not to enable external minizip support") @@ -540,6 +541,14 @@ if(USE_GDB_STUB) endif() source_group("Debugger" FILES ${DEBUGGER_SRC}) +if(USE_PLEDGE_UNVEIL) + set(USE_EPOXY OFF) +endif() + +if(USE_PLEDGE_UNVEIL) + list(APPEND FEATURES PLEDGE_UNVEIL) +endif() + if(USE_FFMPEG) list(APPEND FEATURES FFMPEG) if(LIBSWRESAMPLE_FOUND) @@ -1281,6 +1290,7 @@ if(NOT QUIET AND NOT LIBMGBA_ONLY) message(STATUS " CLI debugger: ${USE_EDITLINE}") endif() message(STATUS " GDB stub: ${USE_GDB_STUB}") + message(STATUS " pledge/unveil: ${USE_PLEDGE_UNVEIL}") message(STATUS " GIF/Video recording: ${USE_FFMPEG}") message(STATUS " Screenshot/advanced savestate support: ${USE_PNG}") message(STATUS " ZIP support: ${SUMMARY_ZIP}")