Improve AppImages & Safer OpenAL

This commit is contained in:
TheBrokenRail 2022-03-11 20:02:38 -05:00
parent 07baea7b5a
commit 0fd8ba7de9
9 changed files with 54 additions and 35 deletions

View File

@ -40,6 +40,7 @@ endif()
# Specify Installation Paths
set(MCPI_INSTALL_DIR "lib/${MCPI_VARIANT_NAME}")
set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib")
set(MCPI_BIN_DIR "${MCPI_INSTALL_DIR}/bin")
set(MCPI_FALLBACK_LIB_DIR "${MCPI_INSTALL_DIR}/fallback-lib")
# Build Mode

View File

@ -16,7 +16,7 @@ endif()
if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE)
add_subdirectory(glfw)
endif()
# Zenity (Minimal AppImage Build)
if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE AND MCPI_IS_APPIMAGE_BUILD)
# Zenity (Minimal Build)
if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE)
add_subdirectory(zenity)
endif()

View File

@ -12,4 +12,4 @@ add_subdirectory(src EXCLUDE_FROM_ALL)
add_custom_target(zenity-build ALL DEPENDS zenity)
# Install
install(TARGETS zenity DESTINATION "bin")
install(TARGETS zenity DESTINATION "${MCPI_BIN_DIR}")

@ -1 +1 @@
Subproject commit 6f08afb7989c420282654eee9dea9d5df01e914a
Subproject commit 4663a8656d8c12be00286ee10aae2ff55ff589af

View File

@ -148,6 +148,29 @@ void pre_bootstrap() {
ERR("AppImage: Unable To Fix Current Directory: %s", strerror(errno));
}
#endif
// Get Binary Directory
char *binary_directory = get_binary_directory();
// Configure PATH
{
// Add Library Directory
char *new_path;
safe_asprintf(&new_path, "%s/bin", binary_directory);
// Add Existing PATH
{
char *value = get_env_safe("PATH");
if (strlen(value) > 0) {
string_append(&new_path, ":%s", value);
}
}
// Set And Free
set_and_print_env("PATH", new_path);
free(new_path);
}
// Free Binary Directory
free(binary_directory);
}
// Bootstrap
@ -158,14 +181,13 @@ void bootstrap(int argc, char *argv[]) {
char *binary_directory = get_binary_directory();
// Handle AppImage
char *usr_prefix = NULL;
#ifdef MCPI_IS_APPIMAGE_BUILD
char *usr_prefix = getenv("APPDIR");
usr_prefix = getenv("APPDIR");
#endif
if (usr_prefix == NULL) {
usr_prefix = "";
}
#else
char *usr_prefix = "";
#endif
// Configure LD_LIBRARY_PATH
{
@ -265,23 +287,6 @@ void bootstrap(int argc, char *argv[]) {
free(new_ld_preload);
}
// Configure PATH
{
// Add Library Directory
char *new_path;
safe_asprintf(&new_path, "%s/lib", binary_directory);
// Add Existing PATH
{
char *value = get_env_safe("PATH");
if (strlen(value) > 0) {
string_append(&new_path, ":%s", value);
}
}
// Set And Free
set_and_print_env("PATH", new_path);
free(new_path);
}
// Resolve Binary Path & Set MCPI_DIRECTORY
{
// Resolve Full Binary Path

View File

@ -15,11 +15,12 @@ static std::vector<ALuint> &get_sources() {
return sources;
}
#define AL_ERROR_CHECK() \
#define AL_ERROR_CHECK() AL_ERROR_CHECK_MANUAL(alGetError())
#define AL_ERROR_CHECK_MANUAL(val) \
{ \
ALenum err = alGetError(); \
if (err != AL_NO_ERROR) { \
ERR("OpenAL Error: %s", alGetString(err)); \
ALenum __err = val; \
if (__err != AL_NO_ERROR) { \
ERR("OpenAL Error: %s", alGetString(__err)); \
} \
}
@ -81,7 +82,15 @@ void media_audio_play(const char *source, const char *name, float x, float y, fl
// Create Source
ALuint al_source;
alGenSources(1, &al_source);
AL_ERROR_CHECK();
// Special Out-Of-Memory Handling
{
ALenum err = alGetError();
if (err == AL_OUT_OF_MEMORY) {
return;
} else {
AL_ERROR_CHECK_MANUAL(err);
}
}
// Set Properties
alSourcef(al_source, AL_PITCH, pitch);

View File

@ -12,7 +12,7 @@ if(BUILD_NATIVE_COMPONENTS)
target_link_libraries(media-layer-proxy-client media-layer-headers reborn-headers ${MEDIA_LAYER_PROXY_LIBS})
target_compile_definitions(media-layer-proxy-client PRIVATE -DMEDIA_LAYER_PROXY_CLIENT)
# Install
install(TARGETS media-layer-proxy-client DESTINATION "${MCPI_LIB_DIR}")
install(TARGETS media-layer-proxy-client DESTINATION "${MCPI_BIN_DIR}")
endif()
if(BUILD_ARM_COMPONENTS)

View File

@ -32,7 +32,7 @@ if (mode === 'client') {
'libgtk-3-0',
'libglib2.0-0',
'libgdk-pixbuf2.0-0',
'libcanberra-gtk3-module',
'shared-mime-info',
'libfreeimage3',
'libopenal1'
);
@ -52,6 +52,7 @@ const packageExclusions = [
// Exclude Unneeded Packages
'humanity-icon-theme',
'adwaita-icon-theme',
'libxml2',
'*systemd*',
'dconf-service',
'dconf-gsettings-backend',
@ -102,7 +103,8 @@ const files = {
'usr/share/doc/*/TODO.*',
'usr/include',
'usr/share/locale',
'usr/share/help'
'usr/share/help',
'usr/bin/update-mime-database'
]
};
@ -120,7 +122,8 @@ const runtime = {
GTK_PATH: `\${APPDIR}/usr/lib/${triplet}/gtk-3.0`,
GTK_DATA_PREFIX: '${APPDIR}',
GTK_THEME: 'Default',
APPDIR_LIBRARY_PATH: `\${APPDIR}/usr/lib/${triplet}:\${APPDIR}/lib/${triplet}:\${APPDIR}/usr/lib:\${APPDIR}/usr/lib/${triplet}/gdk-pixbuf-2.0/2.10.0/loaders`
XDG_DATA_DIRS: '${APPDIR}/share:${APPDIR}/usr/share',
APPDIR_LIBRARY_PATH: `\${APPDIR}/usr/lib/${triplet}:\${APPDIR}/usr/${triplet}/lib:\${APPDIR}/lib/${triplet}:\${APPDIR}/usr/lib:\${APPDIR}/usr/lib/${triplet}/gdk-pixbuf-2.0/2.10.0/loaders`
} : undefined,
preserve: arch !== 'armhf' ? [
// On non-ARM32 systems, an ARM32 linker is embedded, this

View File

@ -95,6 +95,7 @@ queue_pkg \
strace \
fuse \
gtk-update-icon-cache \
shared-mime-info \
sed
# Install Queue
@ -115,4 +116,4 @@ sudo rm -f /usr/local/bin/appimagetool
sudo ln -s /opt/appimagetool.AppDir/AppRun /usr/local/bin/appimagetool
# Install appimage-builder
sudo pip3 install 'git+https://github.com/TheBrokenRail/appimage-builder.git'
sudo pip3 install 'git+https://github.com/TheBrokenRail/appimage-builder.git@combined'