17 May 2014

Windows XP eXtended Patches

As expected MS are committed to support NT 5.1/5.2 OSes that are not at EOL period such POSReady 2009 (XP based) and most of Server 2003 lines. And our hero at RyanVM/MSFN has convert (ongoing) Post XP EOL updates so it can be installed into normal XP system.

Get it here

See Harkaz's ongoing Unofficial SP4 project here

Cool!

20 April 2014

PyGI AIO 3.12.x for Win32

With the new GObject-Introspection 1.40, gir generation now works with MinGW-W64 CRT and most docstrings issues seems been squashed too. GTK is not on Windows side though, version 3.12.1 looks buggier where an app (in this case gtk3-demo) will lose toplevel window (the one that is native and directed by OS), wish I have screenshot to show (I will). All 3.10  bugs also persist in 3.12, so despite of lots of new features it's really no good at the moment.

GTK 3.12.1 has lots of fixes in the Win32 theme (FYI, it's controlled by compiled-in css files namely gtk-win32*.css) which I tried to backport to 3.8.9 and 3.10.8 with some success, I also made correction on Windows XP specific part. But realized that perfect "theming emulation" is not possible yet with current css feature and event handling.

Overall there are new lots of libraries joined the AIO packages, with over 100 introspected libraries. The 64 bit port is not convincing... In some of my tests GI fail to resolve to existed exported functions of a dll, possibly getting skipped/mangled in the process. At C level, the libraries/apps behave just as good as 32 bit ones, so the problem is pygobject specific here.

Download for Python 32bit at:
http://sourceforge.net/projects/pygobjectwin32/files/

PyGObject homepage:
https://wiki.gnome.org/PyGObject

14 April 2014

Ternyata errornya Indosat kebablasan

Masalah routing "tersesat" Indosat ternyata belum selesai juga (sudah beberapa minggu). Masalah ini membuat pengguna yang hendak browsing jadi seperti diajak main togel. Soalnya rasio tidak tersesatnya 1:10 percobaan. Tapi buat pengguna yang suka download seperti saya ini bukan masalah besar. Lagipula untuk koneksi 128kbps mana bisa buat youtube/fesbuk mau buka buka google+ aja tidak selesai2 doh.

Tapi sebenarnya tinggal pakai Tor saja masalah hampir tuntas. Ya, hampir, karena mbah google agak paranoid sama proxy yang satu ini  (sering di blok) jadi harus pake bing atau lainnya buat pencarian. Dan tidak harus pakai Tor Browser, kamu bisa pakai privoxy sebagai jembatan antara Tor dengan apapun browser pilihanmu (saya masih pakai Opera 12) tinggal arahkan saja proxy addressnya ke localhost:8118 (ini port default-nya)

Kembali ke topik, lalu apanya yang kebablasan? Saya adalah pelanggan Starone unlimited, tepat sebulan lalu saya coba registrasi. Tapi setelah saya kirim INTERNET BLN ke 7825, balasan yang saya dapati adalah "Maaf ada kendala teknis, Silahkan ulangi beberapa saat lagi" lalu saya coba koneksi untuk sekedar cek email ternyata tersambung. Tapi saat saya cek pulsa ternyata belum terpotong biaya bulanan tapi juga tidak terpotong tarif premium  (yang seharusnya terjadi jika tidak berlangganan) justru saya dapat tambahan 23 yups tepat 23. Saya pikir ya sudahlah yang penting bisa ngenet lagi. :-)

Hari ini adalah hari untuk registrasi untuk 1 bulan ke depan, ternyata saya kembali mendapati hal yang sama. :-D

Bentuk kompensasikah? ha ha

O iya mumpung sedang nulis laman lokal, Saya ucapkan selamat untuk Pak Jokowi atas kemenangan PDIP, semoga jadi Presiden RI! JKW4P!

06 February 2014

What a handful Calculator !

I got lot of bitter experience with Windows 8.1 but still quite noob with it. Often I click the wrong shortcut for calculator from the start page where I launch App version instead of desktop version which on the next right list.

