1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# This file is part of MXE.
# See index.html for further information.
PKG := gcc
$(PKG)_IGNORE :=
$(PKG)_VERSION := 4.8.2
$(PKG)_CHECKSUM := 810fb70bd721e1d9f446b6503afe0a9088b62986
$(PKG)_SUBDIR := gcc-$($(PKG)_VERSION)
$(PKG)_FILE := gcc-$($(PKG)_VERSION).tar.bz2
$(PKG)_URL := ftp://ftp.gnu.org/pub/gnu/gcc/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_URL_2 := ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_DEPS := binutils gcc-cloog gcc-gmp gcc-isl gcc-mpc gcc-mpfr
$(PKG)_DEPS_i686-pc-mingw32 := mingwrt w32api
$(PKG)_DEPS_i686-w64-mingw32 := mingw-w64
$(PKG)_DEPS_x86_64-w64-mingw32 := mingw-w64
define $(PKG)_UPDATE
$(WGET) -q -O- 'http://ftp.gnu.org/gnu/gcc/?C=M;O=D' | \
$(SED) -n 's,.*<a href="gcc-\([0-9][^"]*\)/".*,\1,p' | \
$(SORT) -V | \
tail -1
endef
define $(PKG)_CONFIGURE
# configure gcc
mkdir '$(1).build'
cd '$(1).build' && '$(1)/configure' \
--target='$(TARGET)' \
--build="`config.guess`" \
--prefix='$(PREFIX)' \
--libdir='$(PREFIX)/lib' \
--enable-languages='c,c++,objc,fortran' \
--enable-version-specific-runtime-libs \
--with-gcc \
--with-gnu-ld \
--with-gnu-as \
--disable-nls \
--disable-shared \
--disable-multilib \
--without-x \
--disable-win32-registry \
--enable-threads=win32 \
--disable-libgomp \
--disable-libmudflap \
--with-cloog='$(PREFIX)' \
--with-gmp='$(PREFIX)' \
--with-isl='$(PREFIX)' \
--with-mpc='$(PREFIX)' \
--with-mpfr='$(PREFIX)' \
$(shell [ `uname -s` == Darwin ] && echo "LDFLAGS='-Wl,-no_pie'")
endef
define $(PKG)_POST_BUILD
# create pkg-config script
(echo '#!/bin/sh'; \
echo 'PKG_CONFIG_PATH="$$PKG_CONFIG_PATH_$(subst -,_,$(TARGET))" PKG_CONFIG_LIBDIR='\''$(PREFIX)/$(TARGET)/lib/pkgconfig'\'' exec pkg-config --static "$$@"') \
> '$(PREFIX)/bin/$(TARGET)-pkg-config'
chmod 0755 '$(PREFIX)/bin/$(TARGET)-pkg-config'
# create the CMake toolchain file
[ -d '$(dir $(CMAKE_TOOLCHAIN_FILE))' ] || mkdir -p '$(dir $(CMAKE_TOOLCHAIN_FILE))'
(echo 'set(CMAKE_SYSTEM_NAME Windows)'; \
echo 'set(MSYS 1)'; \
echo 'set(BUILD_SHARED_LIBS OFF)'; \
echo 'set(CMAKE_BUILD_TYPE Release)'; \
echo 'set(CMAKE_FIND_ROOT_PATH $(PREFIX)/$(TARGET))'; \
echo 'set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)'; \
echo 'set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)'; \
echo 'set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)'; \
echo 'set(CMAKE_C_COMPILER $(PREFIX)/bin/$(TARGET)-gcc)'; \
echo 'set(CMAKE_CXX_COMPILER $(PREFIX)/bin/$(TARGET)-g++)'; \
echo 'set(CMAKE_Fortran_COMPILER $(PREFIX)/bin/$(TARGET)-gfortran)'; \
echo 'set(CMAKE_RC_COMPILER $(PREFIX)/bin/$(TARGET)-windres)'; \
echo 'set(HDF5_C_COMPILER_EXECUTABLE $(PREFIX)/bin/$(TARGET)-h5cc)'; \
echo 'set(HDF5_CXX_COMPILER_EXECUTABLE $(PREFIX)/bin/$(TARGET)-h5c++)'; \
echo 'set(PKG_CONFIG_EXECUTABLE $(PREFIX)/bin/$(TARGET)-pkg-config)'; \
echo 'set(QT_QMAKE_EXECUTABLE $(PREFIX)/$(TARGET)/qt/bin/qmake)'; \
echo 'set(CMAKE_INSTALL_PREFIX $(PREFIX)/$(TARGET) CACHE PATH "Installation Prefix")'; \
echo 'set(CMAKE_BUILD_TYPE Release CACHE STRING "Debug|Release|RelWithDebInfo|MinSizeRel")') \
> '$(CMAKE_TOOLCHAIN_FILE)'
endef
define $(PKG)_POST_BUILD_mingw32
# create pkg-config files
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig'
(echo 'Name: gl'; \
echo 'Version: 0'; \
echo 'Description: OpenGL'; \
echo 'Libs: -lopengl32';) \
> '$(PREFIX)/$(TARGET)/lib/pkgconfig/gl.pc'
(echo 'Name: glu'; \
echo 'Version: 0'; \
echo 'Description: OpenGL'; \
echo 'Libs: -lglu32';) \
> '$(PREFIX)/$(TARGET)/lib/pkgconfig/glu.pc'
endef
define $(PKG)_BUILD_i686-pc-mingw32
# build full cross gcc
$($(PKG)_CONFIGURE) \
--disable-sjlj-exceptions
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 install
$($(PKG)_POST_BUILD)
$($(PKG)_POST_BUILD_mingw32)
endef
define $(PKG)_BUILD_mingw-w64
# build standalone gcc
$($(PKG)_CONFIGURE)
$(MAKE) -C '$(1).build' -j '$(JOBS)' all-gcc
$(MAKE) -C '$(1).build' -j 1 install-gcc
# build mingw-w64-crt
cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,mingw-w64)
mkdir '$(1).crt-build'
cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
mxe-config-opts
$(MAKE) -C '$(1).crt-build' -j '$(JOBS)' || $(MAKE) -C '$(1).crt-build' -j '$(JOBS)'
$(MAKE) -C '$(1).crt-build' -j 1 install
# build rest of gcc
cd '$(1).build'
$(MAKE) -C '$(1).build' -j '$(JOBS)'
$(MAKE) -C '$(1).build' -j 1 install
$($(PKG)_POST_BUILD)
$($(PKG)_POST_BUILD_mingw32)
endef
$(PKG)_BUILD_x86_64-w64-mingw32 = $(subst mxe-config-opts,--disable-lib32,$($(PKG)_BUILD_mingw-w64))
$(PKG)_BUILD_i686-w64-mingw32 = $(subst mxe-config-opts,--disable-lib64,$($(PKG)_BUILD_mingw-w64))
define $(PKG)_BUILD_$(BUILD)
for f in c++ cpp g++ gcc gcov; do \
ln -sf "`which $$f`" '$(PREFIX)/bin/$(TARGET)'-$$f ; \
done
$($(PKG)_POST_BUILD)
endef
|