Je vire les localisations et les bibliothèques statiques (.a). Pour ce faire j'ai écrit un script en lua qui nécessite `luaposix`
Code : Tout sélectionner
#!/usr/bin/lua
require "posix_c"
keep_locales = {
-- system locales
"fr", "en", "fr_FR", "fr_FR.utf8", "fr_FR@euro",
-- man pages
"cat1", "cat2", "cat3", "cat3p", "cat4", "cat5", "cat6", "cat7", "cat8", "cat9", "catn",
"man1", "man2", "man3", "man3p", "man4", "man5", "man6", "man7", "man8", "man9", "manm", "mann",
}
keep_slib = {
-- glibc
"libmcheck", "libbsd-compat", "libg", "librpcsvc",
"libutil", "libresolv", "libnsl", "librt","libc",
"libpthread_nonshared", "libm", "libBrokenLocale",
"libcrypt", "libdl", "libc_nonshared", "libpthread",
"libanl", "libieee", "libnsl",
-- gcc
"libmudflapth", "libgomp", "libmudflap", "libssp", "libssp_nonshared",
"libsupc++", "libstdc++"
}
function cleanlocales (path)
local entry, i
-- Does this directory exist ?
if posix.chdir (path) == nil then
print(path.. " does not exist")
return
end
-- decide to keep locale or not
local keep = function (locale)
for i=1,#keep_locales do
if locale == keep_locales[i] then
return true
end
end
return false
end
for entry in posix.files (path) do
if posix.stat(entry).type == "directory" and (entry ~= "." and entry ~= "..") then
if not keep (entry) then
print("removing ".. path .. entry)
os.execute ("rm -rf ".. path..entry)
end
end
end
end
function delete_staticlibs (path)
local entry, i
local size = 0
-- Does this directory exist ?
if posix.chdir (path) == nil then
print(path.. " does not exist")
return
end
local keep = function (locale)
for i=1,#keep_slib do
if locale == keep_slib[i] then
return true
end
end
return false
end
for entry in posix.files (path) do
if posix.stat(entry).type ~= "directory" and string.sub(entry,-2) == ".a" then
if not keep (string.sub(entry, 1, -3)) then
print("delete "..entry)
os.execute ("rm -f ".. path..entry)
-- size = size + posix.stat(entry).size
end
end
end
-- print (size .. " bytes removed")
end
cleanlocales ("/usr/share/locale/")
cleanlocales ("/usr/share/man/")
cleanlocales ("/usr/lib/locale/")
cleanlocales ("/usr/share/wesnoth/translations/")
delete_staticlibs("/usr/lib/")
Il y a sûrement encore du travail à faire dessus (bibliothèques à garder pour le x86_64, chemin supplémentaire à ajouter…), cela fonctionne cependant très bien sur ma machine.
Donc molo sur `delete_staticlibs`, je te conseille de regarder quels sont les .a apportés par gcc et glibc , par exemple avec un `pacman -Ql gcc | grep ".a$"`, pour ne pas virer des fichiers qui seraient utiles.
Anarchy for the triple A.