Just want to show that Software maker will race to make bloatware that parallel with current hardware level. MS said 8/8.1 has lower RAM requirement than 7 (well for some Windows 7 feature cut off that's already make sense). But probably they're after to compromise something else...

The inherently RAM sucker WindowsApp. After took several seconds to launch an eightened/flattened version of MS Calculator Plus (2005), I decide to look how much RAM it took.


A WindowsApp Calculator took 20MB (more than Virtual Box manager need)
A Vista/7 Calc need 3.5MB
And for the record XP Calc is about 750KB

That's roughly 5x increase for each generation to do the same task: crunching numbers. You could apply this comparison to other WindowsApp too. Also imagine if everything ported to WindowsApp...

Maybe when 32GB RAM  is common for consumer PC the next-gen calc will need 100MB to do "1+1" calculation... complete animated full 3d button with raytraced soft shadow and fully reflective OSD. Wait... at the moment it's backward evolution remember? we're heading to low tech mobile device where you can only view, read, write and play. Wake me up when Ipad can construct the next gen Game.

At the background of the screenshot, you can see the container of an App.. uhh ohh remind me of OSX's App bundle eh? Indeed while you could see numbers.exe there, it won't run by just double click on it (not in desktop mode at least). The container (the main folder) is a hierarchy of executable, settings and resources. This I think is how in the future apps will be standardized for Windows hmm I wonder. I need to have a look more at this stuff considering MS unlikely change their mind to retire desktop app in the future.

Windows 8.1 64bit was run as Guest under VirtualBox 4 under Windows XP 32bit

31 December 2013

A Retrospect for NT 5

This year I've been using Windows 7 for most of the time and only few month ago I decided to back on XP :-) and now it feels like at home again! In those period I found lot of bugs and the quirk of NT 6 so what's the point of getting new OS if you still have bugs to deal? No apparent productivity increase? Yes W7 doing good job at caching (just about everything that matter cached) but it's also a natural step as system with bigger RAM become common nevertheless XP can do some of that too though not as far.

When I go back with XP actually I just upgraded my system, now with 2.9 Ghz CPU and 8GB of RAM, thats right 8GB RAM equipped with 32bit Windows! I took a little experiment with Win 2003 32bit Enterprise (yep this version support BIG RAM), lot of tweaks required to make it behave like XP such as enabling hardware acceleration, sound, etc next I install RRamdisk because some apps refuse to run without pagefile. I allocate 512MB for OB intel GMA and 5GB for rramdisk (4GB pagefile and 1GB for %TEMP%) and it still spare 2.5GB of free RAM. Everything looks great and snappy. With this system I could run 16bit apps directly (OK via ntvdm) or run 64bit apps via VirtualBox. The key is multitasking, if your apps use RAM efficienly and the OS use less memory then you gain productivity! A 32bit apps usually well designed to work with e.g 2GB limit (so unlike 64bit app no need to worry about an app will eat your entire RAM!) though a further tweaks such /3GB ratio or editbin's LAA flagging will provide another scenario.

How about XP64bit? it still basically a dual system so more RAM needed.

I think about next year when XP no longer supported, well first I'm pretty sure the guys at MSFN will make unofficial Rollup Update like they do for Windows 2000. They made it able (to some extent) run some modern apps especially those not relying too much on Win32 API which updated in every major point release and things like .NET/Java. Before April doom come, I will give a test on that Windows 2000 inside Vbox (internet connected) to prove the 0day exploit buzz considering this Windows receive less patches than XP. If it's true then lets try freeze it with EWF/SteadyState, anyway I believe there many people still using it for good reason.

Happy new year XP! you are longest supported PC OS ever!

03 December 2013

Gametop.com Games without Gametop.com Redirection

I like this game library site, there are dozen HQ free racing (my favorite genre) games  for download. As we know the games upon exiting will launch your browser pointing to their site. There seems to be no catch here, no suspicious parameter etc. it's simply "open this url" call, although a googling for privacy concern of these games return a few security paranoid's comments.

Having a look from dependency walker I believe ShellExecute is responsible for the call. I try hex it with another same-length function name of shell32.dll (e.g. CheckEscapes) and yeah that's it.

EDIT:

Steps:
  1. Download and install free hex editor: WXHexeditor / HexEditor or HxD
    in this case I use HexEditor.
  2. Download the game, in this case Battle Rush.
  3. Browse battle rush executable, open it in HexEditor
  4. battle rush.exe
  5. In HexEditor pres Ctrl-H to bring Find and Replace dialog, find "ShellExecuteA" and for the replacement use "CheckExecutesA" click Replace All. You'll be asked to turn off read only mode, Click ok :
  6. Replace the function
  7. A confirmation of the function being replaced will shown like below. If not, it may be in another name e.g. "ShellExecuteW" -> "CheckEscapesW" just give it a try. You can now save the file. Try run it.
  8. Confirmation

05 November 2013

How to build PyGI AIO with Moluccas

Read about Moluccas first, its gcc has experimental CRT targeting for this guide.

MS CRT targeting initially laid by official mingw.org but still far incomplete. At first I thought it would be as easy as set cflag/cxxflag __MSVCRT_VERSION__=0x0900 and add -lmsvcr90 to GCC's specs file, well for a trivial program? yes it can but thats all it can get. As my experiment goes by there are many issues piling up (from incomplete msvcr implib to puzzled LFS/Y3K macros) that forcing me to modify mingw's crt and win32api files to allow a package completely linked to the new msvcrt dll. In the end I decided to add new GCC flags to simplify this: -vcr70 to -vcr110. The flags correspond msvcrt redist version bundled by each release of Visual C++. Even today it still far from complete.

What it has to do with this guide? there is an article wrote by win32 contributors of Gnome framework (or whatever you called it) that explain the concern. While my approach is far cry in comparison to use real thing (yeah I know MSVC has free express edition) it still useful in some cases at least for OSS zealot (even if they use Windoze).

This guide will focus on latest stable version of GTK-related (should be called GObject-related) libraries as this written. The main packages are Glib 2.38.1 + GTK 3.10.2 + GI 1.38.0 + PyGObject 3.10.1 and we are targeting python 3.3 (which use msvcr100.dll). I must tell you though, there is steady progress to support MSVC from upstream at least for major libraries including GI thingy.

If you don't need CRT targeting, you can use any GCC of your preference in moluccas by put it into moluccas root then switch over using setgcc [gcc folder name].

Download moluccas 0.8a, you need to download the following packages:

M08.exe
M08-basemsys.7z
M08-basetools.7z
M08-ccomp.7z newer gcc
M08-tex.7z
  1. Saves all of them in the same folder,
  2. Run M08.exe and specify install path (it's a portable installation). Click OK. Correction: If you have conemu instance(s) already run you need to quit all before clicking OK, see Maximus comment.
  3. The installer dialog will vanish quickly to bootstrap conemu and continue with extraction. Due to the sheer number of files, the extraction (write to harddisk) will be way slower than what the CPU capable of.
  4. Once completed, run conemu.exe to start
  5. Moluccas will try to detect any presence of Visual C++ and try to integrate the latest version you have. During first run it also initialize Miktex installation
  6. In the end conemu panel will bring the <^> prompt
  7. Type spawn to start an instance of conemu. The panel will hide and still accessible via systray icon.
Tarballs (very incomplete list!):
ftp://sourceware.org/pub/libffi/libffi-3.0.13.tar.gz
http://ftp.mozilla.org/pub/mozilla.org/js/mozjs17.0.0.tar.gz
http://zlib.net/zlib-1.2.8.tar.gz
http://ftp.gnu.org/gnu/gettext/gettext-0.18.3.2.tar.gz
http://ftp.jaist.ac.jp/pub/sourceforge/s/si/silgraphite/graphite2/graphite2-1.2.3.tgz
ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.8.tar.xz
http://cairographics.org/releases/pixman-0.30.2.tar.gz
http://cairographics.org/releases/cairo-1.12.16.tar.xz
git://git.gnome.org/gegl
git://git.gnome.org/babl
https://github.com/tdz/gtkglext.git
http://p11-glue.freedesktop.org/releases/p11-kit-0.20.2.tar.gz
http://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-1.2.3.tar.xz
http://gstreamer.freedesktop.org/src/gst-plugins-ugly/gst-plugins-ugly-1.2.3.tar.xz
http://gstreamer.freedesktop.org/src/gst-libav/gst-libav-1.2.3.tar.xz
https://github.com/openslide/openslide/releases/download/v3.3.3/openslide-3.3.3.tar.xz
https://github.com/downloads/libgit2/libgit2/libgit2-0.20.0.tar.gz
http://download.savannah.nongnu.org/releases/openexr/openexr-2.0.1.tar.gz
http://download.savannah.nongnu.org/releases/openexr/ilmbase-2.0.1.tar.gz
http://www.vips.ecs.soton.ac.uk/supported/current/vips-7.38.5.tar.gz
http://webkitgtk.org/releases/webkitgtk-1.10.2.tar.xz
http://ftp.twaren.net/Unix/NonGNU/freetype/freetype-2.5.2.tar.bz2
http://dbus.freedesktop.org/releases/dbus/dbus-1.6.18.tar.gz
http://dbus.freedesktop.org/releases/dbus-glib/dbus-glib-0.100.2.tar.gz
http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.11.0.tar.bz2
http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-0.9.26.tar.bz2
http://telepathy.freedesktop.org/releases/telepathy-glib/telepathy-glib-0.22.1.tar.gz
http://telepathy.freedesktop.org/releases/telepathy-rakia/telepathy-rakia-0.8.0.tar.gz
http://telepathy.freedesktop.org/releases/telepathy-idle/telepathy-idle-0.2.0.tar.gz
http://telepathy.freedesktop.org/releases/telepathy-gabble/telepathy-gabble-0.18.1.tar.gz
http://telepathy.freedesktop.org/releases/telepathy-logger/telepathy-logger-0.8.0.tar.bz2
https://github.com/nzjrs/osm-gps-map/archive/1.0.1.tar.gz
http://ftp.acc.umu.se/pub/GNOME/sources/libgda/5.2/libgda-5.2.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libgit2-glib/0.0/libgit2-glib-0.0.10.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gjs/1.38/gjs-1.38.1.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gtk+/3.10/gtk+-3.10.7.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gnome-common/3.10/gnome-common-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/pygobject/3.10/pygobject-3.10.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gobject-introspection/1.38/gobject-introspection-1.38.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/goffice/0.10/goffice-0.10.10.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gdk-pixbuf/2.30/gdk-pixbuf-2.30.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libgsf/1.14/libgsf-1.14.29.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/clutter/1.16/clutter-1.16.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/cogl/1.16/cogl-1.16.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gst/2.0/clutter-gst-2.0.10.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gtk/1.4/clutter-gtk-1.4.4.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/geocode-glib/3.10/geocode-glib-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/pango/1.36/pango-1.36.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/glib/2.38/glib-2.38.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/glib-networking/2.38/glib-networking-2.38.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gdl/3.10/gdl-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/glade/3.16/glade-3.16.1.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/glade/3.16/glade-3.15.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/ghex/3.10/ghex-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gedit/3.10/gedit-3.8.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gedit-plugins/3.10/gedit-plugins-3.8.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gjs/1.38/gjs-1.38.1.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gstreamer/1.2/gstreamer-1.2.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gst-plugins-base/1.2/gst-plugins-base-1.2.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gst-plugins-good/1.2/gst-plugins-good-1.2.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libgee/0.12/libgee-0.12.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gtk-vnc/0.5/gtk-vnc-0.5.3.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/seed/3.8/seed-3.8.1.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gtksourceview/3.10/gtksourceview-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/devhelp/3.10/devhelp-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/atk/2.10/atk-2.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gucharmap/3.10/gucharmap-3.10.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/json-glib/0.16/json-glib-0.16.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/gexiv2/0.7/gexiv2-0.7.0.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libchamplain/0.12/libchamplain-0.12.6.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libsoup/2.44/libsoup-2.44.2.tar.xz
http://ftp.acc.umu.se/pub/GNOME/sources/libpeas/1.9/libpeas-1.9.0.tar.xz

You may use wget and tar to extract or doing it with your browser and 7zip. Just be sure to extract them somewhere in non spaced path name.

In moluccas there is 5 different GCC, each has specific purpose: gcc3, mingw32, mingw-w64, gcc64 and msysdev. Those are just folder name where each reside (not "actual" name), the default is mingw32 (gcc 4.7.3 based on mingw.org) which is still de-facto standard (meaning: you get less trouble). Gcc3 (gcc 3.4.6) is the oldest, msysdev (gcc 3.4.4) is for making msys binary, mingw-w64 is a 32/64 multilib gcc 4.7.3 based on ming-w64 project and lastly gcc64 is the new gcc 4.8.1 targeting 64bit only and has SEH support. For now on when I say mingw32 or gcc3 I really mean the active gcc used in moluccas.

Before start compiling we need to prepare compiler flags. Moluccas gcc 4.7 has internal flags: -march=pentium-m -mfpmath=sse or roughly say "turned on all intrinsic optimizations up to SSE2 and use SSE2 for math too". But I found SSE2 sometime lead undesirable result, in this case the C based apps appear doing fine but in python mode it silently crashed. So just to be safe we will detune it a bit by adding -mno-sse2. Moluccas also has default cflags/cxxflags as -Os and ldflags -Wl,-s this is just my preference, feel free to modify it. For release mode I would add another flags -fno-unwind-tables -fno-asynchronous-unwind-tables which are specific to mingw32 to strip further some features of dwarf-2. For CRT targeting use -vcr100 in both compile and linking flags, in accordance to MSVC this means use msvcr100.dll, drop some POSIX named functions (yeah damn MS), turn on Y3K but not LFS. But I want LFS here so to turned it on add -D_FILE_OFFSET_BITS=64. Should match with how python built

The gotchas:
As we already know MSVCRT 8 and 9 (for targeting python 2.7) use side by side installation (those piling up stuff in %WINDIR%\WinSxS) but not with version 10 and later. Those SxS need an executable to be manifested to "find" the correct version of the dll. In reality though, it will use the latest installed redist. Non manifested will throw error, moluccas' gcc 4.7 will do this job by append precompiled manifest file before sending it to ld (linker). However if executable already use resource (.rc) file, the result there will be two resources at the end of PE with only the first laid recognized (the manifest discarded) which not what I want :-(. So if you have Windows SDK detected by moluccas there is mt8/mt9 command to clear the issue. This is undesired because during compile sometime the newly built exe immediately used to do something.
The next gotcha is libtool and C++, by default in a C++ project libtool will override g++ behavior by enabling -nostdlib and reconstructed the objects files and PE stubs *including* the linker flags "the way libtool want it to be". Thus break the purpose of -vcrXX (actually it strip the flag out carelessly), it even strip valid linker flag such -pthread. I don't know if there a way to override this behavior because fixing it from configure script is quite PITA.
When used with mingw32 flags that trigger __STRICT_ANSI__ will break CRT targeting because those underscore prefixed stuff being disabled. So -std=blablabla flags should be disabled (this only true for mingw.org Win32 CRT)
Another gotcha is LFS and Y3K (64bit file offset and time), LFS:off and Y3K:on is how official 32bit python build, LFS:off and Y3K:off is the how official GLib (see glib\gstdio.c) build for windows 32bit. And here I opt to turn all on. Hence it's ABI breaking if we try to mixed Glib' dlls.
Let's start with non gobject related ones. When I say "gobject related" it mean those that depend on Glib, others like cairo and harfbuzz are borderline, they are independent but can be configured to support gobject.

For make install there is the usual /usr/local which by the default has higher priority in $PATH environment than /usr/bin (msys realm). In this guide it's bad because some of packages will install executable that clash with msys' binaries. I would recommend create different folder and append it to $PATH instead, but for now lets just rename those conflicting files.

Patches:
https://sourceforge.net/projects/pygobjectwin32/files/patches/

Buildscript:

#!/bin/sh

set -e

if [ "$1" == "" ] || [ "$2" == "" ]; then echo "need bitness and runtime version arguments";exit; fi
if [ "$NUMBER_OF_PROCESSORS" != "" ]; then export PJOBS=-j$NUMBER_OF_PROCESSORS; else export PJOBS=""; fi
export CPUARCH=$1
export lt_cv_dllsearchpath="./.libs"
if [ "$1" == "64" ]; then export MULTILIB=$1; fi
if [ -f /opt/bin/mt.exe ]; then export MSSDK=1; fi
if [ "$MULTILIB" == "64" ]; then 
    if [ "$PROCESSOR_ARCHITEW6432" == "AMD64" ] || [ "$PROCESSOR_ARCHITECTURE" == "AMD64" ]; then
        triplet="--host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32"
        alias configure="configure $triplet"
    else
        triplet="--host=x86_64-w64-mingw32"
        alias configure="configure $triplet"
        CROSSX=1
    fi
    # these only required for multilib/multitarget GCC for few packages
    # *64.exe are taken from x86_64-w64-mingw32 binutils
    cp /gccw64sjlj/bin/as64.exe /gccw64sjlj/bin/as.exe
    cp /gccw64sjlj/bin/windres64.exe /gccw64sjlj/bin/windres.exe
    cp /gccw64sjlj/bin/dlltool64.exe /gccw64sjlj/bin/dlltool.exe
    # need to be disabled because of forking issue with msys' sh when launched by 64bit python
    export INTROSPECT=--enable-introspection=no
else
    alias configure="configure"
    cp /gccw64sjlj/bin/as32.exe /gccw64sjlj/bin/as.exe
    cp /gccw64sjlj/bin/windres32.exe /gccw64sjlj/bin/windres.exe
    cp /gccw64sjlj/bin/dlltool32.exe /gccw64sjlj/bin/dlltool.exe
    export INTROSPECT=--enable-introspection=yes
fi
source setgcc gccw64sjlj

if [ "$2" == "90" ];then alias manifest='cmd //c /opt/bin/mtall90.bat'; else alias manifest=""; fi
RTVER="-m$1 -vcr$2"
if [ "$3" == "" ]; then export IPATH=/local; else export IPATH=$3; fi

export PKG_CONFIG_PATH=$IPATH/lib/pkgconfig:$IPATH/share/pkgconfig
export CPPFLAGS="-I$IPATH/include"
export LDFLAGS="$RTVER -Wl,-s -L$IPATH/lib"
export CC="gcc $RTVER"
export CXX="g++ $RTVER"
export CFLAGS="$RTVER -Os -mno-sse3 -fno-lto -D_FILE_OFFSET_BITS=64 -fno-unwind-tables -fno-asynchronous-unwind-tables "
export CXXFLAGS="$RTVER -Os -mno-sse3 -fno-lto -D_FILE_OFFSET_BITS=64 -fno-unwind-tables -fno-asynchronous-unwind-tables "
export MOZ_TOOLS=/opt/bin
if [ "$CROSSX" == "1" ]; then
    # static build exes with no dependencies
    export GLIB_GENMARSHAL=/opt/bin/glib-genmarshal
    export GLIB_COMPILE_SCHEMAS=/opt/bin/glib-compile-schemas
    export GLIB_COMPILE_RESOURCES=/opt/bin/glib-compile-resources
    export DBUS_BINDING_TOOL=/opt/bin/dbus-binding-tool
    export ORCC=/opt/bin/orcc
    export GTK_UPDATE_ICON_CACHE=/opt/bin/gtk-update-icon-cache 
    export GDK_PIXBUF_CSOURCE=/opt/bin/gdk-pixbuf-csource
fi
export SPATH=/d/Sources

:<<'XXX'
XXX

cd $SPATH/zlib-1.2.8
make -f win32/Makefile.gcc clean
make -f win32/Makefile.gcc $PJOBS install INCLUDE_PATH=$IPATH/include BINARY_PATH=$IPATH/bin LIBRARY_PATH=$IPATH/lib
cd $SPATH/bzip2
make -f Makefile clean
make -f Makefile-libbz2_so $PJOBS 
cp bzlib.h $IPATH/include
ar cru $IPATH/lib/libbz2.a bzlib.o blocksort.o compress.o crctable.o decompress.o huffman.o randtable.o
ranlib $IPATH/lib/libbz2.a
cd $SPATH/xz-5.0.5
configure --enable-small --disable-shared --enable-assume-ram=1024 --disable-nls 
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la
cd $IPATH/lib
$CC $LDFLAGS -shared -o ../bin/libzzz.dll -Wl,--out-implib,libz.dll.a -Wl,--whole-archive libz.a liblzma.a libbz2.a -Wl,--no-whole-archive
cp libz.dll.a liblzma.dll.a 
cp libz.dll.a libbz2.dll.a

cd $SPATH/win-iconv
make clean
make libiconv.a
cp iconv.h $IPATH/include
cp libiconv.a $IPATH/lib

cd $SPATH/libffi-3.0.13
configure --disable-static --enable-portable-binary CFLAGS="$CFLAGS -O2"
make clean
make $PJOBS install
if [ -f $IPATH/lib64/libffi.dll.a ]; then
mv $IPATH/lib64/libffi.* $IPATH/lib
fi
rm $IPATH/lib/*.la

#cd $SPATH/glew-1.10.0
#make clean
#make install GLEW_DEST=$IPATH
#rm -f $IPATH/lib/libglew32.dll.a $IPATH/bin/glew32.dll

cd $SPATH/gettext-0.18.3.2/gettext-runtime
if [ -f $IPATH/lib/libiconv.dll.a ]; then
rm $IPATH/lib/libiconv.dll.a
fi
configure --with-included-libxml --without-emacs --with-included-libcroco --with-included-libunistring --with-included-glib --with-included-gettext --disable-static --disable-java --disable-csharp --enable-threads=win32
cd intl
make clean
make $PJOBS 
manifest
make install
rm $IPATH/lib/*.la
cp $IPATH/lib/libintl.dll.a $IPATH/lib/libiconv.dll.a

cd $SPATH/libpng-1.6.10
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/jbigkit/libjbig
make clean
make $PJOBS
cp *.h $IPATH/include
cp *.a $IPATH/lib
cd $SPATH/jpeg/
if [ ! -d $IPATH/include/jpeg12 ]; then mkdir $IPATH/include/jpeg12; fi
cp *.h $IPATH/include/jpeg12

cd $SPATH/jpeg-8d
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/tiff-4.0.3
configure --disable-static --disable-cxx --enable-jpeg12 --with-jpeg12-include-dir=`msyspath -m $IPATH/include/jpeg12` --with-jpeg12-lib=-ljpeg
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/jasper
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libwebp-0.3.1
configure --disable-static --enable-experimental
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libxml2-2.9.1
configure --without-python
make clean
make $PJOBS install
rm $IPATH/lib/*.la
#do not interfere msys
rm $IPATH/bin/xmlcatalog.exe $IPATH/bin/xmllint.exe

cd $SPATH/expat-2.1.0
configure
make clean
make $PJOBS install
#rm $IPATH/lib/*.la $IPATH/bin/libxslt-1.dll $IPATH/bin/libxml2-2.dll $IPATH/bin/libexpat-1.dll $IPATH/bin/libexslt-0.dll
#$CC libxmlxslt.def -shared -o $IPATH/bin/libxmlxslt.dll $LDFLAGS -Wl,--whole-archive $IPATH/lib/libxml2.a $IPATH/lib/libexpat.a $IPATH/lib/libxslt.a $IPATH/lib/libexslt.a -Wl,--no-whole-archive -lz -lintl -lws2_32 -Wl,--out-implib,$IPATH/lib/libxml2.dll.a
#cp $IPATH/lib/libxml2.dll.a $IPATH/lib/libexslt.dll.a 
#cp $IPATH/lib/libxml2.dll.a $IPATH/lib/libxslt.dll.a 
rm $IPATH/lib/*.la $IPATH/bin/libxml2-2.dll $IPATH/bin/libexpat-1.dll
$CC -shared -Wl,--export-all-symbols -o $IPATH/bin/libxmlxpat.dll $LDFLAGS -Wl,--whole-archive $IPATH/lib/libxml2.a $IPATH/lib/libexpat.a -Wl,--no-whole-archive -lz -lintl -lws2_32 -Wl,--out-implib,$IPATH/lib/libxml2.dll.a
cp $IPATH/lib/libxml2.dll.a $IPATH/lib/libexpat.dll.a

cd $SPATH/dbus-1.8.0
configure --disable-static --disable-Werror
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/glib-2.40.0
configure --disable-static --with-threads=win32 CFLAGS="$CFLAGS -O2"
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la
cp $IPATH/include/libintl.h $IPATH/include/glib-2.0
cp gio/gwin32*stream.h $IPATH/include/glib-2.0/gio
#just in case
if [ "$CROSSX" == "1" ]; then
echo 'exec /opt/bin/${0##*/}.exe "$@"' > $IPATH/bin/glib-genmarshal
echo 'exec /opt/bin/${0##*/}.exe "$@"' > $IPATH/bin/glib-compile-schemas
echo 'exec /opt/bin/${0##*/}.exe "$@"' > $IPATH/bin/glib-compile-resources
fi

cd $SPATH/dbus-glib-0.102
if [ "$CROSSX" == "1" ]; then
if [ -f $IPATH/bin/glib-genmarshal.exe ]; then
mv $IPATH/bin/glib-genmarshal.exe $IPATH/bin/glib-genmarshal.bak
fi
configure --disable-static --disable-tests --with-dbus-binding-tool=/opt/bin/dbus-binding-tool
else
configure --disable-static --disable-tests
fi
make clean
make $PJOBS install
#just in case
#echo 'exec /opt/bin/${0##*/}.exe "$@"' > $IPATH/bin/dbus-binding-tool
rm $IPATH/lib/*.la
if [ "$CROSSX" == "1" ]; then
    if [ -f $IPATH/bin/glib-genmarshal.exe ]; then
    mv $IPATH/bin/glib-genmarshal.bak $IPATH/bin/glib-genmarshal.exe
    fi
fi

cd $SPATH/freetype-2.5.2
configure --disable-static --prefix=$IPATH LIBPNG_CFLAGS="-I$IPATH/include/libpng16" LIBPNG_LDFLAGS="-lpng16"
make clean
make $PJOBS install
rm $IPATH/lib/*.la $IPATH/bin/freetype-config

cd $SPATH/fontconfig-2.11.1
configure --disable-static --enable-iconv --disable-docs LIBS=-lregex
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/pixman-0.32.4
if [ -f $IPATH/lib/libpixman-1.dll.a ];then
rm $IPATH/lib/libpixman-1.dll.a
fi
configure --disable-shared --disable-ssse3
make  clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/cairo-1.12.16
#configure --disable-interpreter --enable-wgl --enable-gl --enable-xml --disable-egl CPPFLAGS="$CPPFLAGS -DGLEW_STATIC"
configure --disable-interpreter
make clean
make $PJOBS install
rm $IPATH/lib/*.la $IPATH/bin/libcairo-2.dll 
cd util/cairo-gobject
$CC -shared cairo_pixman_gobject.def -Wl,--whole-archive ../../src/.libs/libcairo.a .libs/libcairo-gobject.a -Wl,--no-whole-archive -o $IPATH/bin/libcairo-gobject-2.dll $LDFLAGS -lpixman-1 -lgdi32 -lpng -lz -lfontconfig -lfreetype -ldl -lgobject-2.0 -lglib-2.0 -lwinspool -lmsimg32 -Wl,--out-implib,$IPATH/lib/libcairo-gobject.dll.a
cp $IPATH/lib/libcairo-gobject.dll.a $IPATH/lib/libcairo.dll.a 
cp $IPATH/lib/libcairo-gobject.dll.a $IPATH/lib/libpixman-1.dll.a

for i in 27 31 32 33 34; do
    if [ "$MULTILIB" == "64" ] && [ "$CPUARCH" == "$MULTILIB" ]; then
        gendef - ${SYS64DIR}python$i.dll > $IPATH/lib/python$i.def
        dlltool  --as-flags=--64 -m i386:x86-64 -d $IPATH/lib/python$i.def -D python$i.dll -l $IPATH/lib/libpython$i.dll.a
    else
        gendef - ${SYSTEMROOT}\\system32\\python$i.dll > $IPATH/lib/python$i.def
        dlltool -d $IPATH/lib/python$i.def -D python$i.dll -l $IPATH/lib/libpython$i.dll.a
    fi
    if [ ! -d $IPATH/py$i/lib/site-packages ]; then
        mkdir -p $IPATH/py$i/lib/site-packages
    fi
done
cp $IPATH/lib/libpython34.dll.a $IPATH/lib/libpython3.4.dll.a
cp $IPATH/lib/libpython33.dll.a $IPATH/lib/libpython3.3.dll.a
cp $IPATH/lib/libpython32.dll.a $IPATH/lib/libpython3.2.dll.a
cp $IPATH/lib/libpython31.dll.a $IPATH/lib/libpython3.1.dll.a
cp $IPATH/lib/libpython27.dll.a $IPATH/lib/libpython2.7.dll.a

cd $SPATH/dbus-python-1.2.0
for i in 27 31 32 33 34; do
configure PYTHON=python$i --disable-html-docs --disable-api-docs --prefix=$IPATH/py$i
make clean
make $PJOBS install
done

cd $SPATH/gobject-introspection-1.40.0
# girs missing shared-library 
configure --with-cairo --disable-static PYTHON=python27
make clean
if [ "$MULTILIB" == "64" ]; then
make install-libLTLIBRARIES
make install-girepoHEADERS
make install-pkgconfigDATA
else
make install
fi
rm $IPATH/lib/*.la

cd $SPATH/py2cairo-1.10.0/src
if [ ! -d $IPATH/py27/lib/site-packages/cairo ]; then
mkdir -p $IPATH/py27/lib/site-packages/cairo
fi
if [ ! -d $IPATH/include/pycairo ]; then
mkdir $IPATH/include/pycairo
fi
$CC -shared $CFLAGS -I. `python27-config --cflags` `pkg-config --cflags cairo` -o $IPATH/py27/lib/site-packages/cairo/_cairo.pyd *.c $LDFLAGS `python27-config --ldflags` `pkg-config --libs cairo`
cp __init__.py $IPATH/py27/lib/site-packages/cairo
cp pycairo.h $IPATH/include/pycairo
cp pycairo.pc $IPATH/lib/pkgconfig

cd $SPATH/pycairo-1.10.0/src
for i in 31 32 33 34; do
    if [ ! -d $IPATH/py$i/lib/site-packages/cairo ]; then
        mkdir -p $IPATH/py$i/lib/site-packages/cairo
    fi
    $CC -shared $CFLAGS -I. `python$i-config --cflags` `pkg-config --cflags cairo` -o $IPATH/py$i/lib/site-packages/cairo/_cairo.pyd *.c $LDFLAGS `python$i-config --ldflags` `pkg-config --libs cairo`
    cp __init__.py $IPATH/py$i/lib/site-packages/cairo
done
cp py3cairo.h $IPATH/include/pycairo
cp py3cairo.pc $IPATH/lib/pkgconfig

cd $SPATH/pygobject-3.12.1
for i in 27 31 32 33 34; do
configure --enable-cairo --enable-compile-warnings=minimum --with-python=python$i --prefix=$IPATH/py$i LIBS=-lffi
make clean
make $PJOBS install
done

cd $SPATH/graphite2-1.2.4
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_FLAGS="$CPPFLAGS -DGRAPHITE2_STATIC"
make clean
make $PJOBS
make install
cp src/CMakeFiles/graphite2.dir/objects.a $IPATH/lib/libgraphite2.a
rm $IPATH/lib/libgraphite2.dll.a $IPATH/bin/libgraphite2.dll

cd $SPATH/harfbuzz-0.9.27
# need to fix unneeded dll in shared-library
configure --enable-static --with-uniscribe --with-graphite2 --with-gobject $INTROSPECT CPPFLAGS="$CPPFLAGS -DGRAPHITE2_STATIC" 
make clean
make $PJOBS install 
rm $IPATH/lib/*.la $IPATH/bin/libharfbuzz-0.dll
cd src
$CXX -shared harfbuzz-gobject.def .libs/libharfbuzz_gobject_la-hb-gobject-structs.o .libs/libharfbuzz_gobject_la-hb-gobject-enums.o .libs/libharfbuzz.a $LDFLAGS -lgraphite2 -lgobject-2.0 -lglib-2.0 -lws2_32 -lole32 -lwinmm -lshlwapi -lintl -lfreetype -lpng16 -lz -lusp10 -lgdi32 -lrpcrt4  -o $IPATH/bin/libharfbuzz-gobject-0.dll -Wl,--out-implib,$IPATH/lib/libharfbuzz-gobject.dll.a
cp $IPATH/lib/libharfbuzz-gobject.dll.a $IPATH/lib/libharfbuzz.dll.a

cd $SPATH/atk-2.12.0
configure --disable-static $INTROSPECT
make clean
make $PJOBS 
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/pango-1.36.3
configure --disable-static --with-included-modules --with-dynamic-modules=no  $INTROSPECT
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gdk-pixbuf-2.30.7
configure --disable-static --with-included-loaders=png --disable-modules $INTROSPECT
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/libcroco-0.6.8
configure --disable-shared --enable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/librsvg-2.40.2
configure --disable-static --disable-pixbuf-loader $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gdk-pixbuf-2.30.7
configure $INTROSPECT --disable-static --with-included-loaders  --with-gdiplus --with-libjasper --with-libtiff --with-libjpeg --disable-modules CPPFLAGS="$CPPFLAGS -I$IPATH/include/librsvg-2.0/librsvg -I$IPATH/include/cairo" LIBS="-lrsvg-2 -lwebp -ljpeg -lgdiplus"
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gtk+-3.8.9
set +e
rm gtk/gtkbuiltincache.h 
rm gtk/stock-icons/icon-theme.cache
set -e
if [ "$CROSSX" == "1" ]; then
configure --enable-win32-backend --with-included-immodules --enable-gtk2-dependency PKG_CONFIG_FOR_BUILD=pkg-config --prefix=$IPATH/gtkold $INTROSPECT
else
configure --enable-win32-backend --with-included-immodules --prefix=$IPATH/gtkold $INTROSPECT
fi
make clean
make $PJOBS
manifest
make install
rm $IPATH/gtkold/lib/*.la

cd $SPATH/gtk+-3.10.8
set +e
rm gtk/gtkbuiltincache.h 
rm gtk/stock-icons/icon-theme.cache
rm gtk/extract-strings.exe
rm gtk/extract-strings
set -e
if [ "$CROSSX" == "1" ]; then
configure --enable-win32-backend --with-included-immodules --enable-broadway-backend --enable-gtk2-dependency PKG_CONFIG_FOR_BUILD=pkg-config $INTROSPECT
echo 'exec /opt/bin/${0##*/}.exe "$@"' > gtk/extract-strings
else
configure --enable-win32-backend --with-included-immodules --enable-broadway-backend $INTROSPECT CC_FOR_BUILD="$CC"
fi
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gnome-themes-standard-3.10.0
configure --disable-gtk2-engine
make clean
make $PJOBS install

