gtk+2.24.0-glib-2.28.1-staticLib-mingw32-x86-2016-08-10.7z

GTK_PATH=D:/MSYS/opt/gtk+2.24.0-staticLib
b1-static.sh
------------------------------------------------------------------------------
CL="-I$GTK_PATH/include/gtk-2.0 
	-I$GTK_PATH/include/glib-2.0 
	-I$GTK_PATH/lib/glib-2.0/include 
	-I$GTK_PATH/include/gdk-pixbuf-2.0 
	-I$GTK_PATH/include/pango-1.0 
	-I$GTK_PATH/include/cairo 
	-I$GTK_PATH/include/atk-1.0 
	-L$GTK_PATH/lib 
	-lgtk-win32-2.0 
	-lgdk-win32-2.0 
	-lgdk_pixbuf-2.0 
	-lgobject-2.0 -lglib-2.0 
	-lpango-1.0 -latk-1.0 -lcairo -lcairo-gobject -lpangocairo-1.0 
	-lintl -lgmodule-2.0 -lgio-2.0 -limm32 -luser32 -lgdi32 -luuid -lole32 
	-lpng -lgdiplus -lpangowin32-1.0  -lws2_32 -lwinmm -lglib-2.0 -lgthread-2.0 
	-lpixman-1 -lfreetype -lfontconfig -lpangoft2-1.0 -lmsimg32 -liconv 
	-lshlwapi -lz -lgdi32 -ldnsapi -lusp10 -lfreetype 
	-lexpat -lgcc -lkernel32 -lmsvcrt -ljpeg -ltiff -ljasper -w"

echo $CL

if [ ! -d "bin-static" ]; then
  echo "MK bin-static"
  mkdir bin-static
fi
echo "DEL bin-static/*.o *.exe"
rm -f bin-static/*.o bin-static/*.exe
echo "CC bin-static/hello_gtk.o"
gcc hello_gtk.c -g -c -o bin-static/hello_gtk.o $CL 
echo "LN bin-static/hello_gtk-g.exe" 
gcc bin-static/hello_gtk.o -o bin-static/hello_gtk-g.exe $CL 
echo "CP bin-static/hello_gtk-g.exe bin-static/hello_gtk.exe"
cp bin-static/hello_gtk-g.exe bin-static/hello_gtk.exe
echo "ST bin-static/hello_gtk.exe"
strip bin-static/hello_gtk.exe
echo "UPX bin-static/hello_gtk.exe"
upx -9 -vfk bin-static/hello_gtk.exe -o bin-static/hello_gtk-upx.exe
------------------------------------------------------------------------------
-rwxr-xr-x 1 root 26398304 Aug 10 15:34 hello_gtk-g.exe
-rwxr-xr-x 1 root  7812622 Aug 10 15:34 hello_gtk.exe
-rwxr-xr-x 1 root  2459150 Aug 10 15:34 hello_gtk-upx.exe
------------------------------------------------------------------------------
upx 压缩后 2M左右.

注意:编译其他库时 LIBS 环境变量中不能加 -lsupc++

链接:http://pan.baidu.com/s/1c25cuuG 密码:yjq5
gtk+2.24.0-glib-2.28.1-staticLib-mingw32-x86-2016-08-10.7z


如果不想自己编译直接用库时 参见
http://ftp.acc.umu.se/pub/gnome/binaries/win32/
http://download.opensuse.org/repositories/windows:/mingw:/win32/
原文地址:https://www.cnblogs.com/nlsoft/p/5757092.html