move default configs to assets directory

This commit is contained in:
ReenigneArcher 2022-08-12 16:00:19 -04:00
commit 30c178baa1
No known key found for this signature in database
GPG key ID: 0CA6A47B0630EA9B
10 changed files with 6 additions and 63 deletions

View file

@ -255,12 +255,10 @@ jobs:
- type: cpack
CMAKE_INSTALL_PREFIX: '/usr'
SUNSHINE_ASSETS_DIR: 'local/sunshine/assets'
SUNSHINE_CONFIG_DIR: 'local/sunshine/config'
EXTRA_ARGS: ''
- type: appimage
CMAKE_INSTALL_PREFIX: '/usr'
SUNSHINE_ASSETS_DIR: 'sunshine.AppImage.config'
SUNSHINE_CONFIG_DIR: 'sunshine.AppImage.home'
EXTRA_ARGS: '-DSUNSHINE_CONFIGURE_APPIMAGE=ON'
steps:
@ -345,7 +343,6 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${{ matrix.CMAKE_INSTALL_PREFIX }} \
-DSUNSHINE_ASSETS_DIR=${{ matrix.SUNSHINE_ASSETS_DIR }} \
-DSUNSHINE_CONFIG_DIR=${{ matrix.SUNSHINE_CONFIG_DIR }} \
-DSUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-DSUNSHINE_ENABLE_WAYLAND=ON \
-DSUNSHINE_ENABLE_X11=ON \
@ -383,9 +380,9 @@ jobs:
# portable home and config
# todo - this is ugly... we should use a custom AppRun script to take care of this
mv ./AppDir${{ matrix.CMAKE_INSTALL_PREFIX }}/sunshine.AppImage.* ../artifacts/
mkdir -p ../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_CONFIG_DIR }}
cp ../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/apps.json \
../artifacts/${{ matrix.SUNSHINE_CONFIG_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_CONFIG_DIR }}/
mkdir -p ../artifacts/${{ matrix.SUNSHINE_ASSETS_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_ASSETS_DIR }}
cp ../artifacts/${{ matrix.SUNSHINE_ASSETS_DIR }}/apps.json \
../artifacts/${{ matrix.SUNSHINE_ASSETS_DIR }}/.config/sunshine/${{ matrix.SUNSHINE_ASSETS_DIR }}/
# variables
DESKTOP_FILE="${DESKTOP_FILE:-sunshine.desktop}"
@ -479,7 +476,6 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DSUNSHINE_ASSETS_DIR=local/sunshine/assets \
-DSUNSHINE_CONFIG_DIR=local/sunshine/config \
..
make -j ${nproc}
@ -770,7 +766,6 @@ jobs:
cd build
cmake -DCMAKE_BUILD_TYPE=Release \
-DSUNSHINE_ASSETS_DIR=assets \
-DSUNSHINE_CONFIG_DIR=config \
-G "MinGW Makefiles" \
..
mingw32-make -j2

View file

