aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Pages: [1] 2

Author Topic: mac_packager  (Read 20318 times)

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
mac_packager
« on: September 23, 2009, 01:09:57 PM »

Building aMule I noticed that mac_packager missed something and we spoke about it in other threads.
I compared a working copy of aMule and a compiled aMule (to be packaged). According to the script this is what I noticed:
  • It doesn't take care of the other tools (aMuleGUI, wxCas etc). I bet this was intentional but it won't take a long time to modify the script (but app bundles are needed).
  • Skins are not included.
  • It should copy the needed library into the bundle (for each app). It looks for libwx_ but ignores all macports, self-compiled libraries and dependencies.
  • After fixing the previous: install_name_tool on all libraries.

About the first point, I toke the bundle of a working copy of aMule "suite" and made the bundles manually updating Info.plist of each tool. I don't know if this is the right way: all apps work correctly (after quick test) except wxCas.

For the second point I guess this is enough:
Code: [Select]
mkdir -m 0755 aMule.app/Contents/SharedSupport aMule.app/Contents/SharedSupport/skins
cp src/skins/*.zip aMule.app/Contents/SharedSupport/skins/
I also saw a cas folder on working aMule.

For the third point, I think the problem is the filter used (grep libwx_). I generally use either grep /opt/local for macports only, or grep -E '/opt/local/|/usr/local' for self-compiled libs. Since I got some error sometimes I have to use otool -L on the libraries obtained with the previous filter for dependencies.
« Last Edit: September 23, 2009, 01:25:37 PM by mirko.g »
Logged

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #1 on: September 23, 2009, 01:43:34 PM »

This is what I was working on... (it's incomplete/work-in-progress)
http://www.mac-factory.org/redmine/repositories/annotate/macmule/script/mac_packager
« Last Edit: September 23, 2009, 04:46:20 PM by mirko.g »
Logged

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #2 on: September 23, 2009, 04:30:25 PM »

I also saw a cas folder on working aMule.

Well, I found stat.png and tmp.html into aMule.app/Contents/SharedSupport/cas/ and I guess they come from src/utils/cas/: don't they?
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: mac_packager
« Reply #3 on: September 23, 2009, 05:00:37 PM »

Yes, they do.
Logged
concordia cum veritate

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #4 on: September 23, 2009, 06:13:15 PM »

Attached a first patch for original mac_packager.
What's new:
  • Skins and cas files included in bundle.
  • All libraries (with dependencies) are included now (either from macports or self-compiled).
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: mac_packager
« Reply #5 on: September 23, 2009, 08:24:31 PM »

That will fail badly for people like me, who don't install libraries.
Logged

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #6 on: September 23, 2009, 10:38:51 PM »

That will fail badly for people like me, who don't install libraries.

Yep but we hope there aren't so many people like you;D
Just kidding... In my very humble opinion if you didn't plan to move libraries from system into bundle there should be another way to produce something useful with mac_packager. According to the wiki page we are producing a useless stuff.

How do you usually build aMule for Mac OS? Do I ignore the existence of an alternative way to only run aMule without any of the needed libraries?  :o
« Last Edit: September 23, 2009, 11:31:43 PM by mirko.g »
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: mac_packager
« Reply #7 on: September 24, 2009, 07:30:54 AM »

mac_packager should move the libraries that are NOT in the system to the bundle. You are moving the libraries that ARE installed in two specific locations, which is different.

You need to modify it so it takes libraries that are not in the default system locations.
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: mac_packager
« Reply #8 on: September 24, 2009, 08:00:03 AM »

So you mean anyone downloading the produced bundle should also install macports with the necessary libraries?
Logged
concordia cum veritate

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #9 on: September 24, 2009, 08:44:49 AM »

mac_packager should move the libraries that are NOT in the system to the bundle.

Sorry but I cannot understand. Are you talking about wxWidgets? And how we should provide the (other) needed libraries?

Quote
You are moving the libraries that ARE installed in two specific locations, which is different.

Yep. The libraries I used to compile wxWidgets and the same aMule.
Take a look to this:
Code: [Select]
$ otool -L amule | sort -u | cut -d " " -f 1
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit
/opt/local/lib/libiconv.2.dylib
/opt/local/lib/libixml.2.dylib
/opt/local/lib/libthreadutil.2.dylib
/opt/local/lib/libupnp.3.dylib
/opt/local/lib/libz.1.dylib
/usr/lib/libSystem.B.dylib
/usr/lib/libobjc.A.dylib
/usr/lib/libstdc++.6.dylib

This is why I have the same question:
So you mean anyone downloading the produced bundle should also install macports with the necessary libraries?
(And I wonder why there is /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL into).
« Last Edit: September 24, 2009, 08:47:38 AM by mirko.g »
Logged

Kry

  • Ex-developer
  • Retired admin
  • Hero Member
  • *****
  • Karma: -665
  • Offline Offline
  • Posts: 5795
Re: mac_packager
« Reply #10 on: September 24, 2009, 08:55:06 AM »

So you mean anyone downloading the produced bundle should also install macports with the necessary libraries?

What? The complete opposite. Re-read my post. I'm with a high fever and sick as hell, but I can't see how you would take that from my post.
Logged

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: mac_packager
« Reply #11 on: September 24, 2009, 09:25:39 AM »

Quote
I'm with a high fever and sick as hell
Oh, get well soon.

Have a look at the mac_packager script:
Code: [Select]
for i in $( otool -L    aMule.app/Contents/MacOS/amule \
                                                aMule.app/Contents/MacOS/amuleweb \
                                                aMule.app/Contents/MacOS/ed2k \
                                                aMule.app/Contents/MacOS/amulecmd \
                        | sort -u | grep libwx_ | cut -d " " -f 1 ); do
        cp $i aMule.app/Contents/Frameworks;
man otool tells us that the -L switch is used to Display the names and version numbers of  the  shared  libraries that the object file uses.. Object file in this case means the amule, amuleweb, ed2k and amulecmd applications. If you want to check for more applications, add them there.

Just as a reminder: | is the pipe character, it takes all output from one command and sends it as input to another command.

In our case it takes the names and version numbers of all shares libraries and sends it to the sort -u command. This command sorts the names and removes all duplicates.

The sorted list without duplicates is then sent to the grep filter command. The filter is libwx_, this means only libraries with libwx_ in their name will be used. The syntax to filter for multiple libraries would be grep 'libname1\|libname2\|libname3'.

Finally cut is used to separate the input data by a space (" ") and output only the first part. The input "/usr/lib/libnamea 1.2.3" would be separated to "/usr/lib/libnamea" and "1.2.3" and only "/usr/lib/libnamea" would be output.

In the end we get a list of library paths. We copy each of this libraries to the app bundle.


I believe the only thing to change is the grep command to include more libraries.
Logged

mirko.g

  • Global Moderator
  • Full Member
  • *****
  • Karma: 6
  • Offline Offline
  • Posts: 188
  • Grattatio pallorum omnia mala repellent!
    • Personal WebSite
Re: mac_packager
« Reply #12 on: September 24, 2009, 09:47:05 AM »

I believe the only thing to change is the grep command to include more libraries.

This is why I used:
Code: [Select]
for i in $( otool -L aMule.app/Contents/MacOS/* \
| sort -u | grep -E '/opt/local/|/usr/local/' | cut -d " " -f 1 ); do
cp $i aMule.app/Contents/Frameworks;
done

I've never seen any libwx_ into any (mac os) package since amule 2.2.3... but I can include it too...
Using the syntax above for grep we also need to respect dependencies, so this is necessary too:
Code: [Select]
for i in $( otool -L aMule.app/Contents/Frameworks/* \
| sort -u | grep -E '/opt/local|/usr/local/' | cut -d " " -f 1 ); do
cp $i aMule.app/Contents/Frameworks;
done
« Last Edit: September 24, 2009, 09:48:51 AM by mirko.g »
Logged

GonoszTopi

  • The current man in charge of most things.
  • Administrator
  • Hero Member
  • *****
  • Karma: 169
  • Offline Offline
  • Posts: 2685
Re: mac_packager
« Reply #13 on: September 24, 2009, 10:05:49 AM »

Re-read my post. I'm with a high fever and sick as hell, but I can't see how you would take that from my post.
Done, and wishing you the best to get well soon (all lowercase, without (TM) ;) ). I must have misunderstood you.

I believe the only thing to change is the grep command to include more libraries.
Seems to be. Looking at the list mirko.g quoted above, I'd change it to
Code: [Select]
grep -E -v '^\W*/System/|^\W*/usr/lib/'
to filter out system libraries, but that has to be verified by someone actually using mac_packager.
« Last Edit: September 24, 2009, 10:08:06 AM by GonoszTopi »
Logged
concordia cum veritate

wuischke

  • Developer
  • Hero Member
  • *****
  • Karma: 183
  • Offline Offline
  • Posts: 4292
Re: mac_packager
« Reply #14 on: September 24, 2009, 10:06:49 AM »

Oh, it looks like I could have spared my explanations, you know well enough what you do...stupid me for not checking your code first.

Anyway:
Quote
You need to modify it so it takes libraries that are not in the default system locations.
Reading this, grep -v '/usr/bin\|/any/other/system/directories' should do the job. I trust you know the relavant directories a lot better than me. ;-)
Logged
Pages: [1] 2