aMule Forum
English => Multiplatform => Mac OSX => Topic started by: mirko.g 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:
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.
-
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
-
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?
-
Yes, they do.
-
Attached a first patch (http://www.mac-factory.org/redmine/repositories/diff/macmule/script/mac_packager?rev=17&rev_to=15) 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).
-
That will fail badly for people like me, who don't install libraries.
-
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 (http://wiki.amule.org/index.php/HowTo_compile_on_Mac#Step_5:_Compile_aMule) 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
-
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.
-
So you mean anyone downloading the produced bundle should also install macports with the necessary libraries?
-
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?
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:
$ 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).
-
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.
-
I'm with a high fever and sick as hell
Oh, get well soon.
Have a look at the mac_packager script:
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.
-
I believe the only thing to change is the grep command to include more libraries.
This is why I used:
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:
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
-
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
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.
-
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:
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. ;-)
-
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.
Fortunately bash scripting is not new to me as Mac OS development... :P
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. ;-)
Seems to be. Looking at the list mirko.g quoted above, I'd change it to
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.
Inverting the sense of matching you won't filter object file names...
-
you won't filter object file names...
Should we? In my understanding otool -L (http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otool.1.html) doesn't produce object file names, nor does the example provided by you (http://forum.amule.org/index.php?topic=17291.msg93168#msg93168) show any.
-
Should we? In my understanding otool -L (http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/otool.1.html) doesn't produce object file names, nor does the example provided by you (http://forum.amule.org/index.php?topic=17291.msg93168#msg93168) show any.
I simply cut away the last line.
$ otool -L *
amule:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
/opt/local/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/opt/local/lib/libupnp.3.dylib (compatibility version 4.0.0, current version 4.5.0)
/opt/local/lib/libthreadutil.2.dylib (compatibility version 5.0.0, current version 5.3.0)
/opt/local/lib/libixml.2.dylib (compatibility version 3.0.0, current version 3.4.0)
/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
/System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/WebKit.framework/Versions/A/WebKit (compatibility version 1.0.0, current version 531.9.0)
/opt/local/lib/libiconv.2.dylib (compatibility version 8.0.0, current version 8.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.0.0)
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.0.0)
/System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.0.0)
ed2k:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 123.0.0)
/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.9.0)
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.0.0)
otool: can't map file: ed2kHelperScript.app (Invalid argument)
This is the normal output of otool even with one object only.
I should get rid of that error too... maybe this works:
for i in $( otool -L aMule.app/Contents/MacOS/* 2> /dev/null \
| sort -u | grep -E '/opt/local/|/usr/local/|libwx_' | cut -d " " -f 1 ); do
cp $i aMule.app/Contents/Frameworks;
done
for i in $( otool -L aMule.app/Contents/Frameworks/* 2> /dev/null \
| sort -u | grep -E '/opt/local/|/usr/local/|libwx_' | cut -d " " -f 1 ); do
cp $i aMule.app/Contents/Frameworks;
done
-
I should get rid of that error too...
Ok, using
grep -E -v '^\W*/System/|^\W*/usr/lib/|^\w'
will get rid of anything not indented (including error messages) besides system libraries (/System/*, /usr/lib/*). What do you think?
-
What do you think?
That's perfect! ;)
-
About GeoIP support, this works with libgeoip from MacPorts only and I don't know were the self-compiled version can store GeoIP.dat:
$ mkdir aMule.app/Contents/Resources/GeoIP
$ cp -p /opt/local/share/GeoIP/GeoIP.dat aMule.app/Contents/Resources/GeoIP
I don't know if this was in you intentions but it would be great if mac_packager toke care of extra tools too (otherwise, why should we compile them??? :P).
This is what I usually do by hand, for aMule:
$ cp src/amuled aMule.app/Contents/MacOS/
$ cp src/utils/aLinkCreator/src/alcc aMule.app/Contents/MacOS/
$ cp src/utils/cas/cas aMule.app/Contents/MacOS/
$ cp src/utils/fileview/mulefileview aMule.app/Contents/MacOS/
aMuleGUI:
$ cp src/amulegui aMuleGUI.app/Contents/MacOS/
$ cp src/amulecmd aMuleGUI.app/Contents/MacOS/
$ cp -R src/webserver aMuleGUI.app/Contents/Resources/
wxCas:
$ cp src/utils/wxCas/src/wxcas WxCas.app/Contents/MacOS/
aLinkCreator:
cp src/utils/aLinkCreator/src/alc aLinkCreator.app/Contents/MacOS/
And for every app I repeat step 3 to 5 of mac_packager.
Do I miss anything else?
(my last revision (http://www.mac-factory.org/redmine/repositories/annotate/macmule/script/mac_packager))
-
About GeoIP support, this works with libgeoip from MacPorts only and I don't know were the self-compiled version can store GeoIP.dat:
SVN is downloading the latest GeoIP.dat itself and stores it in aMule's config folder so don't bother packaging it. :)
-
Don't know if this can be useful: I rememmber that a user (gtoso) wrote a mac_packager to package not only the monolithic amule...
Try to give a look at http://gtoso.tor.it/pub/amule/osx/svn/OSXBuild/
Bye,
Mr Hyde
-
Don't know if this can be useful: I rememmber that a user (gtoso) wrote a mac_packager to package not only the monolithic amule...
Try to give a look at http://gtoso.tor.it/pub/amule/osx/svn/OSXBuild/
Thanks, good starting point... I was going the same direction: I will save a lot of time... ;)