Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 7d73690b rédigé par Kubat's avatar Kubat
Parcourir les fichiers

[build] trying to make the AppImage works on other computers

parent b320f69a
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Ce commit fait partie de la requête de fusion !2. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
#!/bin/sh #!/bin/sh
SELF_DIR=$(dirname "$0") SELF_DIR=$(dirname $(readlink -f "$0"))
export LD_LIBRARY_PATH="$SELF_DIR/lib" export LC_ALL="en_US.UTF-8"
export LD_LIBRARY_PATH="$SELF_DIR/usr/lib:$LD_LIBRARY_PATH"
ldd "$SELF_DIR"/aegisub
exec "$SELF_DIR"/aegisub exec "$SELF_DIR"/aegisub
Fichier déplacé
...@@ -97,7 +97,7 @@ tags: ...@@ -97,7 +97,7 @@ tags:
appimage: src/aegisub appimage: src/aegisub
cp $^ Aegisub/aegisub cp $^ Aegisub/aegisub
./tools/copy_libs.bash --exec=Aegisub/aegisub --dest=Aegisub/lib ./tools/copy-libs.lua Aegisub/aegisub Aegisub/usr/lib
./tools/appimagetool.AppImage Aegisub ./tools/appimagetool.AppImage Aegisub
# The actual build rules # The actual build rules
......
#!/usr/bin/env lua
-- Needs awk and a shell (usually bash / sh) and ldd, which is a Linux utility.
-- Thus run only this script on a Linux env or where the .so files can be found
-- with the ldd command.
if not arg or #arg ~= 2 then os.exit(1) end
io.stdout:write(string.format('Running for file %s\n', arg[1]))
io.stdout:write(string.format('Dest folder is %s\n', arg[2]))
-- Libs tables
LIBS_WRITE = {}
LIBS_READ = {}
-- Capture the output of a command
function os.capture(cmd)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
return s
end
-- Simple copy of a table, it doesn't work with metatables and recursive tables
function copy_simple(obj)
if type(obj) ~= 'table' then return obj end
local res = {}
for k, v in pairs(obj) do res[copy_simple(k)] = copy_simple(v) end
return res
end
-- Add the content of t2 in t1
function concatenate(t1, t2)
for name, file in pairs(t2) do
t1[name] = file
end
end
-- Get the number of elements in a table
function tablelength(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
-- The ldd command line utility, but in lua
function ldd(file)
local libs = {}
local cmd = string.format('ldd %s | awk \'$2 = "=>" && $3 { print $1 " " $3 }\'', arg[1])
local out = os.capture(cmd)
for name, file in out:gmatch("([^\n ]*) ([^\n ]*)[\n]") do
libs[name] = file
end
return libs
end
-- Add NEEDS for each lib while there are some added. It's like a dataflow algorithme.
LIBS_WRITE = ldd(arg[1])
while tablelength(LIBS_READ) ~= tablelength(LIBS_WRITE) do
LIBS_READ = copy_simple(LIBS_WRITE)
for name, file in pairs(LIBS_READ) do
concatenate(LIBS_WRITE, ldd(file))
end
end
io.stdout:write(string.format("Cleaning %s", arg[2]))
os.execute(string.format("rm -f %s/*", arg[2]))
for name, file in pairs(LIBS_WRITE) do
io.stdout:write(string.format("%s => %s/%s\n", file, arg[2], name))
local cmd = string.format('cp %s %s/%s && chmod 555 %s/%s',
file, arg[2], name, arg[2], name)
os.execute(cmd)
end
io.stdout:write(string.format("Copied %d libraries to %s\n", tablelength(LIBS_WRITE), arg[2]))
#!/bin/bash
EXEC=""
DEST=""
function print_help {
cat << EOF
Usage: $0 --exec=* --dest=* [--help]
--help Display this help message
--exec Specify which dynamic executable to inspect and get the .so files from
--dest In which folder the .so files must be copied
EOF
}
for arg in "$@"
do
case $arg in
--help|-h)
print_help
exit
;;
--exec=*)
EXEC=`echo A$arg | sed -e 's/^A--exec=//g'`
;;
--dest=*)
DEST=`echo A$arg | sed -e 's/^A--dest=//g'`
;;
esac
done
if test "x$EXEC" = "x" -o "x$DEST" = "x"
then
print_help
exit
fi
ldd "$EXEC" \
| awk '$2 = "=>" && $3 { print $1 " " $3 }' 2>&1 \
| while read NAME FILE
do
cp $FILE $DEST/`basename $FILE`
done
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter