Please test

This commit is contained in:
Miku AuahDark
2021-06-26 03:08:58 +08:00
commit ac0d8f6920
4 changed files with 585 additions and 0 deletions
+236
View File
@@ -0,0 +1,236 @@
/**************************************************************************
Copyright (c) 2004-18 Simon Peter
Portions Copyright (c) 2010 RazZziel
All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
**************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <libgen.h>
#include <dirent.h>
#include <string.h>
#include <errno.h>
#define die(...) \
do { \
fprintf(stderr, "Error: " __VA_ARGS__); \
exit(1); \
} while(0);
#define SET_NEW_ENV(str,len,fmt,...) \
format = fmt; \
length = strlen(format) + (len); \
char *str = calloc(length, sizeof(char)); \
snprintf(str, length, format, __VA_ARGS__); \
putenv(str);
#define MAX(a,b) (a > b ? a : b)
#define bool int
#define false 0
#define true -1
#define LINE_SIZE 255
int filter(const struct dirent *dir) {
char *p = (char*) &dir->d_name;
p = strrchr(p, '.');
return p && !strcmp(p, ".desktop");
}
int main(int argc, char *argv[]) {
char *appdir = dirname(realpath("/proc/self/exe", NULL));
if (!appdir)
die("Could not access /proc/self/exe\n");
int ret;
struct dirent **namelist;
ret = scandir(appdir, &namelist, filter, NULL);
if (ret == 0) {
die("No .desktop files found\n");
} else if(ret == -1) {
die("Could not scan directory %s\n", appdir);
}
/* Extract executable from .desktop file */
char *desktop_file = calloc(LINE_SIZE, sizeof(char));
snprintf(desktop_file, LINE_SIZE, "%s/%s", appdir, namelist[0]->d_name);
FILE *f = fopen(desktop_file, "r");
char *line = malloc(LINE_SIZE);
size_t n = LINE_SIZE;
do {
if (getline(&line, &n, f) == -1)
die("Executable not found, make sure there is a line starting with 'Exec='\n");
} while(strncmp(line, "Exec=", 5));
fclose(f);
char *exe = line+5;
// parse arguments
bool in_quotes = 0;
for (n = 0; n < LINE_SIZE; n++) {
if (!line[n]) // end of string
break;
else if (line[n] == 10 || line[n] == 13) {
line[n] = '\0';
line[n+1] = '\0';
line[n+2] = '\0';
break;
} else if (line[n] == '"') {
in_quotes = !in_quotes;
} else if (line[n] == ' ' && !in_quotes)
line[n] = '\0';
}
// count arguments
char* arg = exe;
int argcount = 0;
while ((arg += (strlen(arg)+1)) && *arg)
argcount += 1;
// merge args
char* outargptrs[argcount + argc + 1];
outargptrs[0] = exe;
int outargindex = 1;
arg = exe;
int argc_ = argc - 1; // argv[0] is the filename
char** argv_ = argv + 1;
while ((arg += (strlen(arg)+1)) && *arg) {
if (arg[0] == '%' || (arg[0] == '"' && arg[1] == '%')) { // handle desktop file field codes
char code = arg[arg[0] == '%' ? 1 : 2];
switch(code) {
case 'f':
case 'u':
if (argc_ > 0) {
outargptrs[outargindex++] = *argv_++;
argc_--;
}
break;
case 'F':
case 'U':
while (argc_ > 0) {
outargptrs[outargindex++] = *argv_++;
argc_--;
}
break;
case 'i':
case 'c':
case 'k':
fprintf(stderr, "WARNING: Desktop file field code %%%c is not currently supported\n", code);
break;
default:
fprintf(stderr, "WARNING: Invalid desktop file field code %%%c\n", code);
break;
}
} else {
outargptrs[outargindex++] = arg;
}
}
while (argc_ > 0) {
outargptrs[outargindex++] = *argv_++;
argc_--;
}
outargptrs[outargindex] = '\0'; // trailing null argument required by execvp()
// change directory
size_t appdir_s = strlen(appdir);
char *usr_in_appdir = malloc(appdir_s + 5);
/*
snprintf(usr_in_appdir, appdir_s + 5, "%s/usr", appdir);
ret = chdir(usr_in_appdir);
if (ret != 0)
die("Could not cd into %s\n", usr_in_appdir);
*/
// set environment variables
char *old_env;
size_t length;
const char *format;
/* https://docs.python.org/2/using/cmdline.html#envvar-PYTHONHOME */
SET_NEW_ENV(new_pythonhome, appdir_s, "PYTHONHOME=%s/", appdir);
old_env = getenv("PATH") ?: "";
SET_NEW_ENV(new_path, appdir_s + strlen(old_env), "PATH=%s/bin/:%s", appdir, old_env);
old_env = getenv("LD_LIBRARY_PATH") ?: "";
SET_NEW_ENV(new_ld_library_path, appdir_s + strlen(old_env), "LD_LIBRARY_PATH=%s/lib/:%s", appdir, old_env);
old_env = getenv("PYTHONPATH") ?: "";
SET_NEW_ENV(new_pythonpath, appdir_s + strlen(old_env), "PYTHONPATH=%s/share/pyshared/:%s", appdir, old_env);
old_env = getenv("XDG_DATA_DIRS") ?: "/usr/local/share/:/usr/share/";
SET_NEW_ENV(new_xdg_data_dirs, appdir_s + strlen(old_env), "XDG_DATA_DIRS=%s/share/:%s", appdir, old_env);
old_env = getenv("PERLLIB") ?: "";
SET_NEW_ENV(new_perllib, appdir_s*2 + strlen(old_env), "PERLLIB=%s/share/perl5/:%s/lib/perl5/:%s", appdir, appdir, old_env);
/* http://askubuntu.com/questions/251712/how-can-i-install-a-gsettings-schema-without-root-privileges */
old_env = getenv("GSETTINGS_SCHEMA_DIR") ?: "";
SET_NEW_ENV(new_gsettings_schema_dir, appdir_s + strlen(old_env), "GSETTINGS_SCHEMA_DIR=%s/share/glib-2.0/schemas/:%s", appdir, old_env);
old_env = getenv("QT_PLUGIN_PATH") ?: "";
SET_NEW_ENV(new_qt_plugin_path, appdir_s*10 + strlen(old_env), "QT_PLUGIN_PATH=%s/lib/qt4/plugins/:%s/lib/i386-linux-gnu/qt4/plugins/:%s/lib/x86_64-linux-gnu/qt4/plugins/:%s/lib32/qt4/plugins/:%s/lib64/qt4/plugins/:%s/lib/qt5/plugins/:%s/lib/i386-linux-gnu/qt5/plugins/:%s/lib/x86_64-linux-gnu/qt5/plugins/:%s/lib32/qt5/plugins/:%s/lib64/qt5/plugins/:%s", appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, appdir, old_env);
SET_NEW_ENV(new_gspath, appdir_s + strlen(old_env), "GST_PLUGIN_SYSTEM_PATH=%s/lib/gstreamer:%s", appdir, old_env);
SET_NEW_ENV(new_gspath1, appdir_s + strlen(old_env), "GST_PLUGIN_SYSTEM_PATH_1_0=%s/lib/gstreamer-1.0:%s", appdir, old_env);
/* Otherwise may get errors because Python cannot write __pycache__ bytecode cache */
putenv("PYTHONDONTWRITEBYTECODE=1");
/* Lua-specific stuff by MikuAuahDark */
old_env = getenv("LUA_PATH");
if (old_env) {
SET_NEW_ENV(new_lua_path, appdir_s*2 + strlen(old_env), "LUA_PATH=%s;%s/share/luajit-2.1.0-beta3/?.lua;%s/share/lua/5.1/?.lua;;", old_env, appdir, appdir);
} else {
SET_NEW_ENV(new_lua_path, appdir_s*2, "LUA_PATH=%s/share/luajit-2.1.0-beta3/?.lua;%s/share/lua/5.1/?.lua;;", appdir, appdir);
}
old_env = getenv("LUA_CPATH");
if (old_env) {
SET_NEW_ENV(new_lua_cpath, appdir_s + strlen(old_env), "LUA_CPATH=%s;=%s/lib/lua/5.1/?.so;;", old_env, appdir);
} else {
SET_NEW_ENV(new_lua_cpath, appdir_s, "LUA_CPATH=%s/lib/lua/5.1/?.so;;", appdir);
}
/* Run */
ret = execvp(exe, outargptrs);
int error = errno;
if (ret == -1)
die("Error executing '%s': %s\n", exe, strerror(error));
free(line);
free(desktop_file);
free(usr_in_appdir);
free(new_pythonhome);
free(new_path);
free(new_ld_library_path);
free(new_pythonpath);
free(new_xdg_data_dirs);
free(new_perllib);
free(new_gsettings_schema_dir);
free(new_qt_plugin_path);
return 0;
}
+325
View File
@@ -0,0 +1,325 @@
# Makefile script to generate AppImage for LOVE
# Number of processor to use when compiling
NUMBER_OF_PROCESSORS := $(shell nproc)
# CMake URL
CMAKE_URL := https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2-linux-x86_64.sh
# Project branches (for git-based projects)
LOVE_BRANCH := master
SDL2_BRANCH := release-2.0.14
LUAJIT_BRANCH := v2.1
OPENAL_BRANCH := 1.21.1
BROTLI_BRANCH := v1.0.9
ZLIB_BRANCH := v1.2.11
# Project versions (for downloadable tars)
LIBOGG_VERSION := 1.3.4
LIBVORBIS_VERSION := 1.3.7
LIBTHEORA_VERSION := 1.2.0alpha1
LIBPNG_VERSION := 1.6.37
FT_VERSION := 2.10.4
BZIP2_VERSION := 1.0.8
MPG123_VERSION := 1.27.2
LIBMODPLUG_VERSION := 0.8.8.5
# Output AppImage
APPIMAGE_OUTPUT := love-$(LOVE_BRANCH).AppImage
# No need to change anything beyond this line
override INSTALLPREFIX := $(CURDIR)/installdir
override CMAKE_PREFIX := $(CURDIR)/cmake
CMAKE := $(CMAKE_PREFIX)/bin/cmake
override CMAKE_OPTS := -DCMAKE_INSTALL_RPATH='$$ORIGIN/../lib' -DCMAKE_INSTALL_PREFIX=$(INSTALLPREFIX)
override CONFIGURE := LDFLAGS="-Wl,-rpath,'\$$\$$ORIGIN/../lib' $(LDFLAGS)" ../configure --prefix=$(INSTALLPREFIX)
# CMake setup
cmake_install.sh:
curl -Lo cmake_install.sh $(CMAKE_URL)
chmod u+x cmake_install.sh
$(CMAKE): cmake_install.sh
mkdir cmake
bash cmake_install.sh --prefix=$(CMAKE_PREFIX) --skip-license
touch $(CMAKE)
# AppImageTool
appimagetool:
curl -Lo appimagetool https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
chmod u+x appimagetool
# SDL2
override SDL2_PATH := SDL2-$(SDL2_BRANCH)
$(SDL2_PATH)/configure:
git clone --depth 1 -b $(SDL2_BRANCH) https://github.com/libsdl-org/SDL $(SDL2_PATH)
$(SDL2_PATH)/build/Makefile: $(SDL2_PATH)/configure
mkdir -p $(SDL2_PATH)/build
cd $(SDL2_PATH)/build && $(CONFIGURE) --disable-video-wayland
installdir/lib/libSDL2.so: $(SDL2_PATH)/build/Makefile
cd $(SDL2_PATH)/build && $(MAKE) install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libSDL2.so
# libogg
override LIBOGG_FILE := libogg-$(LIBOGG_VERSION)
$(LIBOGG_FILE).tar.gz:
curl -Lo $(LIBOGG_FILE).tar.gz http://downloads.xiph.org/releases/ogg/$(LIBOGG_FILE).tar.gz
$(LIBOGG_FILE)/configure: $(LIBOGG_FILE).tar.gz
tar xzf $(LIBOGG_FILE).tar.gz
touch $(LIBOGG_FILE)/configure
$(LIBOGG_FILE)/build/Makefile: $(LIBOGG_FILE)/configure
mkdir -p $(LIBOGG_FILE)/build
cd $(LIBOGG_FILE)/build && $(CONFIGURE)
installdir/lib/libogg.so: $(LIBOGG_FILE)/build/Makefile
cd $(LIBOGG_FILE)/build && $(MAKE) install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libogg.so
# libvorbis
override LIBVORBIS_FILE := libvorbis-$(LIBVORBIS_VERSION)
$(LIBVORBIS_FILE).tar.gz:
curl -Lo $(LIBVORBIS_FILE).tar.gz http://downloads.xiph.org/releases/vorbis/$(LIBVORBIS_FILE).tar.gz
$(LIBVORBIS_FILE)/configure: $(LIBVORBIS_FILE).tar.gz
tar xzf $(LIBVORBIS_FILE).tar.gz
touch $(LIBVORBIS_FILE)/configure
$(LIBVORBIS_FILE)/build/Makefile: $(LIBVORBIS_FILE)/configure installdir/lib/libogg.so
mkdir -p $(LIBVORBIS_FILE)/build
cd $(LIBVORBIS_FILE)/build && $(CONFIGURE)
installdir/lib/libvorbis.so: $(LIBVORBIS_FILE)/build/Makefile
cd $(LIBVORBIS_FILE)/build && $(MAKE) install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libvorbis.so
strip installdir/lib/libvorbisfile.so
strip installdir/lib/libvorbisenc.so
# libtheora
override LIBTHEORA_FILE := libtheora-$(LIBTHEORA_VERSION)
$(LIBTHEORA_FILE).tar.gz:
curl -Lo $(LIBTHEORA_FILE).tar.gz http://downloads.xiph.org/releases/theora/$(LIBTHEORA_FILE).tar.gz
$(LIBTHEORA_FILE)/configure: $(LIBTHEORA_FILE).tar.gz
tar xzf $(LIBTHEORA_FILE).tar.gz
touch $(LIBTHEORA_FILE)/configure
$(LIBTHEORA_FILE)/build/Makefile: $(LIBTHEORA_FILE)/configure installdir/lib/libogg.so
mkdir -p $(LIBTHEORA_FILE)/build
cd $(LIBTHEORA_FILE)/build && $(CONFIGURE) --with-ogg=$(INSTALLPREFIX) --with-vorbis=$(INSTALLPREFIX) --disable-examples --disable-encode
installdir/lib/libtheora.so: $(LIBTHEORA_FILE)/build/Makefile
cd $(LIBTHEORA_FILE)/build && $(MAKE) install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libtheora.so
strip installdir/lib/libtheoradec.so
strip installdir/lib/libtheoraenc.so
# zlib
override ZLIB_PATH := zlib-$(ZLIB_BRANCH)
$(ZLIB_PATH)/configure:
git clone --depth 1 -b $(ZLIB_BRANCH) https://github.com/madler/zlib $(ZLIB_PATH)
$(ZLIB_PATH)/build/Makefile: $(ZLIB_PATH)/configure
mkdir -p $(ZLIB_PATH)/build
cd $(ZLIB_PATH)/build && $(CONFIGURE)
installdir/lib/libz.so: $(ZLIB_PATH)/build/Makefile
cd $(ZLIB_PATH)/build && make install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libz.so
# libpng
override LIBPNG_FILE := libpng-$(LIBPNG_VERSION)
$(LIBPNG_FILE).tar.gz:
curl -Lo $(LIBPNG_FILE).tar.gz http://prdownloads.sourceforge.net/libpng/$(LIBPNG_FILE).tar.gz?download
$(LIBPNG_FILE)/configure: $(LIBPNG_FILE).tar.gz
tar xzf $(LIBPNG_FILE).tar.gz
touch $(LIBPNG_FILE)/configure
$(LIBPNG_FILE)/build/Makefile: $(LIBPNG_FILE)/configure installdir/lib/libz.so
mkdir -p $(LIBPNG_FILE)/build
cd $(LIBPNG_FILE)/build && $(CONFIGURE)
installdir/lib/libpng16.so: $(LIBPNG_FILE)/build/Makefile
cd $(LIBPNG_FILE)/build && $(MAKE) install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libpng16.so
# Brotli
override BROTLI_PATH := brotli-$(BROTLI_BRANCH)
$(BROTLI_PATH)/CMakeLists.txt:
git clone --depth 1 -b $(BROTLI_BRANCH) https://github.com/google/brotli $(BROTLI_PATH)
$(BROTLI_PATH)/build/CMakeCache.txt: $(CMAKE) $(BROTLI_PATH)/CMakeLists.txt
$(CMAKE) -B$(BROTLI_PATH)/build -H$(BROTLI_PATH) $(CMAKE_OPTS)
installdir/lib/libbrotlidec.so: $(BROTLI_PATH)/build/CMakeCache.txt
$(CMAKE) --build $(BROTLI_PATH)/build --target install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libbrotlicommon.so
strip installdir/lib/libbrotlidec.so
strip installdir/lib/libbrotlienc.so
# OpenAL-soft
override OPENAL_PATH := openal-soft-$(OPENAL_BRANCH)
$(OPENAL_PATH)/CMakeLists.txt:
git clone --depth 1 -b $(OPENAL_BRANCH) https://github.com/kcat/openal-soft $(OPENAL_PATH)
$(OPENAL_PATH)/build/CMakeCache.txt: $(CMAKE) $(OPENAL_PATH)/CMakeLists.txt
$(CMAKE) -B$(OPENAL_PATH)/build -H$(OPENAL_PATH) $(CMAKE_OPTS) -DALSOFT_EXAMPLES=0 -DALSOFT_BACKEND_SNDIO=0
installdir/lib/libopenal.so: $(OPENAL_PATH)/build/CMakeCache.txt
$(CMAKE) --build $(OPENAL_PATH)/build --target install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libopenal.so
# BZip2
override BZIP2_FILE := bzip2-$(BZIP2_VERSION)
$(BZIP2_FILE).tar.gz:
curl -Lo $(BZIP2_FILE).tar.gz https://sourceware.org/pub/bzip2/$(BZIP2_FILE).tar.gz
bzip2makefile.patch:
curl -Lo bzip2makefile.patch https://github.com/MikuAuahDark/test-love-linux-compilation/raw/master/bzip2makefile.patch
$(BZIP2_FILE)/Makefile.unpatched: $(BZIP2_FILE).tar.gz
tar xzf $(BZIP2_FILE).tar.gz
mv $(BZIP2_FILE)/Makefile $(BZIP2_FILE)/Makefile.unpatched
touch $(BZIP2_FILE)/Makefile.unpatched
$(BZIP2_FILE)/Makefile: $(BZIP2_FILE)/Makefile.unpatched bzip2makefile.patch
patch -o $(BZIP2_FILE)/Makefile $(BZIP2_FILE)/Makefile.unpatched bzip2makefile.patch
installdir/bzip2installed.txt: $(BZIP2_FILE)/Makefile
cd $(BZIP2_FILE) && LDFLAGS="-Wl,-rpath,'\$$\$$ORIGIN/../lib'" PREFIX=$(INSTALLPREFIX) make install -j$(NUMBER_OF_PROCESSORS)
touch installdir/bzip2installed.txt
# FreeType
override FT_FILE := freetype-$(FT_VERSION)
$(FT_FILE).tar.gz:
curl -Lo $(FT_FILE).tar.gz https://download.savannah.gnu.org/releases/freetype/$(FT_FILE).tar.gz
$(FT_FILE)/configure: $(FT_FILE).tar.gz
tar xzf $(FT_FILE).tar.gz
touch $(FT_FILE)/configure
$(FT_FILE)/build/Makefile: $(FT_FILE)/configure installdir/bzip2installed.txt installdir/lib/libpng16.so installdir/lib/libz.so installdir/lib/libbrotlidec.so
mkdir -p $(FT_FILE)/build
cd $(FT_FILE)/build && CFLAGS="-I$(INSTALLPREFIX)/include" LDFLAGS="-Wl,-rpath,'\$$\$$ORIGIN/../lib' -L$(INSTALLPREFIX)/lib -Wl,--no-undefined" PKG_CONFIG_PATH=$(INSTALLPREFIX)/lib/pkgconfig ../configure --prefix=$(INSTALLPREFIX)
installdir/lib/libfreetype.so: $(FT_FILE)/build/Makefile
cd $(FT_FILE)/build && make install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libfreetype.so
# Mpg123
override MPG123_FILE := mpg123-$(MPG123_VERSION)
$(MPG123_FILE).tar.bz2:
curl -Lo $(MPG123_FILE).tar.bz2 https://www.mpg123.de/download/$(MPG123_FILE).tar.bz2
$(MPG123_FILE)/configure: $(MPG123_FILE).tar.bz2
tar xf $(MPG123_FILE).tar.bz2
touch $(MPG123_FILE)/configure
$(MPG123_FILE)/builddir/Makefile: $(MPG123_FILE)/configure
mkdir -p $(MPG123_FILE)/builddir
cd $(MPG123_FILE)/builddir && $(CONFIGURE)
installdir/lib/libmpg123.so: $(MPG123_FILE)/builddir/Makefile
cd $(MPG123_FILE)/builddir && make install -j$(NUMBER_OF_PROCESSORS)
strip installdir/lib/libmpg123.so
# libmodplug
override LIBMODPLUG_FILE := libmodplug-$(LIBMODPLUG_VERSION)
$(LIBMODPLUG_FILE).tar.gz:
curl -Lo $(LIBMODPLUG_FILE).tar.gz http://sourceforge.net/projects/modplug-xmms/files/libmodplug/$(LIBMODPLUG_VERSION)/$(LIBMODPLUG_FILE).tar.gz/download
$(LIBMODPLUG_FILE)/configure: $(LIBMODPLUG_FILE).tar.gz
tar xzf $(LIBMODPLUG_FILE).tar.gz
touch $(LIBMODPLUG_FILE)/configure
$(LIBMODPLUG_FILE)/build/Makefile: $(LIBMODPLUG_FILE)/configure
mkdir -p $(LIBMODPLUG_FILE)/build
cd $(LIBMODPLUG_FILE)/build && $(CONFIGURE)
installdir/lib/libmodplug.so: $(LIBMODPLUG_FILE)/build/Makefile
cd $(LIBMODPLUG_FILE)/build && make install -j$(NUMBER_OF_PROCESSORS)
# LuaJIT
override LUAJIT_PATH := LuaJIT-$(LUAJIT_BRANCH)
$(LUAJIT_PATH)/Makefile:
git clone --depth 1 -b $(LUAJIT_BRANCH) https://github.com/LuaJIT/LuaJIT $(LUAJIT_PATH)
installdir/lib/libluajit-5.1.so: $(LUAJIT_PATH)/Makefile
cd $(LUAJIT_PATH) && LDFLAGS="-Wl,-rpath,'\$$\$$ORIGIN/../lib'" make amalg -j$(NUMBER_OF_PROCESSORS) PREFIX=/usr
cd $(LUAJIT_PATH) && make install PREFIX=$(INSTALLPREFIX)
cd $(LUAJIT_PATH) && make clean
strip installdir/lib/libluajit-5.1.so
strip installdir/bin/luaji*
# LOVE
override LOVE_PATH := love-$(LOVE_BRANCH)
$(LOVE_PATH)/CMakeLists.txt:
git clone --depth 1 -b $(LOVE_BRANCH) https://github.com/love2d/love $(LOVE_PATH)
$(LOVE_PATH)/configure: $(LOVE_PATH)/CMakeLists.txt installdir/lib/libluajit-5.1.so installdir/lib/libmodplug.so installdir/lib/libmpg123.so installdir/lib/libfreetype.so installdir/lib/libopenal.so installdir/lib/libz.so installdir/lib/libtheora.so installdir/lib/libvorbis.so installdir/lib/libogg.so installdir/lib/libSDL2.so
cd $(LOVE_PATH) && bash platform/unix/genmodules
cp $(LOVE_PATH)/platform/unix/configure.ac $(LOVE_PATH) && cp $(LOVE_PATH)/platform/unix/Makefile.am $(LOVE_PATH)
cd $(LOVE_PATH) && autoheader
cd $(LOVE_PATH) && libtoolize --force
cd $(LOVE_PATH) && aclocal -I $(INSTALLPREFIX)/share/aclocal
cd $(LOVE_PATH) && autoconf -I$(INSTALLPREFIX)
cd $(LOVE_PATH) && automake -a
$(LOVE_PATH)/build/Makefile: $(LOVE_PATH)/configure
mkdir -p $(LOVE_PATH)/build
cd $(LOVE_PATH)/build && CFLAGS="-I$(INSTALLPREFIX)/include" PKG_CONFIG_PATH=$(INSTALLPREFIX)/lib/pkgconfig LDFLAGS="-Wl,-rpath,'\$$\$$ORIGIN/../lib' -L$(INSTALLPREFIX)/lib" ../configure --prefix=$(INSTALLPREFIX)
installdir/bin/love: $(LOVE_PATH)/build/Makefile
cd $(LOVE_PATH)/build && make install -j$(NUMBER_OF_PROCESSORS)
strip installdir/bin/love
-strip installdir/lib/liblove*
installdir/AppRun: AppRun.c installdir/bin/love
$(CC) -o installdir/AppRun AppRun.c
strip installdir/AppRun
installdir/love.desktop: $(LOVE_PATH)/platform/unix/love.desktop.in
cat $(LOVE_PATH)/platform/unix/love.desktop.in | sed 's/@bindir@\///' > installdir/love.desktop
installdir/love.svg: $(LOVE_PATH)/platform/unix/love.svg
cp $(LOVE_PATH)/platform/unix/love.svg installdir/love.svg
$(APPIMAGE_OUTPUT): installdir/AppRun installdir/love.desktop installdir/love.svg appimagetool
cp -r installdir installdir2
-rm -rf installdir2/share/man
-rm -rf installdir2/share/doc
-rm -rf installdir2/share/openal
-rm -rf installdir2/lib/mpg123
-rm -rf installdir2/lib/cmake
-rm -rf installdir2/lib/pkgconfig
-rm -rf installdir2/lib/*.a
-rm -rf installdir2/lib/*.la
-rm -rf installdir2/lib/*.la
-rm -rf installdir2/include
-rm -rf installdir2/man
-find installdir2/bin -type l -exec rm -rf {} +
-find installdir2/bin ! -name 'luajit*' ! -name 'love' -type f -exec rm -f {} +
-strip installdir2/lib/*
./appimagetool installdir2 love-master.AppImage
rm -rf installdir2
.DEFAULT_GOAL := $(APPIMAGE_OUTPUT)
+14
View File
@@ -0,0 +1,14 @@
love-appimage-source
=====
Creates LOVE AppImage by compiling every single dependency from source.
Build
-----
Run `make`. `love-master.AppImage` (by default) will be generated. See the Makefile script for various tweakable variables.
License
-----
Public domain will do, except AppRun.c which is modified based on AppImage's default AppRun.c
+10
View File
@@ -0,0 +1,10 @@
21d20
< LDFLAGS=
24c23
< CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)
---
> CFLAGS=-fPIC -Wall -Winline -O2 -g $(BIGFILES)
27c26
< PREFIX=/usr/local
---
> PREFIX?=/usr/local