cd $SPATH/hicolor-icon-theme-0.12
configure
make install
if [ ! -d $IPATH/share/icons/gnome ]; then
mkdir -p $IPATH/share/icons/gnome
cp $IPATH/share/icons/hicolor/index.theme $IPATH/share/icons/gnome
fi

cd $SPATH/iso-codes-3.23
configure
make clean
make install

cd $SPATH/gsettings-desktop-schemas-3.12.0
configure $INTROSPECT
make clean
make install

cd $SPATH/icon-naming-utils-0.8.90
configure
make install

cd $SPATH/gnome-icon-theme-symbolic-3.12.0
configure
make clean
make install

cd $SPATH/libnotify-0.7.6
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libexif
configure --disable-shared --disable-nls
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/orc-0.4.18
configure --disable-static --enable-backend=sse,mmx
make clean
make $PJOBS install
rm $IPATH/lib/*.la
#just in case
if [ "$CROSSX" == "1" ]; then
echo 'exec /opt/bin/${0##*/}.exe "$@"' > $IPATH/bin/orcc
fi

cd $SPATH/gstreamer-1.2.3
configure --disable-static  $INTROSPECT --enable-check
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libogg
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/aotuv
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libtheora
configure --disable-shared --disable-spec --disable-examples
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/celt-0.5.1.3
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/opus-1.1
configure --disable-shared --enable-float-approx --enable-custom-modes
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/flac-1.3.0
configure --disable-shared --enable-sse
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libvisual-0.4.0
configure --disable-nls
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gst-plugins-base-1.2.3
configure --disable-static  $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/SDL-1.2.15
configure --disable-shared --disable-stdio-redirect
make clean
make $PJOBS install
rm $IPATH/lib/*.la $IPATH/bin/sdl-config

cd $SPATH/json-glib-1.0.0
configure --disable-static  $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/cogl-1.18.0
configure --enable-static --enable-sdl --enable-cogl-gst $INTROSPECT
make clean
make $PJOBS install
$CC coglpath.def -shared $LDFLAGS -o $IPATH/bin/libcogl-20.dll -Wl,--whole-archive $SPATH/cogl-1.18.0/cogl/.libs/libcogl.a $SPATH/cogl-1.18.0/cogl-path/.libs/libcogl-path.a -Wl,--no-whole-archive -Wl,--out-implib,$IPATH/lib/libcogl.dll.a `pkg-config --libs gobject-2.0 gmodule-no-export-2.0 gdk-pixbuf-2.0 sdl` -lopengl32
cp $IPATH/lib/libcogl.dll.a $IPATH/lib/libcogl-path.dll.a
mv $IPATH/lib/bin/libgstcogl.dll $IPATH/lib/gstreamer-1.0/libgstcogl.dll
rm $IPATH/lib/*.la $IPATH/bin/libcogl-path-20.dll

cd $SPATH/clutter-1.18.2
configure --disable-static  $INTROSPECT
make clean
if [ -f clutter/win32/resources.o ];then
rm clutter/win32/resources.o
fi
make $PJOBS 
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/clutter-box2d-master
configure --disable-static $INTROSPECT
make clean
make $PJOBS 
make install
rm $IPATH/lib/*.la

cd $SPATH/clutter-gtk-1.5.2
configure --disable-static --enable-debug=minimum $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libidn-1.28
configure --disable-static --disable-nls --disable-csharp --disable-java 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgpg-error-1.12
echo '#!/bin/sh
exec /opt/bin/win_iconv.exe "$@"' > $IPATH/bin/iconv
if [ -f $IPATH/lib/libgpg-error.dll.a ]; then
rm $IPATH/lib/libgpg-error.dll.a
fi
if [ "$CROSSX" == "1" ]; then
configure --disable-shared --enable-static --disable-nls CC_FOR_BUILD=/mingw32/bin/gcc.exe
else
configure --disable-shared --enable-static --disable-nls
fi
make clean
make $PJOBS install
rm $IPATH/lib/*.la
rm $IPATH/bin/iconv

cd $SPATH/libgcrypt-1.5.3
if [ -f $IPATH/lib/libgcrypt.dll.a ]; then
rm $IPATH/lib/libgcrypt.dll.a
fi
if [ "$MULTILIB" == "64" ]; then
    if [ "$CROSSX" == "1" ]; then
    configure --disable-shared --disable-asm --disable-padlock-support CC_FOR_BUILD=/mingw32/bin/gcc.exe
    else
    configure --disable-shared --disable-asm --disable-padlock-support
    fi
else 
configure --disable-shared
fi
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libtasn1-2.14
if [ -f $IPATH/lib/libtasn1.dll.a ]; then
rm $IPATH/lib/libtasn1.dll.a
fi
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/p11-kit-0.20.2
configure --disable-static --without-trust-paths --disable-nls LIBS=-lffi
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gnutls-2.12.23
if [ -f $IPATH/lib/libgcrypt.dll.a ]; then
rm $IPATH/lib/libgcrypt.dll.a
fi
if [ -f $IPATH/lib/libtasn1.dll.a ]; then
rm $IPATH/lib/libtasn1.dll.a
fi
if [ -f $IPATH/lib/libgpg-error.dll.a ]; then
rm $IPATH/lib/libgpg-error.dll.a
fi
configure --disable-static --disable-nls --with-libgcrypt --with-included-libtasn1 --disable-guile --disable-openssl-compatibility --disable-cxx
make clean
make 
make $PJOBS install
rm $IPATH/lib/*.la
cp $IPATH/lib/libgnutls.dll.a $IPATH/lib/libtasn1.dll.a
cp $IPATH/lib/libgnutls.dll.a $IPATH/lib/libgcrypt.dll.a
cp $IPATH/lib/libgnutls.dll.a $IPATH/lib/libgpg-error.dll.a

cd $SPATH/p11-kit-0.20.2
configure --disable-static --without-trust-paths --disable-nls LIBS=-lffi
make clean
make $PJOBS install
rm $IPATH/lib/*.la

# what a troublesome configure
export CC__=$CC
export CXX__=$CXX
export CC=gcc
export CXX=g++
cd $SPATH/openssl-1.0.1g
./configure shared mingw$MULTILIB zlib threads --prefix=$IPATH $CFLAGS $LDFLAGS
make clean
make
make install
export CC=$CC__
export CXX=$CXX__
unset CC__
unset CXX__
rm -f $IPATH/lib/libcrypto.dll.a $IPATH/lib/libssl.dll.a $IPATH/bin/libeay32.dll $IPATH/bin/ssleay32.dll
$CC -shared -o $IPATH/bin/libopenssl.dll -Wl,--out-implib,$IPATH/lib/libssl.dll.a -Wl,--whole-archive libssl.a libcrypto.a -Wl,--no-whole-archive $LDFLAGS -lz -lws2_32 -lgdi32 -lcrypt32 -lsecur32
cp $IPATH/lib/libssl.dll.a $IPATH/lib/libcrypto.dll.a

cd $SPATH/libssh2-1.4.3
configure --disable-shared --enable-static --with-openssl --with-libz CPPFLAGS="$CPPFLAGS -DLIBSSH2_LIBRARY=1"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgit2-0.20.0
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH  -DCMAKE_BUILD_TYPE=MinSizeRel -DUSE_ICONV=ON -DUSE_SSH=ON -DBUILD_SHARED_LIBS=OFF -DTHREADSAFE=ON -DOPENSSL_ROOT_DIR=$IPATH -DOPENSSL_LIBRARIES=/local/lib -DOPENSSL_INCLUDE_DIR=$IPATH/include -DSSL_EAY=$IPATH/lib/libssl.dll.a -DLIB_EAY=$IPATH/lib/libcrypto.dll.a
make clean
make $PJOBS install
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libgit2
Description: The git library, take 2
Version: 0.20.0
Requires: libssh2,libssl,libcrypto,zlib
Cflags: -I${includedir}
Libs: -L${libdir} -lgit2' >$IPATH/lib/pkgconfig/libgit2.pc

cd $SPATH/libproxy-0.4.11/
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH  -DCMAKE_BUILD_TYPE=MinSizeRel
make clean
make $PJOBS install
cp libproxy-1.0.pc $IPATH/lib/pkgconfig
cp libproxy/Libproxy-1.0.gir $IPATH/share/gir-1.0
cp libproxy/Libproxy-1.0.typelib $IPATH/lib/girepository-1.0
cp libproxy/CMakeFiles/libproxy.dir/objects.a $IPATH/lib/libproxy.a
cp libmodman/libmodman.a $IPATH/lib/libmodman.a
mv $IPATH/liblibproxy.dll.a $IPATH/lib/libproxy.dll.a
mv $IPATH/libproxy.dll $IPATH/bin/libproxy.dll
mv $IPATH/proxy.exe $IPATH/bin/proxy.exe

cd  $SPATH/glib-networking-2.40.1
configure --with-ca-certificates=curl-ca-bundle.crt --disable-static
make clean
make $PJOBS install
echo "libgiognutls.dll: gio-tls-backend
libgiolibproxy.dll: gio-proxy-resolver" > $IPATH/lib/gio/modules/giomodule.cache

cd $SPATH/sqlite-autoconf-3080301
configure --disable-static --enable-shared CPPFLAGS="$CPPFLAGS -DSQLITE_ENABLE_COLUMN_METADATA"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libsoup-2.44.2
configure --disable-static $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lcms2-2.5
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/openjpeg-1.5.2
configure --disable-static 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/aspell
configure --disable-static --enable-win32-relocatable --enable-compile-in-filters --disable-nls
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/hunspell-1.3.2
configure --enable-threads=win32 --with-experimental --disable-shared --disable-nls 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/hspell-1.2
configure --enable-fatverb
make clean
make libhspell.a
cp hspell.h $IPATH/include
cp libhspell.a $IPATH/lib

cd $SPATH/libvoikko-3.5
configure  --disable-shared
cp config.h.w64 config.h
touch config.h
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/enchant
configure --disable-static  LIBS="-laspell -lstdc++"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gdl-3.12.0
configure --disable-static $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtksourceview-3.10.2
configure --disable-static $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtksourceview-3.8.2
configure --disable-deprecations --disable-maintainer-mode --disable-static $INTROSPECT --prefix=$IPATH/gtksourceviewold
make clean
make $PJOBS install
rm $IPATH/gtksourceviewold/lib/*.la

cd $SPATH/osm-gps-map-1.0.1
configure --disable-static --disable-gtk-doc $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/memphis-0.2.3
# included libtool are crewed up in crosscompile
# thus linking patch applied at makefile.am
# if from vanila this need libtoolize and autoreconf -if
# and repatching
configure --disable-static $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libchamplain-0.12.6
configure --disable-debug $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgee-0.14.0
configure --disable-static $INTROSPECT 
find . -name *.lo -exec rm {} +
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lasem-0.4.1
configure --disable-static $INTROSPECT 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgsf-1.14.30
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libxslt-1.1.28
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la
#do not interfere msys
rm $IPATH/bin/xsltproc.exe

cd $SPATH/ghostscript-9.14
configure --with-drivers=TIFF,FAX --disable-cups --with-system-libtiff --with-jbig2dec --disable-openjpeg --enable-fontconfig --enable-freetype --disable-contrib --without-x
make soclean
make $PJOBS so
make soinstall

cd $SPATH/libspectre-0.2.7
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/goffice-0.10.14
configure --with-config-backend=gsettings --enable-compile-warnings=no $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/geoclue-0.12.99
#echo 'exec $IPATH90/bin/${0##*/}.exe "$@"' > $IPATH/bin/dbus-binding-tool
if [ "$CROSSX" == "1" ]; then
if [ -f $IPATH/bin/glib-genmarshal.exe ]; then
mv $IPATH/bin/glib-genmarshal.exe $IPATH/bin/glib-genmarshal.bak
fi
fi
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la
if [ "$CROSSX" == "1" ]; then
if [ -f $IPATH/bin/glib-genmarshal.bak ]; then
mv $IPATH/bin/glib-genmarshal.bak $IPATH/bin/glib-genmarshal.exe
fi
fi

cd $SPATH/webkitgtk-1.10.2
configure --with-target=win32 --with-gstreamer=1.0 $INTROSPECT --enable-animation-api --enable-link-prefetch --enable-register-protocol-handler --enable-device-orientation --enable-page-visibility-api --enable-css3-flexbox --enable-css3-text-decoration --enable-css-regions --enable-css-compositing --enable-style-scoped --enable-microdata --enable-web-timing --enable-video-track --enable-media-statistics --enable-media-stream --enable-mutation-observers --disable-webkit2 --disable-jit --with-unicode-backend=glib  
make clean
#memory exhaustion may occured during build so unset errorchecking temporary
set +e
make $PJOBS
make $PJOBS
set -e
make install
rm $IPATH/lib/*.la

cd $SPATH/curl-7.34.0
configure --with-winssl --with-ca-bundle=curl-ca-bundle.crt --disable-debug --disable-gopher --disable-telnet --disable-ldap --disable-static --enable-shared --without-ssl --with-libidn --without-librtmp --without-polarssl --enable-threaded-resolver --disable-imap --disable-pop3 --disable-rtsp --disable-ares --disable-manual --enable-sspi --without-libssh2 --disable-dict --enable-ipv6 LIBS=-liconv
#fix lib\curl-config.h enable getaddrinfo win32thread ipv6
touch lib/curl_config.h.ok$MULTILIB
cp lib/curl_config.h.ok$MULTILIB lib/curl_config.h
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/poppler-0.24.5
configure --enable-static --enable-zlib --enable-libcurl  --disable-poppler-cpp $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la $IPATH/bin/libpoppler-44.dll
cd glib
$CXX -shared $LDFLAGS .libs/*.o  -Wl,--whole-archive ../poppler/.libs/libpoppler-cairo.a ../poppler/.libs/libpoppler.a -Wl,--no-whole-archive -lcurl -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lintl -lcairo -lfontconfig -lfreetype -ljpeg -lpng16 -ltiff -llcms2 -lopenjpeg -lz -Wl,--enable-auto-import -o $IPATH/bin/libpoppler-glib-8.dll -Wl,--out-implib,$IPATH/lib/libpoppler-glib.dll.a
cp $IPATH/lib/libpoppler-glib.dll.a $IPATH/lib/libpoppler.dll.a

cd $SPATH/discident-glib
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libnice-0.1.4
configure
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd  $SPATH/farstream-0.2.3
configure $INTROSPECT LIBS=-lws2_32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/wavpack-4.70.0
configure --disable-shared --enable-mmx
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/x264-snapshot-20131112-2245-stable
configure --enable-static --disable-gpl --enable-win32thread
make clean
make $PJOBS install

if [ -d $IPATH/include/libavcodec ]; then rm -rdf $IPATH/include/libavcodec; fi
if [ -d $IPATH/include/libavformat ]; then rm -rdf $IPATH/include/libavformat; fi
if [ -d $IPATH/include/libavutil ]; then rm -rdf $IPATH/include/libavutil; fi
cd $SPATH/gst-libav-1.2.3
# dont use --enable-small
configure --enable-lgpl --with-libav-extra-configure="--enable-sse2 --enable-runtime-cpudetect --optflags=-Os"
make clean
make $PJOBS install
if [ ! -d $IPATH/include/libavutil ]; then mkdir $IPATH/include/libavutil; fi
cd $SPATH/gst-libav-1.2.3/gst-libs/ext/libav/libavutil
cp attributes.h avconfig.h avutil.h cpu.h dict.h log.h mem.h old_pix_fmts.h pixfmt.h rational.h samplefmt.h version.h $IPATH/include/libavutil
cp libavutil.a $IPATH/lib
if [ ! -d $IPATH/include/libavformat ]; then mkdir $IPATH/include/libavformat; fi
cd $SPATH/gst-libav-1.2.3/gst-libs/ext/libav/libavformat
cp avformat.h $IPATH/include/libavformat
if [ ! -d $IPATH/include/libavcodec ]; then mkdir $IPATH/include/libavcodec; fi
cd $SPATH/gst-libav-1.2.3/gst-libs/ext/libav/libavcodec
cp old_codec_ids.h avfft.h avcodec.h version.h $IPATH/include/libavcodec
cp libavcodec.a $IPATH/lib

cd $SPATH/opencore-amr
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libmad-0.15.1b
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libmpeg2-0.5.1
configure --disable-accel-detect --disable-sdl --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/a52dec-0.7.4
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libdvdread-4.2.1
configure --disable-shared LIBS=-ldl
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lame-3.99.5
configure --disable-shared --disable-decoder --enable-nasm  --disable-frontend
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/twolame-0.3.12
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libsidplay-1.36.59
configure --disable-shared --prefix=$IPATH
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libcaca-0.99.beta18
configure --enable-static --disable-shared --disable-java --disable-ruby --disable-cxx --disable-csharp --disable-python
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $IPATH/include
tar -xf $SPATH/boost_1_55_0/boost.tar.xz
#set +e
#b2 --prefix=$IPATH --without-python --without-mpi --disable-icu --layout=system variant=release link=static runtime-link=static threading=multi toolset=gcc optimization=space address-model=$CPUARCH cflags="-msse2 -D__MSVCRT_VERSION__=0x0900 -D_FILE_OFFSET_BITS=64" cxxflags="-msse2 -D__MSVCRT_VERSION__=0x0900 -D_FILE_OFFSET_BITS=64" -sNO_ZLIB=0 -sZLIB_INCLUDE=$IPATH/include -sZLIB_LIBPATH=$IPATH/lib -sICONV_LIBPATH=$IPATH/lib clean
#b2 $PJOBS --prefix=$IPATH --without-python --without-mpi --disable-icu --layout=system variant=release link=static runtime-link=static threading=multi toolset=gcc optimization=space address-model=$CPUARCH cflags="-msse2 -D__MSVCRT_VERSION__=0x0900 -D_FILE_OFFSET_BITS=64" cxxflags="-msse2 -D__MSVCRT_VERSION__=0x0900 -D_FILE_OFFSET_BITS=64" -sNO_ZLIB=0 -sZLIB_INCLUDE=$IPATH/include -sZLIB_LIBPATH=$IPATH/lib -sICONV_LIBPATH=$IPATH/lib install
#set -e

cd $SPATH/taglib-1.9.1
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel -DENABLE_STATIC=ON
make clean
make $PJOBS install
cp taglib.pc $IPATH/lib/pkgconfig

cd $SPATH/chromaprint-1.0
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_SHARED_LIBS=OFF -DWITH_FFTW3=OFF -DWITH_AVFFT=OFF
make clean
make $PJOBS install
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: chromaprint
Description: Audio fingerprint library
Version: 1.0.0
Cflags: -I${includedir} -DCHROMAPRINT_NODLL
Libs: -L${libdir} -lchromaprint -lavcodec -lavutil -lstdc++' >$IPATH/lib/pkgconfig/libchromaprint.pc

cd $SPATH/a52dec-0.7.4
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/speex
configure --with-fft=smallft --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd  $SPATH/libshout-2.3.1
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd  $SPATH/libdv-1.0.0
configure --disable-shared --disable-xv --disable-asm --disable-gtk --without-x
cd libdv
make clean
make $PJOBS install
rm $IPATH/lib/*.la
cp ../libdv.pc $IPATH/lib/pkgconfig

cd $SPATH/libcdio
configure --enable-static --disable-shared --without-cdda-player --disable-cxx --disable-cpp-progs
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/tbb40_20120613oss/src
set +e
set -f
if [ "$MULTILIB" == "64" ]; then
rm $SPATH/tbb40_20120613oss/build/windows_intel64_gcc_mingw_release/*.o
mingw32-make compiler=gcc arch=intel64 runtime=mingw tbb_os=windows release
cd $SPATH/tbb40_20120613oss/build/windows_intel64_gcc_mingw_release
else
rm $SPATH/tbb40_20120613oss/build/windows_ia32_gcc_mingw_release/*.o
mingw32-make compiler=gcc arch=ia32 runtime=mingw tbb_os=windows release
cd $SPATH/tbb40_20120613oss/build/windows_ia32_gcc_mingw_release
fi
set +f
set -e
ar cru $IPATH/lib/libtbb.a concurrent_hash_map.o concurrent_queue.o concurrent_vector.o dynamic_link.o itt_notify.o cache_aligned_allocator.o pipeline.o queuing_mutex.o queuing_rw_mutex.o reader_writer_lock.o spin_rw_mutex.o spin_mutex.o critical_section.o task.o tbb_misc.o tbb_misc_ex.o mutex.o recursive_mutex.o condition_variable.o tbb_thread.o concurrent_monitor.o semaphore.o private_server.o rml_tbb.o task_group_context.o governor.o market.o arena.o scheduler.o observer_proxy.o tbb_statistics.o tbb_main.o concurrent_vector_v2.o concurrent_queue_v2.o spin_rw_mutex_v2.o task_v2.o
ranlib libtbb.a
ar cru $IPATH/lib/libtbbmalloc.a backend.o large_objects.o backref.o  tbbmalloc.o  itt_notify_malloc.o frontend.o
ranlib $IPATH/lib/libtbbmalloc.a
ar cru $IPATH/lib/libtbbmalloc_proxy.a proxy.o tbb_function_replacement.o
ranlib $IPATH/lib/libtbbmalloc_proxy.a
cp -a $SPATH/tbb40_20120613oss/include/tbb $IPATH/include

if [ ! -d $SPATH/eigen3/mingw ]; then
if [ ! -d ~/sources/mingw ]; then
mkdir ~/sources/mingw
fi
fi
cd $SPATH/eigen3/mingw
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=Release ..
make install

if [ ! -d $SPATH/OpenCV-2.4.8/mingw ]; then mkdir $SPATH/OpenCV-2.4.8/mingw; fi
cd $SPATH/OpenCV-2.4.8/mingw
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_CXX_COMPILER=$GCC_LOC/bin/g++.exe -DCMAKE_INSTALL_PREFIX=$IPATH  -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_SHARED_LIBS=OFF -DBUILD_DOCS=OFF -DWITH_TBB=ON -DWITH_JASPER=OFF -DWITH_PNG=OFF -DWITH_JPEG=OFF -DWITH_OPENEXR=OFF -DWITH_FFMPEG=OFF -DWITH_TIFF=OFF -DBUILD_opencv_python=OFF ..
make clean
make $PJOBS install
#if [ "$MULTILIB" == "64" ]; then
mv -f $IPATH/x64/mingw/staticlib/*.a $IPATH/lib/
#fi
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.8
Requires: 
Cflags: -I${includedir_old} -I${includedir_new}
Libs: Libs:  -lopencv_contrib248 -lopencv_legacy248 -lopencv_ml248 -lopencv_stitching248 -lopencv_ts248 -lopencv_videostab248 -lopencv_gpu248 -lopencv_nonfree248 -lopencv_objdetect248 -lopencv_calib3d248 -lopencv_photo248 -lopencv_video248 -lopencv_features2d248 -lopencv_highgui248 -lopencv_flann248 -lopencv_imgproc248 -lopencv_core248 -lwinmm -lavicap32 -lavifil32 -lmsvfw32 -lole32 -lgdi32 -lcomctl32 -ltbb -lws2_32 -lz' >$IPATH/lib/pkgconfig/opencv.pc

cd $SPATH/libsamplerate-0.1.8
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libsndfile-1.0.25
configure --disable-shared --disable-external-libs
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libvpx-v1.3.0
if [ "$MULTILIB" == "64" ]; then 
./configure --target=x86_64-win64-gcc --disable-shared --disable-unit-tests --disable-examples --enable-vp8 --enable-vp9 --enable-runtime-cpu-detect --enable-small --enable-multi-res-encoding --enable-postproc --enable-vp9-postproc
else
./configure --disable-shared --disable-unit-tests --disable-examples --enable-vp8 --enable-vp9 --enable-runtime-cpu-detect --enable-small --enable-multi-res-encoding --enable-postproc --enable-vp9-postproc
fi
make clean
make $PJOBS install

cd $SPATH/jack-1.9.9.5/windows
$CXX -I. -I../common -I../common/jack $CXXFLAGS -Wall -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -D_USRDLL -DREGEX_MALLOC -DSTDC_HEADERS -D__SMP__ -DJACK_MONITOR -DHAVE_CONFIG_H -c ../common/JackAPI.cpp ../common/JackActivationCount.cpp ../common/JackAudioPort.cpp ../common/JackClient.cpp ../common/JackConnectionManager.cpp ../common/JackDebugClient.cpp ../common/JackEngineControl.cpp ../common/JackEngineProfiling.cpp ../common/JackError.cpp ../common/JackException.cpp ../common/JackFrameTimer.cpp ../common/JackGenericClientChannel.cpp ../common/JackGlobals.cpp ../common/JackGraphManager.cpp ../common/JackLibAPI.cpp ../common/JackLibClient.cpp ../common/JackMessageBuffer.cpp ../common/JackMidiAPI.cpp ../common/JackMidiPort.cpp ../common/JackPort.cpp ../common/JackPortType.cpp ../common/JackShmMem.cpp ../common/JackTools.cpp ../common/JackTransportEngine.cpp JackMMCSS.cpp JackWinMutex.cpp JackWinNamedPipe.cpp JackWinNamedPipeClientChannel.cpp JackWinProcessSync.cpp JackWinSemaphore.cpp JackWinServerLaunch.cpp JackWinThread.cpp
$CC -I. -I../common -I../common/jack $CFLAGS -Wall -DWIN32 -DNDEBUG -D_WINDOWS -D_MBCS -D_USRDLL -DREGEX_MALLOC -DSTDC_HEADERS -D__SMP__ -DJACK_MONITOR -DHAVE_CONFIG_H -c JackWinTime.c ../common/ringbuffer.c ../common/shm.c
$CXX -shared -o $IPATH/bin/libjack.dll *.o $LDFLAGS -lpsapi -lregex -lwinmm -Wl,--out-implib,$IPATH/lib/libjack.dll.a
ar cru $IPATH/lib/libjack.a *.o
ranlib $IPATH/lib/libjack.a
cp -a $SPATH/jack-1.9.9.5/common/jack $IPATH/include
cp $SPATH/jack-1.9.9.5/jack.pc $IPATH/lib/pkgconfig

cd $SPATH/gst-plugins-good-1.2.3
configure --disable-static --enable-experimental
make clean
make $PJOBS install

cd $SPATH/clutter-gst-2.0.10
configure --disable-static  $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gst-plugins-ugly-1.2.3
configure --disable-static LIBS=-ldl
make clean
make $PJOBS install

cd $SPATH/gstreamer-editing-services-1.1.90
configure --with-gtk=3.0 $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gnonlin-1.1.90
configure
make clean
make $PJOBS install

cd $SPATH/gst-omx-1.0.0
configure
make clean
make $PJOBS install

cd $SPATH/gst-rtsp-server-1.1.90
configure $INTROSPECT --disable-tests
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libspiro
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/exiv2
configure --disable-shared --enable-static --disable-nls
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lensfun-0.2.5/libs/lensfun
set +e
rm *.o *.a
set -e
$CXX $CFLAGS $CPPFLAGS -msse2 $(pkg-config --cflags glib-2.0) -DVECTORIZATION_SSE2=1 -fvisibility=hidden -Wno-non-virtual-dtor -I../../include -c *.cpp
ar cru $IPATH/lib/liblensfun.a *.o
ranlib $IPATH/lib/liblensfun.a
cp $SPATH/lensfun-0.2.5/include/lensfun/lensfun.h $IPATH/include
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: lensfun
Description: A photographic lens database and access library
Version: 0.2.5
Requires: glib-2.0,libpng
Cflags: -I${includedir}
Libs: -L${libdir} -llensfun -lregex' >$IPATH/lib/pkgconfig/lensfun.pc

cd $SPATH/mx-1.4.7
configure --disable-gtk-widgets --with-winsys=none $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lua-5.1.5
make mingw clean
make $PJOBS mingw $PJOBS
make $PJOBS mingw install

cd $SPATH/ilmbase-2.0.1
configure
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/openexr-2.0.1
configure
make clean
make $PJOBS install
rm $IPATH/lib/*.la
$CXX $LDFLAGS -shared -o $IPATH/bin/libopenexr-2.dll -Wl,-whole-archive $IPATH/lib/libIlmImf.a $IPATH/lib/libIlmThread.a $IPATH/lib/libImath.a $IPATH/lib/libIexMath.a $IPATH/lib/libIex.a $IPATH/lib/libHalf.a -Wl,--no-whole-archive -Wl,--out-implib,$IPATH/lib/libIlmImf.dll.a -lz
cp $IPATH/lib/libIlmImf.dll.a $IPATH/lib/libIlmThread.dll.a
cp $IPATH/lib/libIlmImf.dll.a $IPATH/lib/libImath.dll.a
cp $IPATH/lib/libIlmImf.dll.a $IPATH/lib/libIexMath.dll.a
cp $IPATH/lib/libIlmImf.dll.a $IPATH/lib/libIex.dll.a
cp $IPATH/lib/libIlmImf.dll.a $IPATH/lib/libHalf.dll.a
cd $IPATH/bin
rm libIlmImf-Imf_2_0-20.dll libIlmThread-2_0-10.dll libImath-2_0-10.dll libIexMath-2_0-10.dll libIex-2_0-10.dll libHalf-10.dll

cd $SPATH/geglgit/babl
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/geglgit/gegl
configure --disable-static --disable-docs $INTROSPECT LIBS="-ljpeg -lstdc++" 
make clean
make $PJOBS install
cd $SPATH/geglgit/gegl/operations/workshop
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gegl-gtk
configure --without-vala $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtkspell3-3.0.3
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/glade-3.15.0
configure --prefix=$IPATH/gladeold $INTROSPECT
make clean
make $PJOBS
manifest
make install
rm $IPATH/gladeold/lib/*.la
for i in 27 31 32 33 34; do
cd $SPATH/glade-3.15.0
configure --prefix=$IPATH/gladeold PYTHON=/bin/python$i PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/local/py$i/lib/pkgconfig" PYTHON_INCLUDES=-I/c/python$i/include PYTHON_LIBS=-lpython$i
cd plugins/python
make clean
make $PJOBS
cp .libs/libgladepython.dll $IPATH/gladeold/lib/glade/modules/libgladepython$i.dll
done

cd $SPATH/glade-3.16.1
configure --enable-gladeui $INTROSPECT
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la
for i in 27 31 32 33 34; do
cd $SPATH/glade-3.16.1
configure --enable-gladeui PYTHON=/bin/python$i PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/local/py$i/lib/pkgconfig" PYTHON_INCLUDES=-I/c/python$i/include PYTHON_LIBS=-lpython$i
cd plugins/python
make clean
make $PJOBS
cp .libs/libgladepython.dll $IPATH/lib/glade/modules/libgladepython$i.dll
done

cd $SPATH/adg-0.7.4/build
../configure $triplet --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/graphviz-2.16.1
#no need to build everything
configure --disable-shared --enable-static --disable-tcl --disable-java --disable-sharp --disable-perl --disable-ltdl
cd $SPATH/graphviz-2.16.1/lib/common
make clean
make $PJOBS install
cd $SPATH/graphviz-2.16.1/lib/pathplan
make clean
make $PJOBS install
cd $SPATH/graphviz-2.16.1/lib/gvc
make clean
make $PJOBS install
cd $SPATH/graphviz-2.16.1/lib/graph
make clean
make $PJOBS install
cd $SPATH/graphviz-2.16.1/lib/cdt
make clean
make $PJOBS install
ar cru $IPATH/lib/libgvc.a $SPATH/graphviz-2.16.1/lib/common/*.o
rm $IPATH/lib/*.la

cd $SPATH/goocanvas-2.0.2
configure --disable-static --disable-python $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/mysql-connector-c-6.0.2
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH  -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_CXX_FLAGS="$CXXFLAGS -D_TIMESPEC_DEFINED=1" -DCMAKE_C_FLAGS="$CXXFLAGS -D_TIMESPEC_DEFINED=1"
make clean
make $PJOBS install
ar d $IPATH/lib/libmysqlclient.a adler32.c.obj compress.c.obj crc32.c.obj deflate.c.obj infback.c.obj inffast.c.obj inflate.c.obj inftrees.c.obj trees.c.obj zutil.c.obj
cp $IPATH/lib/libmysqlclient.a $IPATH/lib/libmysql.a
rm $IPATH/bin/mysql*.exe $IPATH/lib/liblibmysql.dll.a
cd $IPATH/include
if [ ! -d $IPATH/include/mysql ]; then mkdir $IPATH/include/mysql; fi
mv base64.h config-win.h decimal.h errmsg.h hash.h keycache.h lf.h myisampack.h mysql.h mysqld_error.h mysql_com.h mysql_time.h mysql_version.h mysys_err.h my_aes.h my_alarm.h my_alloc.h my_atomic.h my_attribute.h my_base.h my_bit.h my_bitmap.h my_charsets.h my_config.h my_dbug.h my_dir.h my_getopt.h my_global.h my_libwrap.h my_list.h my_md5.h my_net.h my_nosys.h my_no_pthread.h my_pthread.h my_stacktrace.h my_sys.h my_time.h my_tree.h my_trie.h my_uctype.h my_vle.h my_xml.h m_ctype.h m_string.h queues.h service_versions.h sha1.h sha2.h sql_common.h sslopt-case.h sslopt-longopts.h sslopt-vars.h thr_alarm.h thr_lock.h typelib.h t_ctype.h violite.h waiting_threads.h wqueue.h $IPATH/include/mysql
cp -a mysys $IPATH/include/mysql
rm -rdf mysys

cd $SPATH/postgresql-9.3.3
configure --prefix=$IPATH --with-system-tzdata=/share/zoneinfo --with-libxml --with-libxslt --with-openssl --with-ldap CFLAGS="$RTVER -Os -fno-lto" CXXFLAGS="$RTVER -Os -fno-lto"
cd $SPATH/postgresql-9.3.3/src/interfaces/libpq
make clean
if [ "$MULTILIB" == "64" ]; then
#dllwrap will fail in win64 target
set +e
fi
make $PJOBS libpq.dll
make install -k
ar cru $IPATH/lib/libpq.a *.o
ranlib $IPATH/lib/libpq.a
cp -a $SPATH/postgresql-9.3.3/src/include/libpq $IPATH/include
cp libpq-events.h libpq-fe.h $IPATH/include
cd $SPATH/postgresql-9.3.3/src/include/
cp pg_config_ext.h postgres_ext.h $IPATH/include
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: libpq
Description: PostgreSQL libpq library
Url: http://www.postgresql.org/
Version: 9.3.3
Requires:
Requires.private:
Cflags: -I${includedir}
Libs: -L${libdir} -lpq -lcrypto -lwldap32 -lshfolder -lwsock32 -lws2_32 -lsecur32' >$IPATH/lib/pkgconfig/libpq.pc
rm $IPATH/bin/libpq.dll
set -e

cd $SPATH/db4/build_unix
../dist/configure $triplet --enable-smallbuild --enable-mingw --prefix=$IPATH 
make clean
make
make install_include 
make install_lib
rm $IPATH/lib/*.la

cd $SPATH/openldap-2.4.38
configure --disable-shared --with-tls=openssl
make clean
make $PJOBS 
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/libgda-5.2.2
# too many hassle for cross compile...
if [ ! "$CROSSX" == "1" ]; then
if [ "$MULTILIB" == "64" ]; then
GDAUI=
else
GDAUI=--enable-gdaui-gi
fi
configure --with-mdb --with-mysql-libdir-name=lib --with-bdb-libdir-name=lib --enable-json --with-graphviz --disable-system-mdbtools --with-gtksourceview --with-ui --with-goocanvas --with-libsoup --without-help LIBS="-lexpat -lz" $INTROSPECT $GDAUI
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la
fi

cd $SPATH/sofia-sip-1.12.11
configure --disable-shared --enable-experimental --with-openssl LIBS="-lws2_32 -liphlpapi"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libusbx-1.0.17
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/usbredir-0.6
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/spice-gtk-0.24
configure --without-sasl --with-audio=no --disable-werror --disable-smartcard $INTROSPECT LIBS=-lusb-1.0
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtk-vnc-0.5.3
configure --with-gtk=3.0 --without-sasl --disable-vala $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/meanwhile-1.0.2
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/silc-toolkit-1.1.10
configure --disable-shared --disable-asm --with-win32
make clean
make $PJOBS install
cd lib
rm -rdf *.la .libs
make libsilcclient.a
make libsilc.a
cp .libs/*.a $IPATH/lib

cd $SPATH/pidgin-2.10.9
configure --disable-consoleui --disable-nss --disable-avahi --disable-nm --disable-perl --disable-tcl --without-x --disable-gtkui --disable-consoleui
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/telepathy-glib-0.24.0
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/telepathy-logger-0.8.0
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/telepathy-farstream-0.6.1
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/telepathy-rakia-0.8.0
configure LIBS=-lws2_32
make clean
make install

cd $SPATH/telepathy-gabble-0.18.2
configure --with-ca-certificates=curl-ca-bundle.crt --disable-Werror --with-tls=gnutls --disable-debug LIBS=-lws2_32
make clean
make $PJOBS install

cd $SPATH/telepathy-idle-0.2.0
configure LIBS=-lws2_32
make clean
make install

cd $SPATH/telepathy-haze-0.8.0
configure LIBS=-ldbus-glib-1
make clean
make $PJOBS install

cd $SPATH/devhelp-3.8.2
configure --without-webkit2
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/game-music-emu-0.5.5/gme
echo '
#ifndef GME_TYPES_H
#define GME_TYPES_H
#define USE_GME_AY
#define USE_GME_GBS
#define USE_GME_GYM
#define USE_GME_HES
#define USE_GME_KSS
#define USE_GME_NSF
#define USE_GME_NSFE
#define USE_GME_SAP
#define USE_GME_SPC
#define USE_GME_VGM
#endif /* GME_TYPES_H */'>gme_types.h
$CXX $CXXFLAGS -I. -c *.cpp
ar cru $IPATH/lib/libgme.a *.o
ranlib $IPATH/lib/libgme.a
if [ ! -d $IPATH/include/gme ]; then mkdir $IPATH/include/gme; fi
cp gme.h $IPATH/include/gme/

cd $SPATH/libkate-0.3.8
configure --disable-shared --enable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/flite-1.4-release
configure --disable-shared --with-lex --with-vox --with-lang
set +e
make clean
set -e
make 
make install

cd $SPATH/libdvdnav-4.2.1
configure --disable-shared LIBS=-ldl
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/daala-068c369
configure --disable-shared --disable-unit-tests --disable-player
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libdca-0.0.5
configure --disable-shared 
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/fftw-3.3.3
configure --enable-sse2  --with-our-malloc --disable-fortran
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libofa-0.9.3
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/schroedinger
configure --enable-static --disable-shared --with-thread=gthread
cd $SPATH/schroedinger/schroedinger
make clean
make $PJOBS install
rm $IPATH/lib/*.la
cd $SPATH/schroedinger
cp schroedinger.pc $IPATH/lib/pkgconfig
cp schroedinger.pc $IPATH/lib/pkgconfig/schroedinger-1.0.pc

cd $SPATH/libmimic-1.0.4
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/mjpegtools-2.1.0
configure --enable-static --disable-shared --without-libsdl --without-gtk --enable-simd-accel
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gsm
make clean
make lib/libgsm.a
cp -a $SPATH/gsm/inc/gsm $SPATH/gsm/inc/gsm.h $IPATH/include
cp $SPATH/gsm/lib/libgsm.a $IPATH/lib

cd $SPATH/faac-1.28
configure --enable-static --disable-shared LIBS=-lws2_32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/faad2-2.7
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/soundtouch
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/openal-soft-1.15.1
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH  -DCMAKE_BUILD_TYPE=MinSizeRel -DSSE=ON -DLIBTYPE=STATIC
make clean
make $PJOBS install

cd $SPATH/vo-aacenc-0.1.3
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/vo-amrwbenc-0.1.3
configure --enable-static --disable-shared CFLAGS="$CFLAGS -O2"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/srtp
configure --enable-static --disable-shared
make clean
make
make uninstall
make install

cd $SPATH/spandsp-0.0.6
# consider to patch telephony.h ?
configure --enable-static --disable-shared CFLAGS="$CFLAGS -DLIBSPANDSP_EXPORTS" CXXFLAGS="$CXXFLAGS -DLIBSPANDSP_EXPORTS"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/mpg123-1.16.0
configure --enable-static --disable-shared --with-audio=win32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/enca
configure --disable-shared --enable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libass
configure --disable-shared --enable-static --enable-enca
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libmodplug
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/rtmpdump/librtmp
make clean
make $PJOBS install prefix=$IPATH
rm $IPATH/bin/librtmp.* $IPATH/lib/librtmp.dll.a

cd $SPATH/libmms-0.6.2
configure --disable-shared --enable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/neon-0.30.0
configure --disable-shared --disable-nls --with-ssl=gnutls --with-ca-bundle=curl-ca-bundle.crt
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/fluidsynth
configure --disable-static --disable-pulse-support --without-readline --disable-libsndfile-support --disable-dbus-support
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gst-plugins-bad-1.2.3
configure --disable-static --enable-experimental $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/cfitsio
configure --enable-sse2 --disable-ssse3 --enable-reentrant
make clean
make $PJOBS install
cp include/*.h $IPATH/include
cp lib/*.a $IPATH/lib
cp cfitsio.pc $IPATH/lib/pkgconfig

cd $SPATH/openslide-3.3.3
configure --enable-static --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/matio
configure --disable-hared --enable-extended-sparse=yes --enable-mat73=yes
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgit2-glib-0.0.12
configure #$INTROSPECT
if [ "$MULTILIB" == "64" ]; then
    cd libgit2-glib
    make $PJOBS install-libLTLIBRARIES
    make install-headerDATA
    cd $SPATH/libgit2-glib-0.0.12
    make install-pkgconfigDATA
else
    make clean
    make $PJOBS install
fi
rm $IPATH/lib/*.la

cd $SPATH/gexiv2-0.10.0
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/nspr-4.10.2
export _CPPFLAGS=$CPPFLAGS
export _CFLAGS=$CFLAGS
export _LDFLAGS=$LDFLAGS
unset CPPFLAGS
unset LDFLAGS
export CFLAGS="$CFLAGS -DNSPR_STATIC"
if [ -f config.cache ]; then rm -f config.cache; fi
configure --enable-win32-target=WIN95 --disable-debug --disable-debug-symbols --enable-optimize=-Os
make clean
make $PJOBS
manifest
make install
cd $IPATH/lib
rm nspr4.dll plds4.dll plc4.dll ../bin/nspr-config
#rm nspr4.dll* plds4.dll* plc4.dll*
mv nspr4_s.a libnspr4.a
mv plds4_s.a libplds4.a
mv plc4_s.a libplc4.a
mv nspr4.dll.a libnspr4_s.dll.a
mv plds4.dll.a libplds4_s.dll.a
mv plc4.dll.a libplc4_s.dll.a
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/nspr
Name: NSPR
Description: The Netscape Portable Runtime
Version: 4.10.2
Cflags: -I${includedir} -DNSPR_STATIC
Libs: -L${libdir} -lplds4 -lplc4 -lnspr4 -lwinmm -lws2_32' >$IPATH/lib/pkgconfig/nspr.pc
export CPPFLAGS=$_CPPFLAGS
export LDFLAGS=$_LDFLAGS
export CFLAGS=$_CFLAGS
#$CC -shared -o $IPATH/bin/libnspr4.dll -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--whole-archive $IPATH/lib/plds4_s.a $IPATH/lib/plc4_s.a $IPATH/lib/nspr4_s.a -Wl,--no-whole-archive $LDFLAGS -Wl,--out-implib,$IPATH/lib/libnspr4.dll.a -lwinmm -lws2_32
#cp $IPATH/lib/libnspr4.dll.a $IPATH/lib/libplds4.dll.a
#cp $IPATH/lib/libnspr4.dll.a $IPATH/lib/libplc4.dll.a

export PYTHON=python27
export CPP=cpp
export CXXCPP="gcc -E"
cd $SPATH/mozjs-24.2.0/js/src
configure --disable-debug --disable-debug-symbols --enable-optimize=-Os --with-system-zlib --enable-system-ffi --enable-threadsafe --enable-system-ffi --with-system-zlib=/local --disable-shared-js --disable-intl-api --with-nspr-libs="-L$IPATH/lib -lplds4 -lplc4 -lnspr4" --with-nspr-cflags="-I$IPATH/include/nspr -DNSPR_STATIC"
make clean
make $PJOBS 
make install
rm $IPATH/bin/js24-config
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: SpiderMonkey 24.2.0
Description: The Mozilla library for JavaScript
Version: 24.2.0
Requires: nspr,zlib,libffi
Cflags: -include ${includedir}/mozjs-24/js/RequiredDefines.h -I${includedir}/mozjs-24 -DSTATIC_JS_API
Libs: -L${libdir} -lmozjs-24 -lpsapi' >$IPATH/lib/pkgconfig/mozjs-24.pc
unset PYTHON

cd $SPATH/gjs-1.40.1
configure
make clean
if [ "$MULTILIB" == "64" ]; then
make install-pkgconfigDATA
make $PJOBS install-libLTLIBRARIES
make install-binPROGRAMS
make install-nobase_gjs_module_includeHEADERS
make install-nobase_gjs_public_includeHEADERS
else
make $PJOBS install
fi
rm $IPATH/lib/*.la

cd $SPATH/vips-7.38.5
configure --disable-cxx --without-fftw --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/rest-0.7.91
configure --without-gnome --with-ca-certificates=curl-ca-bundle.crt $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gmime-2.6.20
configure --disable-mono --disable-vala --disable-cryptography $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libsecret-0.18
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gnome-js-common-0.1
configure --disable-seed --disable-gjs
make install-pkgconfigDATA

cd $SPATH/seed-3.8.1
configure --disable-mpfr-module --disable-readline-module --disable-os-module --disable-multiprocessing-module $INTROSPECT
make clean
if [ "$MULTILIB" == "64" ]; then
set +e
fi
make $PJOBS install -k
rm $IPATH/lib/*.la
set -e

cd $SPATH/libpeas-1.10.0
configure --enable-glade-catalog --enable-gtk --disable-gjs --disable-python3 --enable-python2 PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/local/py27/lib/pkgconfig" PYTHON=python27 PYTHON2_CONFIG=/bin/python27-config $INTROSPECT
make clean
if [ "$MULTILIB" != "64" ]; then
make $PJOBS install
else
make $PJOBS install-exec
cd $SPATH/libpeas-1.10.0/libpeas
make install-headerDATA
cd $SPATH/libpeas-1.10.0/libpeas-gtk
make install-headerDATA
cd $SPATH/libpeas-1.10.0/data
make install
cd $SPATH/libpeas-1.10.0/loaders
make $PJOBS install
fi
mv $IPATH/lib/libpeas-1.0/loaders/libpythonloader.dll $IPATH/lib/libpeas-1.0/loaders/libpython27-loader.dll
rm $IPATH/lib/*.la
# peas says 3.1 is obsolete
for i in 32 33 34; do
cd $SPATH/libpeas-1.10.0
configure --enable-glade-catalog --disable-gjs --enable-gtk --disable-python2 --enable-python3 PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/local/py$i/lib/pkgconfig" PYTHON=python$i PYTHON3_CONFIG=/bin/python$i-config $INTROSPECT
cd loaders/python3
make clean
make $PJOBS install
mv $IPATH/lib/libpeas-1.0/loaders/libpython3loader.dll $IPATH/lib/libpeas-1.0/loaders/libpython$i-loader.dll
done

cd $SPATH/GConf-3.2.6
configure --enable-gsettings-backend --without-openldap --disable-orbit $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgnome-keyring-3.12.0
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gcr-3.12.0
# need fix gir version 3.broken
configure --disable-static $INTROSPECT LDFLAGS="$LDFLAGS -Wl,--allow-multiple-definition"
make clean
make install
rm $IPATH/lib/*.la

cd $SPATH/liboauth-1.0.2
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libaccounts-glib-1.1
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gnome-online-accounts-3.12.1
configure --disable-static --enable-inspector $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgdata-0.14.1
configure --enable-gnome --enable-goa $INTROSPECT LIBS=-lws2_32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/geocode-glib-3.12.0
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libarchive-3.1.2
configure --without-xml2 --without-expat --without-openssl --disable-bsdcpio --without-lzo2 --disable-bsdtar --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgxps-0.2.2
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgweather-3.12.1
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtkglext-master
configure --enable-win32-backend --enable-debug=minimum $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgrss-master
configure --disable-static $INTROSPECT LIBS=-lws2_32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgepub-master
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/vala-0.22.1
echo '#define BUILD_VERSION "0.22.1"'> ccode/version.h
echo '#define BUILD_VERSION "0.22.1"'> vala/version.h
configure --enable-static --disable-shared --enable-silent-rules
make clean
make $PJOBS install
rm $IPATH/lib/*.la
cp /local/lib/pkgconfig/libvala-0.22.pc /local/lib/pkgconfig/libvala-0.20.pc
#cp /local/lib/pkgconfig/libvala-0.24.pc /local/lib/pkgconfig/libvala-0.20.pc
#cp /local/lib/pkgconfig/libvala-0.24.pc /local/lib/pkgconfig/libvala-0.22.pc

cd $SPATH/gxml-0.3.2
# gir files still missing shared-library
configure --disable-static $INTROSPECT
make clean
if [ "$MULTILIB" == "64" ]; then
cd gxml
make install-libLTLIBRARIES
make install-gxmlHEADERS
make install-pkgconfigDATA
else
make install
fi
rm $IPATH/lib/*.la

cd $SPATH/twitter-glib-0.9.8
configure --disable-static --disable-maintainer-flags $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

#export FREEBL_NO_DEPEND=1
#export FREEBL_LOWHASH=1
export NSS_USE_SYSTEM_SQLITE=1
export BUILD_OPT=1
export HOST="localhost"
export DOMSUF=" "
export USE_IP=TRUE
export USE_STATIC_LIBS=1
export IP_ADDRESS="127.0.0.1"
export NS_USE_GCC=1
export OPT_CODE_SIZE=1
export ALLOW_OPT_CODE_SIZE=1
export _CPPFLAGS="$CPPFLAGS -DNSPR_STATIC"
export CPPFLAGS="$CPPFLAGS -I$IPATH/include/nspr"
cd $SPATH/nss-3.15.5
set +e
rm -rdf $SPATH/nss-3.15.5/dist
set -e
if [ "$MULTILIB" == "64" ]; then
export USE_64=1
fi
cp $IPATH/lib/libplds4_s.dll.a $IPATH/lib/libplds4.dll.a
cp $IPATH/lib/libplc4_s.dll.a $IPATH/lib/libplc4.dll.a
cp $IPATH/lib/libnspr4_s.dll.a $IPATH/lib/libnspr4.dll.a
cd nss
find . -name WIN954.0_gcc*.OBJ -exec rm -rdf {} +
set +e
make -k
set -e
if [ "$MULTILIB" == "64" ]; then
cd $SPATH/nss-3.15.5/dist/WIN954.0_gcc_64_OPT.OBJ/lib
else
cd $SPATH/nss-3.15.5/dist/WIN954.0_gcc_OPT.OBJ/lib
fi
rm *.dll.a libzlib.a $IPATH/lib/libnspr4.dll.a $IPATH/lib/libplc4.dll.a $IPATH/lib/libplds4.dll.a
mv libnss.a $IPATH/lib/libnss3.a
mv libsmime.a $IPATH/lib/libsmime3.a
mv libssl.a $IPATH/lib/libssl3.a
mv libsoftokn.a $IPATH/lib/libsoftokn3.a
for i in `find *.a`; do 
    ar x $i
    for j in `find *.o`; do
        mv $j ${i%.*}_${j%.*}.obj
    done
done
ar cru $IPATH/lib/libnssutil3.a *.obj
ranlib $IPATH/lib/libnssutil3.a
rm *.obj
cp -a $SPATH/nss-3.15.5/dist/public/nss $IPATH/include
echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/nss
Name: NSS
Description: Network Security Services
Version: 3.15.5
Requires: nspr >= 4.8,zlib,sqlite3
Cflags: -I${includedir} -DNSS_STATIC -DNSS_USE_STATIC_LIBS
Libs: -L${libdir} -lsoftokn3 -lssl3 -lsmime3 -lnss3 -lnssutil3' >$IPATH/lib/pkgconfig/nss.pc

cd $SPATH/libical-1.0
configure --disable-shared CPPFLAGS="$CPPFLAGS -DBIG_ENDIAN=0 -DLITTLE_ENDIAN=1 -DBYTE_ORDER=BIG_ENDIAN" --prefix=/local
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/evolution-data-server-3.10.4
configure --disable-uoa $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/yajl-2.1.0
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel
make clean
make $PJOBS install
rm $IPATH/lib/libyajl.dll.a
mv $IPATH/lib/libyajl_s.a $IPATH/lib/libyajl.a

cd $SPATH/portablexdr-4.9.1
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libssh2-1.4.3
configure --disable-shared --enable-static --with-libgcrypt --with-libz CPPFLAGS="$CPPFLAGS -DLIBSSH2_LIBRARY=1"
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libvirt-0.10.2
configure --without-python --without-phyp --without-lxc --without-openvz --without-libvirtd --disable-static
make clean
make $PJOBS
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/libvirt-glib-0.1.7
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libsocialweb-0.25.21
configure --without-gnome --enable-all-services --disable-vala-bindings $INTROSPECT
make clean
( cat libsocialweb-client/libsocialweb-client-hack-for-vala.h.header.in; \
            for include in sw-client.h sw-item.h sw-contact.h sw-client-service.h sw-client-lastfm.h sw-client-item-view.h sw-client-contact-view.h; do \
            echo "#include "; \
            done; \
            cat libsocialweb-client/libsocialweb-client-hack-for-vala.h.footer.in \
        ) > libsocialweb-client/libsocialweb-client-hack-for-vala.h
make $PJOBS install
cp libsocialweb-client/libsocialweb-client-hack-for-vala.h $IPATH/include/libsocialweb/libsocialweb-client
rm $IPATH/lib/*.la

cd $SPATH/folks-0.9.6
# gir files still missing shared-library
configure --disable-vala --disable-tests $INTROSPECT
find . -name *.lo -exec rm {} +
find . -name *.exe -exec rm {} +
find . -name *.o -exec rm {} +
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/liblangtag-0.5.2
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la $IPATH/bin/liblangtag-1.dll
if [ "$MULTILIB" != "64" ]; then
cd liblangtag-gobject
$CC $LDFLAGS -shared  .libs/liblangtag_gobject_la-lt-gobject.o ../liblangtag/.libs/liblangtag.a -L$IPATH/lib -lgobject-2.0 -lglib-2.0 -lintl -ldl -lxml2 -o $IPATH/bin/liblangtag-gobject-0.dll -Wl,--out-implib,$IPATH/lib/liblangtag-gobject.dll.a
cp $IPATH/lib/liblangtag-gobject.dll.a $IPATH/lib/liblangtag.dll.a
fi

cd $SPATH/libmirage-2.1.1
# gir files still missing shared-library
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
if [ "$MULTILIB" == "64" ]; then
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel -DGTKDOC_ENABLED=OFF -DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS" -DINTROSPECTION_ENABLED=OFF
else
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel -DGTKDOC_ENABLED=OFF -DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS"
fi
make clean
make install
cp libmirage.dll $IPATH/bin

cd $SPATH/midgard2-core-12.09
configure --with-libgda5 --with-dbus-support $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/glib-controller
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

echo 'prefix=
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
Name: uuid
Description: win32 uuid
Version: 1.50
Requires: 
Cflags: 
Libs: -lrpcrt4' >$IPATH/lib/pkgconfig/uuid.pc
cd $SPATH/couchdb-glib-0.7.4
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgami-0.3
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gocl-0.1.6
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libunistring-0.9.3
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/mongo-glib-mongo-glib-0.3.2
configure --disable-static $INTROSPECT --disable-debug CPPFLAGS="$CPPFLAGS -D__GLIBC__=4 -DCONFIG_UNICODE_SAFETY=1" LIBS=-lws2_32
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/sqlheavy-master
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gcab-0.4
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgovirt-0.3.0
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libitl-0.7.0
$CC $CFLAGS -c -Iprayertime/src -Ihijri/src prayertime/src/astro.c prayertime/src/prayer.c  hijri/src/umm_alqura.c hijri/src/hijri.c
ar cru $IPATH/lib/libitl.a *.o
ranlib $IPATH/lib/libitl.a
if [ ! -d $IPATH/include/itl ]; then
mkdir $IPATH/include/itl
fi
cp prayertime/src/prayer.h hijri/src/hijri.h $IPATH/include/itl

cd $SPATH/libitl-gobject-0.2
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gavl-1.2.0
configure --disable-shared --enable-static --without-doxygen --disable-cpu-clip --with-cpuflag=none
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/frei0r-plugins-1.4
configure
make clean
make $PJOBS install

cd $SPATH/libvisual-plugins-0.4.0
configure --disable-gforce --disable-nls --disable-static
make clean
make $PJOBS install
cd plugins/input/jack
make clean
make $PJOBS install

cd $SPATH/libltdl
configure --disable-shared
make clean
make $PJOBS install
cp -a ltdl.h libltdl $IPATH/include
cp .libs/libltdlc.a $IPATH/lib/libltdl.a

cd $SPATH/libcanberra-0.30
configure LIBS=-ldl
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gsound-master
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lunar-date-2.4.0 
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/lunar-calendar-3.0.0
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

#cd $SPATH/emerillon-0.1.90
#configure --disable-maintainer-mode $INTROSPECT 
#make clean
#make install
#rm $IPATH/lib/*.la

#cd $SPATH/gtk+-2.24.23
#configure --with-included-immodules --disable-introspection
#make clean
#make $PJOBS
#manifest
#make install
#rm $IPATH/lib/*.la

cd $SPATH/desktop-file-utils-0.22
configure
make clean
make install

cd $SPATH/gucharmap-3.12.0
configure $INTROSPECT
make clean
make
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gettext-0.18.3.2
configure --with-included-libxml --without-emacs --with-included-libcroco --with-included-libunistring --with-included-glib --with-included-gettext --disable-shared --disable-java --disable-csharp --enable-threads=win32
cd $SPATH/gettext-0.18.3.2/gettext-tools/intl
make clean
make $PJOBS
cd $SPATH/gettext-0.18.3.2/gettext-tools/libgettextpo
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gtranslator-2.91.6
configure LIBS=-lintl $INTROSPECT
make clean
make
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gedit-3.8.3
configure --disable-maintainer-mode $INTROSPECT
make clean
make
manifest
make install
rm $IPATH/lib/*.la

cd $SPATH/gedit-plugins-3.8.3
configure
make clean
make $PJOBS install

cd $SPATH/msitools-0.93
configure $INTROSPECT
find . -name *.lo -exec rm {} +
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/ghex-3.10.1
configure
make clean
make 
make install
rm $IPATH/lib/*.la

cd $SPATH/egg-list-box
configure --enable-maintainer-mode --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/gedit-code-assistance-0.3.1
configure
find . -name *.lo -exec rm {} +
make $PJOBS install

cd $SPATH/fftw-3.3.3
configure --enable-sse2 --with-our-malloc --enable-single --disable-fortran
make clean
make $PJOBS install
rm $IPATH/lib/*.la

if [ ! -d $IPATH/lib/ladspa ]; then mkdir $IPATH/lib/ladspa; fi
cd $SPATH/ladspa_sdk/cmt
cd src
make clean
make $PJOBS 
cp ../plugins/cmt.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/calf-0.0.18.6
configure --without-lv2 --without-dssi LIBS=-lws2_32
make clean
if [ "$MULTILIB" == "64" ]; then
set +e
fi
make $PJOBS install -k
set -e

cd $SPATH/ladspa_sdk/blop-0.2.8
configure --disable-nls LIBS=-ldl
make clean
make
if [ ! -d $IPATH/lib/ladspa/blop_files ]; then mkdir $IPATH/lib/ladspa/blop_files; fi
cp src/*.dll $IPATH/lib/ladspa
mv $IPATH/lib/ladspa/*data.dll $IPATH/lib/ladspa/blop_files

#64bit FAILED
cd $SPATH/ladspa_sdk/caps-0.4.5
make clean
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/MCP-plugins-0.3.0
make clean
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/foo-plugins-1.2
make clean
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/invada-studio-plugins-0.3.1
make clean
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/LEET-plugins-0.2
make clean
make $PJOBS  all
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/lemux-0.2
make clean
cd $SPATH/ladspa_sdk/lemux-0.2/dev/SID/resid
configure
make clean
make $PJOBS 
cd $SPATH/ladspa_sdk/lemux-0.2
make $PJOBS 
cp gen/*.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/vamp-plugin-sdk-2.5
configure --disable-shared
make clean 
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/ladspa_sdk/rubberband-1.8.1
configure --disable-static
make clean 
make $PJOBS install
rm $IPATH/lib/*.la
mv $IPATH/bin/librubberband-0.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/pvoc-0.1.12
make clean 
make $PJOBS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/REV-plugins-0.3.1
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/omins-0.2.0
configure
make clean 
make $PJOBS install

cd $SPATH/ladspa_sdk/guitarix-0.28.2/ladspa
$CXX $CXXFLAGS -shared -o guitarix_crybaby.dll crybaby.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_distortion.dll distortion.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_echo.dll echo.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_freeverb.dll freeverb.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix.dll guitarix-ladspa.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_compressor.dll monocompressor.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_amp.dll monoamp.cpp $LDFLAGS
$CXX $CXXFLAGS -shared -o guitarix_IR.dll impulseresponse.cpp $LDFLAGS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/nl-filter-0.1.0
configure
make clean 
make $PJOBS install
rm $IPATH/lib/ladspa/*.la $IPATH/lib/ladspa/*.dll.a

cd $SPATH/ladspa_sdk/swh-plugins-0.4.15
configure --disable-nls
make clean 
make $PJOBS install

cd $SPATH/ladspa_sdk/libbs2b-3.1.0
configure
make clean 
make $PJOBS install
rm $IPATH/lib/*.la 

cd $SPATH/ladspa_sdk/ladspa-bs2b-0.9.1
configure
make clean 
make $PJOBS install
rm $IPATH/lib/ladspa/*.la $IPATH/lib/ladspa/*.dll.a

cd $SPATH/ladspa_sdk/AMB-plugins-0.1.0
make clean 
make $PJOBS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/vcf-0.0.5
set +e
rm *.o *.dll
set -e
make $PJOBS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/aweight
make clean 
make $PJOBS awplug.dll
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/VCO-plugins-0.3.0
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/njl-plugins
set +e
rm *.o *.dll
set -e
make $PJOBS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/vlevel-0.5
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/blepvco-0.1.0
make clean 
make $PJOBS
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/autotalent-0.2
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/vocoder-0.3
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/nova_filters-0.2
$CXX $CXXFLAGS $CPPFLAGS -Inova/source -shared -o $IPATH/lib/ladspa/nova_filters.dll filters.cpp $LDFLAGS

cd $SPATH/ladspa_sdk/tap-plugins-0.7.1
make clean 
make $PJOBS 
cp *.dll $IPATH/lib/ladspa

cd $SPATH/ladspa_sdk/wasp-0.1.4
make clean 
make $PJOBS 
cp plugins/*.dll $IPATH/lib/ladspa

cd $SPATH/isas-isas
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/djvulibre
configure --enable-static --disable-shared --disable-desktopfiles LDFLAGS="$LDFLAGS -liconv"
make clean
make install
rm $IPATH/lib/*.la

cd $SPATH/kpathsea
configure --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/evince-3.12.1
configure --disable-static $INTROSPECT
make clean
make
manifest
make install
rm $IPATH/lib/*.la

#cd $SPATH/libskk-wip-libgee-0.8
#configure --disable-static $INTROSPECT
#find . -name *.lo -o -name *.gir -o -name *.typelib -exec rm {} +
#make install
#rm $IPATH/lib/*.la

cd $SPATH/libmediaart-0.3.0
configure --disable-unit-tests $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/sugar-toolkit-gtk3-0.101.4
configure --disable-static $INTROSPECT
cd src/sugar3/event-controller
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libcryptui-3.10.1
configure --disable-static --disable-gpg-check $INTROSPECT
make clean
cd libcryptui
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libgee-0.6.8
configure $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/jansson-2.6
configure --disable-shared --enable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/clinica-0.3.0
if [ -f CMakeCache.txt ]; then rm -rdf CMakeFiles/ CMakeCache.txt; fi
cmake -G "MSYS Makefiles" -DCMAKE_INSTALL_PREFIX=$IPATH -DCMAKE_BUILD_TYPE=MinSizeRel
# there is patched autogenerated c file, so don't make clean
find . -name *.obj -exec rm {} +
make $PJOBS
make install
cp plugins/libCodiceFiscale.dll $IPATH/lib/clinica/plugins

cd $SPATH/libgtkmusic-0.21
configure --disable-static $INTROSPECT
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/marisa-0.2.4
configure --enable-sse2 --disable-shared
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libskk-1.0.1
configure --disable-static $INTROSPECT
find . -name *.la -exec rm {} +
find . -name *.lo -exec rm {} +
find . -name *.gir -exec rm {} +
find . -name *.typelib -exec rm {} +
set +e
make
set -e
patch -p0 -i util.patch
make install
rm $IPATH/lib/*.la

cd $SPATH/libkkc-0.3.3
configure 
find . -name *.lo -exec rm {} +
cd $SPATH/libkkc-0.3.3/marisa-glib
make
cd $SPATH/libkkc-0.3.3/libkkc
make install-libLTLIBRARIES
make install-girDATA
make install-pkgconfigDATA
make install-libkkcincludeHEADERS
rm $IPATH/lib/*.la

cd $SPATH/libdbusmenu-12.10.2
configure --disable-static --disable-dumper
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/dee-1.2.7
configure --disable-icu --disable-tests
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/libzapojit-0.0.3
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/totem-pl-parser-3.10.2
configure --disable-static
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/grilo-0.2.10
configure --disable-static --disable-vala
make clean
make $PJOBS install
rm $IPATH/lib/*.la

cd $SPATH/grilo-plugins-0.2.12
configure --disable-static
make clean
make $PJOBS install