Last active
June 1, 2018 11:47
-
-
Save z-rui/61a6722d3c858197d0d8 to your computer and use it in GitHub Desktop.
GTK+ Build script for Msys2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CURL=curl -L | |
TAR=tar | |
MAKEOPTS=-j2 | |
prefix=$(shell pwd)/gtk-root | |
export PKG_CONFIG_PATH=$(prefix)/lib/pkgconfig | |
# some stupid configure scripts requires shared library | |
# available even if it is installed to a non-standard | |
# place. | |
# in order to override the shared libraries that have | |
# been installed system-wide, we put the binary path | |
# before the system path. | |
export PATH=$(prefix)/bin:$(shell echo $$PATH) | |
# some packages (namely gettext) do not use pkg-config. | |
# so we manually specify the include path and library | |
# path so that the compiler do not compile with a wrong | |
# header file or link with a wrong library. | |
export CFLAGS=-I$(prefix)/include | |
export LDFLAGS=-L$(prefix)/lib | |
################# LIBRARY VERSIONS ##################### | |
ZLIB=zlib-1.2.8 | |
LIBPNG=libpng-1.6.23 | |
PIXMAN=pixman-0.34.0 | |
LIBICONV=libiconv-1.14 | |
GETTEXT=gettext-0.19.8 | |
LIBFFI=libffi-3.2.1 | |
# cairo 1.14.6 won't work for latest GTK+ | |
CAIRO_BRANCH=snapshots | |
CAIRO=cairo-1.15.2 | |
WIN_ICONV_VERSION=0.0.8 | |
WIN_ICONV=win-iconv-$(WIN_ICONV_VERSION) | |
LIBEPOXY_VERSION=1.3.1 | |
LIBEPOXY=libepoxy-$(LIBEPOXY_VERSION) | |
# GNU packages need special care... | |
GLIB_MAJOR=2.49 | |
GLIB_MINOR=1 | |
GLIB=glib-$(GLIB_MAJOR).$(GLIB_MINOR) | |
ATK_MAJOR=2.20 | |
ATK_MINOR=0 | |
ATK=atk-$(ATK_MAJOR).$(ATK_MINOR) | |
GDK_PIXBUF_MAJOR=2.35 | |
GDK_PIXBUF_MINOR=1 | |
GDK_PIXBUF=gdk-pixbuf-$(GDK_PIXBUF_MAJOR).$(GDK_PIXBUF_MINOR) | |
PANGO_MAJOR=1.40 | |
PANGO_MINOR=1 | |
PANGO=pango-$(PANGO_MAJOR).$(PANGO_MINOR) | |
GTK_MAJOR=3.21 | |
GTK_MINOR=2 | |
GTK=gtk+-$(GTK_MAJOR).$(GTK_MINOR) | |
ADWAITA_ICON_THEME_MAJOR=3.20 | |
ADWAITA_ICON_THEME_MINOR= | |
ADWAITA_ICON_THEME=adwaita-icon-theme-$(ADWAITA_ICON_THEME_MAJOR) | |
############# END OF LIBRARY VERSIONS ################## | |
# build recipes | |
ALL=zlib libpng pixman iconv gettext libffi glib atk gdk-pixbuf cairo pango libepoxy gtk+ | |
all: gtk+ | |
zlib: $(ZLIB) | |
cd $< && \ | |
make install -f win32/Makefile.gcc \ | |
SHARED_MODE=1 \ | |
BINARY_PATH=$(prefix)/bin \ | |
INCLUDE_PATH=$(prefix)/include \ | |
LIBRARY_PATH=$(prefix)/lib | |
touch $@ | |
libpng: $(LIBPNG) zlib | |
cd $< && \ | |
./configure --prefix=$(prefix) \ | |
--disable-static \ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
pixman: $(PIXMAN) libpng | |
cd $< && \ | |
./configure --prefix=$(prefix) \ | |
--disable-openmp \ | |
--disable-static \ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
iconv: $(WIN_ICONV) # or LIBICONV if you prefer | |
cd $< && \ | |
make CC=gcc && \ | |
make prefix=$(prefix) install | |
touch $@ | |
gettext: $(GETTEXT) iconv | |
cd $< && \ | |
./configure \ | |
--prefix=$(prefix) \ | |
--disable-static \ | |
--disable-java \ | |
--disable-acl \ | |
--disable-libasprintf \ | |
--disable-openmp \ | |
--disable-curses | |
cd $</gettext-runtime && make $(MAKEOPTS) && make install | |
touch $@ | |
libffi: $(LIBFFI) | |
cd $< && \ | |
./configure \ | |
--prefix=$(prefix) \ | |
--disable-static \ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
glib: $(GLIB) gettext libffi | |
cd $< && \ | |
./configure \ | |
--prefix=$(prefix)\ | |
--disable-static \ | |
--with-pcre=internal \ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
atk: $(ATK) glib gettext | |
cd $< && \ | |
./configure \ | |
--prefix=$(prefix)\ | |
--disable-static \ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
gdk-pixbuf: $(GDK_PIXBUF) libpng zlib gettext glib | |
cd $< && \ | |
./configure \ | |
--prefix=$(prefix)\ | |
--disable-static \ | |
--with-included-loaders=yes \ | |
--disable-modules\ | |
--enable-relocations\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
cairo: $(CAIRO) glib libpng zlib pixman | |
cd $< && \ | |
./configure \ | |
--disable-static \ | |
--prefix=$(prefix)\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
pango: $(PANGO) cairo glib | |
cd $< && \ | |
./configure \ | |
--disable-static \ | |
--prefix=$(prefix)\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
libepoxy: $(LIBEPOXY) | |
cd $< && \ | |
./configure \ | |
--disable-static \ | |
--prefix=$(prefix)\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
gtk+: $(GTK) glib atk pango gdk-pixbuf gettext cairo libepoxy | |
cd $< && \ | |
./configure \ | |
--disable-static \ | |
--prefix=$(prefix)\ | |
--disable-modules\ | |
--with-included-immodules=ime\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
# XXX We don't have librsvg; can't build the theme. | |
adwaita-icon-theme: $(ADWAITA_ICON_THEME) gtk+ | |
cd $< && \ | |
./configure \ | |
--disable-static \ | |
--prefix=$(prefix)\ | |
&& make $(MAKEOPTS) && make install | |
touch $@ | |
clean: | |
rm $(ALL) | |
.PHONY: all clean | |
################## URLs for source tarballs ########################## | |
# WARNING: I do not verify the integrity of downloaded packages. | |
# *****USE AT YOUR OWN RISK!***** | |
# It is suggested that you do not run the script as a privileged user. | |
$(ZLIB): | |
$(CURL) -O http://zlib.net/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(LIBPNG): | |
$(CURL) -O http://prdownloads.sourceforge.net/libpng/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(PIXMAN): | |
$(CURL) -O http://cairographics.org/releases/$@.tar.gz | |
tar xvf $@.tar.gz | |
$(LIBICONV): | |
$(CURL) -O http://ftp.gnu.org/pub/gnu/libiconv/$@.tar.gz | |
tar xvf $@.tar.gz | |
# There is a lighter version of iconv library for Windows | |
$(WIN_ICONV): | |
$(CURL) https://github.com/win-iconv/win-iconv/archive/v$(WIN_ICONV_VERSION).tar.gz > $@.tar.gz | |
tar xvf $@.tar.gz | |
$(GETTEXT): | |
$(CURL) -O http://ftp.gnu.org/pub/gnu/gettext/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(LIBFFI): | |
$(CURL) -O ftp://mirrors.kernel.org/sourceware/libffi/$@.tar.gz | |
# $(CURL) -O ftp://sourceware.org/pub/libffi/$@.tar.gz | |
tar xvf $@.tar.gz | |
$(GLIB): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/glib/$(GLIB_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(ATK): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/atk/$(ATK_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(GDK_PIXBUF): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/$(GDK_PIXBUF_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz | |
# cairo-1.14.4: | |
# # Unfortunately, cairo-1.14.4 release tarball breaks in win32. | |
# # We will checkout an working version from the git repository. | |
# # This will require git, autoconf, automake, etc | |
# git clone --depth=30 \ | |
# git://anongit.freedesktop.org/git/cairo $@ | |
# cd $@ && git checkout e03ab054c129307596b9ec090a0e32a64b0cda71 \ | |
# && NOCONFIGURE=Yes ./autogen.sh | |
$(CAIRO): | |
$(CURL) -O http://cairographics.org/$(CAIRO_BRANCH)/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(PANGO): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/pango/$(PANGO_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(LIBEPOXY): | |
$(CURL) -O https://github.com/anholt/libepoxy/releases/download/v1.3.1/$@.tar.bz2 | |
tar xvf $@.tar.bz2 | |
$(GTK): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/gtk+/$(GTK_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz | |
$(ADWAITA_ICON_THEME): | |
$(CURL) -O http://ftp.gnome.org/pub/GNOME/sources/adwaita-icon-theme/$(ADWAITA_ICON_THEME_MAJOR)/$@.tar.xz | |
tar xvf $@.tar.xz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在Win7上用这个mak文件编译gtk 3.10.8,报错误:
win_iconv.c error: '_errno' undeclared
请问是怎么回事?