Since compiling Glib requires pkg-config and pkg-config depends on glib, there's an interdependency problem between glib and pkg-config. This poses a dilemma as one has to wonder which he should compile first, glib or pkg-config. I believe there's a need for a static pkg-config build in this situation.
So I started to build pkg-config statically. This means that the produced pkg-config won't have dependencies on libglib-2.0-0.dll, libintl-8.dll, libiconv-2.dll and libcharset-1.dll. The single pkg-config.exe will be self-sufficient. Basically, to produce static pkg-config, one should also build libiconv, gettext and glib statically, then build pkg-config, as shown below:
- First, compile libiconv statically
./configure --prefix=/mingw --disable-shared make make install
- Then, build gettext statically
./configure --prefix=/mingw --enable-threads=win32 --enable-relocatable --disable-shared make make install
- Temporarily, install Cygwin's pkg-config only to build static glib, as shown in this post.
- Build Glib statically
./configure --prefix=/mingw --with-threads=win32 --with-pcre=internal --disable-shared --disable-debug make make install
- At last, compile static Pkg-config
./configure --prefix=/mingw make make install
If you get compile errors about undefined references to libiconv, extract objects from libiconv.a and add them to libintl.a. Be warned this is unorthodox hack. Suggestions are welcome.
cd /mingw/lib ar x libiconv.a mv -iv relocatable.o iconv_relocatable.o ar r libintl.a iconv.o iconv_relocatable.o libiconv.res.o
make. You'll get static
pkg-config.exethat has no special dependency.
Here's the product of this tutorial: pkg-config.exe (static build).