Page 1 of 1

How to strip (a module)?

Posted: 08 Apr 2020, 04:49
by S4m4n
Hey there!

In absence of USM, I got couple of questions regarding modules preparation:
  • How can I reduce weight of a module safely? and which modules are not recommended to be tweaked this way.
  • When a software relies on having python installed, how can I realize which version is demanded? I cant find any clue on terminal.
  • on resolving dependencies from should I stick to the packages provided for slackware 14.2? then which repository has the priority?
  • I have to xzm2dir all the modules and merge them then dir2xzm it back to a module, is there any better method?
Thanks for caring :Rose:

How to strip (a module)?

Posted: 08 Apr 2020, 14:16
by ncmprhnsbl
S4m4n wrote:
08 Apr 2020, 04:49
I have to xzm2dir all the modules and merge them then dir2xzm it back to a module, is there any better method?
if you have some packages:

Code: Select all

#lets do this in /tmp
cd /tmp
mkdir pkgs
#place all the packages(.txz,.tgz) in /tmp/pkgs
#make another directory to install them to
mkdir my_bundled_module_name
# install all the package in /tmp/pkgs to /tmp/my_bundled_module_name
ROOT=/tmp/my_bundled_module_name installpkg /tmp/pkgs/*
# at this point, you can remove stuff, and add configs if you want..
# stuff to remove: /usr/include(these are developmant headers, used for compiling), /usr/man(unless you want the manuals), /usr/share/locales(except # for the one(s) you need)
# then make the module
dir2xzm my_bundled_module_name  my_bundled_module_name.xzm (or use "Create Module" in the filemanager)
for merging modules you already have: similar to above, put the modules into a dir(eg. mods) then make a target directory and :

Code: Select all

for a in `find /tmp/mods -name "*.xzm"`; do xzm2dir $a target_directory; done
# then
dir2xzm target_directory new_bundled_module_name.xzm 

How to strip (a module)?

Posted: 10 Apr 2020, 22:41
by Rava
S4m4n wrote:
08 Apr 2020, 04:49
How can I reduce weight of a module safely?
What can safely be removed are unneeded language files for the GUI. When the GUI is a complex one - like with The GIMP - removing all unnecessary ones will make quite some difference.

They are to be found in /usr/share/locale .

Also, using usm, at times a needed dependency - a library - is only to be found in a package that contains more than the mere library.
You can manually check what is needed and only adding what is needed the following way:

Only activate the module itself, maybe with python added when it needs it, but with no additional libraries activated. Use ldd to see what dependencies are missing-

Code: Select all

ldd /path/to/binary|grep not
ldd needs the full path, and the error message you are looking for is "not found"

Then you can use lsxzm to find the xzm that holds the library and copy that, e.g. via mloop into the folder of your stripped module, and do the same with the next "not found" entry.
Now, after you did so, it still could be that additional dependencies are unsolved even after ldd reports no "not found", because libraries you just added might need other libraries ldd did not know about in the above test. So, dir2xzm your stripped module folder into the stripped module and deactivate the bare version and activate the stripped version with the manually added libs. Repeat using ldd to see if there are still dependencies missing. If ldd reports nothing (combined with grep as seen above), try starting the program.
If the programs starts, your stripped module is working as it should.

Cave! This behaviour can differ between DEs (Desktop environments)
Some minimal DEs like LXDE or XFCE might need some more libraries than e.g. KDE. So, a module working in KDE (that is not a KDE specific program) might fail in XFCE or LXDE.

But never the other way round, when you use the most minimal DE - currently that is Openbox - the created module should work in any other available DE as well.

I know it is quite some manual work. If you plan on stripping a certain program and plan on doing the same in the future for the most recent version available then I recommend you note down what was needed to get is running in the best stripped down version you have been able to create; the note will be helpful the next time you do the same for the never version, and the note will shorten the time creating the then never version as well. :)

As was the info note I created for me when I created the stripped versions of newer GIMP versions.