diff --git a/linux/install.sh b/linux/install.sh new file mode 100755 index 00000000..7c61c519 --- /dev/null +++ b/linux/install.sh @@ -0,0 +1,39 @@ +BINARY=$1 +STEAM=$2 +ARCH=$3 +function get_dep() +{ +echo "Copying $1..." +DEP=$(ldd $BINARY | grep $1 | sed -r 's/ \w.+ => (\/.+) .+$/\1/g') +cp "$DEP" "${MESON_INSTALL_PREFIX}/lib$ARCH" +} + +mkdir -p ${MESON_INSTALL_PREFIX}/lib$ARCH + + +# Required by Ubuntu +get_dep openal +get_dep physfs +get_dep SDL2-2.0 +get_dep SDL2_ttf +get_dep SDL2_image +get_dep SDL_sound +get_dep fluidsynth +get_dep ruby +get_dep sndio +get_dep objfw.so +get_dep objfwrt.so + +# Required by Fedora & Manjaro +get_dep libXss +get_dep libjpeg +get_dep libwebp +get_dep libcrypt +get_dep libbsd +get_dep tinfo +get_dep readline + +if [ -n "$STEAM" ]; then + echo "Copying steam_api..." + cp "$STEAM/libsteam_api.so" "${MESON_INSTALL_PREFIX}/usr/lib" +fi diff --git a/linux/meson.build b/linux/meson.build index 868e9a62..6ad75be4 100644 --- a/linux/meson.build +++ b/linux/meson.build @@ -1,9 +1,19 @@ -install_data('AppRun') -install_data('mkxp-z.png') -install_data('mkxp-z.desktop') - swarg = '' if steamworks == true swarg = steam_libpath endif -meson.add_install_script('make_appimg.sh', meson.project_name(), get_option('appimagekit_path'), swarg) + +if get_option('appimage') == true + install_data('AppRun') + install_data('mkxp-z.png') + install_data('mkxp-z.desktop') + + meson.add_install_script('make_appimg.sh', meson.project_name(), get_option('appimagekit_path'), swarg) +else + if sizeof['long'] == 8 + archarg = '64' + else + archarg = '' + endif + meson.add_install_script('install.sh', meson.project_name(), swarg, archarg) +endif diff --git a/meson.build b/meson.build index c9004c15..c9c4d4f6 100644 --- a/meson.build +++ b/meson.build @@ -94,10 +94,6 @@ if get_option('workdir_current') global_args += '-DWORKDIR_CURRENT' endif -if get_option('independent_appimage') - global_args += '-DINDEPENDENT_APPIMAGE' -endif - if get_option('easypoke') == true and miniffi == true global_args += '-DEASY_POKE' endif @@ -161,6 +157,13 @@ elif host_system == 'darwin' else subdir('linux') add_project_arguments('-std=c++11', language: 'objcpp') + if get_option('appimage') != true + lnx_arch = '' + if sizeof['long'] == 8 + lnx_arch = '64' + endif + add_project_link_arguments('-Wl,-rpath,$ORIGIN/lib' + lnx_arch, language: 'objcpp') + endif endif exe_name = meson.project_name() @@ -189,6 +192,10 @@ if steamworks == true install: (host_system != 'windows')) endif +if host_system == 'linux' + exe_name += '_' + host_machine.cpu_family() +endif + executable(exe_name, sources: global_sources, dependencies: global_dependencies, diff --git a/meson_options.txt b/meson_options.txt index 994c60cd..35db9d7c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -18,7 +18,7 @@ option('no_preload_scripts', type: 'boolean', value: false, description: 'Disabl option('workdir_current', type: 'boolean', value: false, description: 'Keep current directory on startup') option('static_executable', type: 'boolean', value: false, description: 'Build a static executable (Windows-only)') -option('independent_appimage', type: 'boolean', value: true, description: 'Set current directory to the original location of the AppImage when contained within one') +option('appimage', type: 'boolean', value: false, description: 'Whether to install to an AppImage or just copy everything') option('steamworks_path', type: 'string', value: '', description: 'Path to Steamshim') option('steam_appid', type: 'string', value: '', description: 'Steam AppID. Set this to use SteamAPI_RestartAppIfNecessary') option('appimagekit_path', type: 'string', value: '', description: 'Path to AppImageKit, used for building AppImages') diff --git a/src/main.mm b/src/main.mm index 6b15350e..ce39d625 100644 --- a/src/main.mm +++ b/src/main.mm @@ -197,7 +197,7 @@ int main(int argc, char *argv[]) { #ifndef WORKDIR_CURRENT char dataDir[512]{}; char *tmp{}; -#if defined(__linux__) && defined(INDEPENDENT_APPIMAGE) +#if defined(__linux__) tmp = getenv("SRCDIR"); if (tmp) { strncpy(dataDir, tmp, sizeof(dataDir));