I thought I share with you my attempts at shrinking down my own modules, especially for the use on systems with low RAM and / or old CPU...
A warning: editing / deleting files from a module can break something, so be sure only to remove files from doc / man / locales folder, no binaries, as in /usr/bin or /bin or /sbin or such, also no libraries, as in /usr/lib or /usr/lib64 or /lib or /lib64!
Stripping especially complex programs, such as GIMP or inkscape of unneeded locales to save file space, and especially uncompressed space.
In my below example, we want to create a stripped down GIMP module, that includes GIMP's mandatory babl and gegl libraries.
First, you need to download the modules, in this case, I downloaded gimp-2.6.11-x86_64-3.xzm, babl-0.1.2-x86_64-1.xzm and gegl-0.1.2-x86_64-1.xzm from ponce.cc and saved them in the /tmp directory. You can save it in any directory you want, but do use a linux filesystem, when creating the folder for the new module on a vfat or NTFS FS, the file attributes and ownerships of files and folders will be messed up, so, either put it in your live system, e.g. on /tmp, or, when you not have enough RAM to do so, create the folder in a linux ext2/ext3/reiser/whatever-linux-FS of your choice.
(Of course, knowing that only babl and gegl is mandatory for GIMP, and that the other modules PPM suggests are not mandatory, but expendable takes experience... since I am a fan of optimising my modules, I tried it for some years to keep my modules as small as it can be, including only adding the really needed dependencies.)
Second, we create the new directory, best naming it like we want to name the finished module:
Code: Select all
root@porteus:/tmp# mkdir gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped
Then we need to extract the modules into that directory:
Code: Select all
root@porteus:/tmp# xzm2dir gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped
[ ... output of xzm2dir snipped ... ]
root@porteus:/tmp# xzm2dir gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped
[ ... output of xzm2dir snipped ... ]
root@porteus:/tmp# xzm2dir gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped
[ ... output of xzm2dir snipped ... ]
The locales you always find in usr/share/locale, after deleting my folder looks like this:
Code: Select all
root@porteus:/tmp/gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped/usr/share/locale# ls -o
total 0
drwxr-xr-x 3 root 60 Mar 22 2011 de
drwxr-xr-x 3 root 60 Mar 22 2011 en_GB
Then, I do another trick, but that will break the rules for GNU, BSD and other licences, so only do it when you NOT share the modules with others.
Since I deem it unnecessary that I have lots of identical COPYING files on my system, that have lots of redundancy, I create an empty file that holds the name and version of the actual licence file in its filename, and remove the actual licence file.
When someone want to read the licence file, (s)he just have to look it up, most probably on the very system (s)he is running, since it will be there somewhere already.
Code: Select all
root@porteus:/tmp/gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped# ls -o usr/doc/*/COPY*
-rw-r--r-- 1 root 0 Jul 24 10:00 usr/doc/babl-0.1.2/COPYING.GNU LESSER GENERAL PUBLIC LICENSE V3
-rw-r--r-- 1 root 0 Jul 24 10:00 usr/doc/gegl-0.1.2/COPYING.GNU GENERAL PUBLIC LICENSE V3
-rw-r--r-- 1 root 0 Jul 24 10:00 usr/doc/gegl-0.1.2/COPYING.LESSER.GNU LESSER GENERAL PUBLIC LICENSE V3
-rw-r--r-- 1 root 0 Jul 24 10:00 usr/doc/gimp-2.6.11/COPYING.GNU GENERAL PUBLIC LICENSE V2
Now create the new module with
Code: Select all
root@porteus:/tmp# dir2xzm gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped/ gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped.xzm
Code: Select all
root@porteus:/tmp# ls -o *xzm
-rw-r--r-- 1 root 65536 Jul 24 09:56 babl-0.1.2-x86_64-1.xzm
-rw-r--r-- 1 root 372736 Jul 24 09:56 gegl-0.1.2-x86_64-1.xzm
-rw-r--r-- 1 root 7348224 Jul 24 10:04 gimp-2.6.11-x86_64-3+babl+gegl_locales-stripped.xzm
-rw-r--r-- 1 root 14381056 Jul 24 09:56 gimp-2.6.11-x86_64-3.xzm
7348224 bytes for the whole GIMP including babl and gegl, instead of (added up) 14819328 bytes for all 3 original modules...
(Or in Megabytes: 7.01 MB instead of 14.13 MB)
I hope this is helpful to some of you, but please be aware: if you want to share your modules, better keep the COPYING* files as they are...