@ -425,13 +425,8 @@ if(NOT SUNSHINE_ASSETS_DIR)
set(SUNSHINE_ASSETS_DIR "${CMAKE_CURRENT_BINARY_DIR}/assets")
endif()
if(NOT SUNSHINE_CONFIG_DIR)
set(SUNSHINE_CONFIG_DIR "${CMAKE_CURRENT_BINARY_DIR}/config")
endif()
if(UNIX AND CMAKE_INSTALL_PREFIX AND NOT ${SUNSHINE_CONFIGURE_APPIMAGE})
set(SUNSHINE_ASSETS_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_ASSETS_DIR}")
set(SUNSHINE_CONFIG_DIR "${CMAKE_INSTALL_PREFIX}/${SUNSHINE_CONFIG_DIR}")
endif()
list(APPEND CBS_EXTERNAL_LIBRARIES
@ -453,7 +448,6 @@ if(NOT WIN32)
endif()
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_ASSETS_DIR="${SUNSHINE_ASSETS_DIR}")
list(APPEND SUNSHINE_DEFINITIONS SUNSHINE_CONFIG_DIR="${SUNSHINE_CONFIG_DIR}")
add_executable(sunshine ${SUNSHINE_TARGET_FILES})
target_link_libraries(sunshine ${SUNSHINE_EXTERNAL_LIBRARIES} ${EXTRA_LIBS})
target_compile_definitions(sunshine PUBLIC ${SUNSHINE_DEFINITIONS})
@ -504,12 +498,7 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}" COMPONENT assets)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}" COMPONENT assets)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT config)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}" COMPONENT config)
# set(CPACK_NSIS_MUI_HEADERIMAGE "") # TODO: image should be 150x57 bmp
set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\sunshine.ico")
set(CPACK_NSIS_INSTALLED_ICON_NAME "${PROJECT__DIR}\\\\${PROJECT_EXE}")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}") # The name of the directory that will be created in C:/Program files/
@ -545,12 +534,6 @@ if(WIN32) # see options at: https://cmake.org/cmake/help/latest/cpack_gen/nsis.h
set(CPACK_COMPONENT_ASSETS_GROUP "${CMAKE_PROJECT_NAME}")
set(CPACK_COMPONENT_ASSETS_REQUIRED true)
# config
set(CPACK_COMPONENT_CONFIG_DISPLAY_NAME "Config")
set(CPACK_COMPONENT_CONFIG_DESCRIPTION "Default config and apps.json files.")
set(CPACK_COMPONENT_CONFIG_GROUP "${CMAKE_PROJECT_NAME}")
set(CPACK_COMPONENT_CONFIG_REQUIRED true)
# audio tool
set(CPACK_COMPONENT_AUDIO_DISPLAY_NAME "audio-info.exe")
set(CPACK_COMPONENT_AUDIO_DESCRIPTION "CLI tool that allows you to get information about sound devices.")
@ -578,10 +561,7 @@ if(APPLE AND SUNSHINE_MACOS_PACKAGE) # TODO
set(INSTALL_RUNTIME_DIR "${prefix}/MacOS")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
install(TARGETS sunshine
BUNDLE DESTINATION . COMPONENT Runtime
@ -596,17 +576,12 @@ elseif(UNIX)
install(TARGETS sunshine RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/common/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
if(APPLE)
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/macos/misc/uninstall_pkg.sh" DESTINATION "${SUNSHINE_ASSETS_DIR}")
else()
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/assets/" DESTINATION "${SUNSHINE_ASSETS_DIR}")
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/config/" DESTINATION "${SUNSHINE_CONFIG_DIR}")
install(FILES "${SUNSHINE_SOURCE_ASSETS_DIR}/linux/misc/85-sunshine.rules" DESTINATION "${CMAKE_INSTALL_LIBDIR}/udev/rules.d")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/sunshine.service" DESTINATION "${CMAKE_INSTALL_LIBDIR}/systemd/user")

View file

@ -35,7 +35,6 @@ build() {
-D SUNSHINE_EXECUTABLE_PATH=/usr/bin/sunshine \
-D CMAKE_INSTALL_PREFIX="/usr" \
-D SUNSHINE_ASSETS_DIR="share/sunshine/assets" \
-D SUNSHINE_CONFIG_DIR="share/sunshine/config" \
-D LIBAVCODEC_INCLUDE_DIR=/usr/include/ffmpeg4.4 \
-D LIBAVCODEC_LIBRARIES=/usr/lib/ffmpeg4.4/libavcodec.so \
-D LIBAVDEVICE_INCLUDE_DIR=/usr/include/ffmpeg4.4 \

View file

@ -203,7 +203,6 @@ modules:
- -DCMAKE_INSTALL_PREFIX=/app
- -DCMAKE_CUDA_COMPILER=/app/cuda/bin/nvcc
- -DSUNSHINE_ASSETS_DIR=assets
- -DSUNSHINE_CONFIG_DIR=config
- -DSUNSHINE_EXECUTABLE_PATH=/app/bin/sunshine
- -DSUNSHINE_ENABLE_WAYLAND=ON
- -DSUNSHINE_ENABLE_X11=ON

View file

@ -38,8 +38,7 @@ depends_lib port:avahi \
boost.version 1.76
configure.args -DCMAKE_INSTALL_PREFIX=${prefix} \
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets \
-DSUNSHINE_CONFIG_DIR=etc/sunshine/config
-DSUNSHINE_ASSETS_DIR=etc/sunshine/assets
startupitem.create yes
startupitem.executable "${prefix}/bin/{$name}"
@ -54,30 +53,6 @@ platform darwin {
}
}
# destroot not required as cmake install directive handles moving files
# # Rename files in `destroot`
# post-destroot {
# file rename ${destroot}${prefix}/etc/${name}/config/sunshine.conf ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample
# file rename ${destroot}${prefix}/etc/${name}/config/apps.json ${destroot}${prefix}/etc/${name}/config/apps.json.sample
# }
# # Don't overwrite existing preference files
# post-activate {
# if {![file exists ${prefix}/etc/${name}/config/sunshine.conf]} {
# file copy ${destroot}${prefix}/etc/${name}/config/sunshine.conf.sample \
# ${prefix}/etc/${name}/config/sunshine.conf
# }
# if {![file exists ${prefix}/etc/${name}/config/apps.json]} {
# file copy ${destroot}${prefix}/etc/${name}/config/apps.json.sample \
# ${prefix}/etc/${name}/config/apps.json
# }
# }
# disabled not overwriting config files... these are the default config files required by Sunshine
# this did not work with pkg created by macports
# we should always install the default files and user should start sunshine like "sunshine <path to user config file>"
# if the file doesn't exist sunshine will copy the default config to that location
notes-append "Run @PROJECT_NAME@ by executing 'sunshine <path to user config>', e.g. 'sunshine ~/sunshine.conf' "
notes-append "The config file will be created if it doesn't exist."
notes-append "It is recommended to set a location for the apps file in the config."

View file

@ -702,7 +702,7 @@ int apply_flags(const char *line) {
void apply_config(std::unordered_map<std::string, std::string> &&vars) {
if(!fs::exists(stream.file_apps.c_str())) {
fs::copy_file(SUNSHINE_CONFIG_DIR "/apps.json", stream.file_apps);
fs::copy_file(SUNSHINE_ASSETS_DIR "/apps.json", stream.file_apps);
}
for(auto &[name, val] : vars) {
@ -911,7 +911,7 @@ int parse(int argc, char *argv[]) {
}
if(!fs::exists(sunshine.config_file)) {
fs::copy_file(SUNSHINE_CONFIG_DIR "/sunshine.conf", sunshine.config_file);
fs::copy_file(SUNSHINE_ASSETS_DIR "/sunshine.conf", sunshine.config_file);
}
auto vars = parse_config(read_file(sunshine.config_file.c_str()));