Tuesday, August 18, 2009

MinGW: Building aMule for Windows

aMule is a peer-to-peer file-sharing program for Windows, Linux, Mac and *BSD. aMule can be used to share files with users of eMule. This post describes the steps I took in building aMule for Windows.


  1. First, install MinGW as shown in this post. Download pkg-config.exe and save it in /mingw/bin:



  2. Install Strawberry Perl or ActivePerl. If you've already unpacked aMule source, open src/libs/ec/file_generator.perl with a text editor and modify the first line. If ActivePerl is installed:
    #!/c/Perl/bin/perl

    If Strawberry Perl is installed:


    #!/c/strawberry/perl/bin/perl


  3. Download the Zlib source (zlib125.zip) and unpack it with unzip or 7zip. Then, compile Zlib like this:


    cd zlib-1.2.5/ 
    make -f win32/Makefile.gcc

    Manually copy the files as follows:


    cp -iv zlib1.dll /mingw/bin
    cp -iv zconf.h zlib.h /mingw/include
    cp -iv libz.a /mingw/lib
    cp -iv libzdll.a /mingw/lib/libz.dll.a


  4. Build wxMSW statically and monolithically as shown in this post. Alternatively, you can also build wxMSW as shared library.



  5. Download Crypto++ source (cryptopp560.zip) and extract it into a new folder:
    mkdir cryptopp
    cd cryptopp
    unzip ../cryptopp560.zip

    Prior to compiling Crypto++, I changed the line that define PREFIX at the beginning of GNUmakefile:


    # Default prefix for make install

    ifeq ($(PREFIX),)

    PREFIX = /mingw

    endif

    Then, I compiled Crypto++ with this command:


    make -f GNUmakefile

    Compile stopped on rijndael.cpp with the error: 'alloca' was not declared in this scope. So I added #include <malloc.h> to the beginning of rijndael.cpp and resumed make -f GNUmakefile. After make finished, I installed Crypto++ by typing:


    make -f GNUmakefile install

    The following files are installed under /mingw:


    bin/cryptest.exe

    include/cryptopp/

    lib/libcryptopp.a

  6. Download GeoIP source from here. Compile GeoIP like this:

    ./configure --prefix=/mingw LDFLAGS="-L/mingw/lib -lws2_32 -lz"

    make

    make install

    The following files are installed.


    include/GeoIP.h
    include/GeoIPCity.h
    /include/GeoIPUpdate.h
    lib/libGeoIP.a
    lib/libGeoIP.la
    lib/libGeoIPUpdate.a
    lib/libGeoIPUpdate.la

    I created GeoIP.dll as follows:


    cd libGeoIP/.libs

    mkdir ws2_32

    cd ws2_32

    ar x /mingw/lib/libws2_32.a

    cd ..

    dllwrap --export-all-symbols --add-stdcall-alias -o GEOIP.DLL --dllname
    GEOIP.DLL GeoIP.o GeoIPCity.o regionName.o timeZone.o ws2_32/dkrgs00086.o ws2_32/dkrgs00082.o ws2_32/dkrgs00081.o -L/mingw/lib -lws2_32 -lz

    Then, I created an import library for GeoIP.dll like this:


    echo EXPORTS > geoip.def

    nm GEOIP.DLL | grep ' T _' | sed 's/.* T _//' | grep -i geoip >> geoip.def

    dlltool --def geoip.def --dllname GEOIP.DLL --output-lib libgeoip.dll.a

    Move GEOIP.DLL to /mingw/bin and libgeoip.dll.a to /mingw/lib. Then, modify /mingw/lib/libGeoIP.la as necessary.



    # The name that we can dlopen(3).
    dlname='../bin/GEOIP.DLL'

    # Names of this library.
    library_names='libgeoip.dll.a'


  7. Build GNU regex library as shown in this post.



  8. Get the latest libiconv source (libiconv-1.13.1.tar.gz) and compile it like this:
    ./configure --prefix=/mingw --disable-shared
    make
    make install

    Then, get the latest gettext source (gettext-0.17.tar.gz) and compile it as follows:


    ./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable --disable-shared

    cd gettext-runtime

    make

    make install


  9. Get the aMule source and unpack it. I compiled aMule like this:


    ./configure --prefix=/mingw --enable-geoip --enable-amulecmd --enable-alc --enable-alcc --enable-nls --enable-rpath --enable-optimize --disable-debug

    make

    make install

    aMule installs the following files under /mingw:


    bin/amule.exe
    bin/autostart-xas
    bin/ed2k.exe
    lib/xchat/plugins/xas.pl
    man/de/man1/amule.1
    man/de/man1/ed2k.1
    man/de/man1/xas.1
    man/es/man1/amule.1
    man/es/man1/ed2k.1
    man/es/man1/xas.1
    man/eu/man1/amule.1
    man/eu/man1/ed2k.1
    man/eu/man1/xas.1
    man/fr/man1/amule.1
    man/fr/man1/ed2k.1
    man/hu/man1/amule.1
    man/hu/man1/ed2k.1
    man/hu/man1/xas.1
    man/man1/amule.1
    man/man1/ed2k.1
    man/man1/xas.1
    share/amule/skins/gnome.zip
    share/amule/skins/kde4.zip
    share/amule/skins/tango.zip
    share/amule/skins/xfce.zip
    share/applications/amule.desktop
    share/doc/aMule-2.2.5/ABOUT-NLS
    share/doc/aMule-2.2.5/Changelog
    share/doc/aMule-2.2.5/EC_Protocol.txt
    share/doc/aMule-2.2.5/ED2K-Links.HOWTO
    share/doc/aMule-2.2.5/INSTALL
    share/doc/aMule-2.2.5/README
    share/doc/aMule-2.2.5/TODO
    share/doc/aMule-2.2.5/amule-win32.HOWTO.txt
    share/doc/aMule-2.2.5/amulesig.txt
    share/doc/aMule-2.2.5/license.txt
    share/doc/aMule-2.2.5/socks4.protocol
    share/locale/ar/LC_MESSAGES/amule.mo
    share/locale/ast/LC_MESSAGES/amule.mo
    share/locale/bg/LC_MESSAGES/amule.mo
    share/locale/ca/LC_MESSAGES/amule.mo
    share/locale/cs/LC_MESSAGES/amule.mo
    share/locale/da/LC_MESSAGES/amule.mo
    share/locale/de/LC_MESSAGES/amule.mo
    share/locale/el/LC_MESSAGES/amule.mo
    share/locale/en_GB/LC_MESSAGES/amule.mo
    share/locale/es/LC_MESSAGES/amule.mo
    share/locale/et_EE/LC_MESSAGES/amule.mo
    share/locale/eu/LC_MESSAGES/amule.mo
    share/locale/fi/LC_MESSAGES/amule.mo
    share/locale/fr/LC_MESSAGES/amule.mo
    share/locale/gl/LC_MESSAGES/amule.mo
    share/locale/he/LC_MESSAGES/amule.mo
    share/locale/hr/LC_MESSAGES/amule.mo
    share/locale/hu/LC_MESSAGES/amule.mo
    share/locale/it/LC_MESSAGES/amule.mo
    share/locale/it_CH/LC_MESSAGES/amule.mo
    share/locale/ja/LC_MESSAGES/amule.mo
    share/locale/ko_KR/LC_MESSAGES/amule.mo
    share/locale/lt/LC_MESSAGES/amule.mo
    share/locale/nl/LC_MESSAGES/amule.mo
    share/locale/nn/LC_MESSAGES/amule.mo
    share/locale/pl/LC_MESSAGES/amule.mo
    share/locale/pt_BR/LC_MESSAGES/amule.mo
    share/locale/pt_PT/LC_MESSAGES/amule.mo
    share/locale/ru/LC_MESSAGES/amule.mo
    share/locale/sl/LC_MESSAGES/amule.mo
    share/locale/sq/LC_MESSAGES/amule.mo
    share/locale/sv/LC_MESSAGES/amule.mo
    share/locale/tr/LC_MESSAGES/amule.mo
    share/locale/uk/LC_MESSAGES/amule.mo
    share/locale/zh_CN/LC_MESSAGES/amule.mo
    share/locale/zh_TW/LC_MESSAGES/amule.mo
    share/pixmaps/amule.xpm

    To save disk space, you may choose to make the executable files smaller by running this command: strip *.exe


  10. aMule uses GeoIP data if it is built with GeoIP support. You can copy GeoIP.dat from the GeoIP source package to the aMule folder.
  11. Installing aMule is easy even without an installer. Just copy aMule and its files into a new folder, for example C:\Program Files\aMule. To create a shortcut in the Start menu, go to %APPDATA%\Microsoft\Windows\Start Menu and create a shortcut there.


Related Posts


No comments:

Post a Comment

About This Blog

KBlog logo This blog seeks to provide a collection of interesting pictures found on the Web. Thanks for visiting the blog and posting your comments.

© Contents by KBlog

© Blogger template by Emporium Digital 2008

Followers

Total Pageviews

Powered By Blogger