make installing to appimages optional (#12)

This commit is contained in:
Struma 2020-04-29 22:33:01 -04:00 committed by Roza
parent 1cb53a8e63
commit ee4ec392eb
5 changed files with 67 additions and 11 deletions

39
linux/install.sh Executable file
View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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')

View file

@ -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));