source: rtems-source-builder/source-builder/defaults.mc @ 8a7428c

4.104.114.95
Last change on this file since 8a7428c was b31d5e2, checked in by Chris Johns <chrisj@…>, on 01/23/15 at 03:31:25

Fix C++ build support for cross-compiling RTEMS 3rd party packages.

  • Property mode set to 100644
File size: 15.8 KB
Line 
1#
2# RTEMS Tools Project (http://www.rtems.org/)
3# Copyright 2010-2013 Chris Johns (chrisj@rtems.org)
4# All rights reserved.
5#
6# This file is part of the RTEMS Tools package in 'rtems-tools'.
7#
8# Permission to use, copy, modify, and/or distribute this software for any
9# purpose with or without fee is hereby granted, provided that the above
10# copyright notice and this permission notice appear in all copies.
11#
12# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
20#
21# All paths in defaults must be Unix format. Do not store any Windows format
22# paths in the defaults.
23#
24# Every entry must describe the type of checking a host must pass.
25#
26# Records:
27#  key: type, attribute, value
28#   type     : none, dir, exe, triplet
29#   attribute: none, required, optional
30#   value    : 'single line', '''multi line'''
31#
32
33#
34# Global defaults
35#
36[global]
37
38# Nothing
39nil:                 none,    none,     ''
40
41# Set to invalid values.
42_bset:               none,    none,     ''
43name:                none,    none,     ''
44version:             none,    none,     ''
45release:             none,    none,     ''
46buildname:           none,    none,     '%{name}'
47
48# GNU triples needed to build packages
49_host:               triplet, required, ''
50_build:              triplet, required, ''
51_target:             none,    optional, ''
52
53# The user
54_uid:                none,    convert,  '%(%{__id_u} -n)'
55
56# Default flags that can be overridded to supply specific host or build
57# flags and include paths to the tools. The host is the final platform
58# the tools will run on and build is the host building the tools.
59host_cflags:         none,    convert,  '-O2 -pipe'
60host_cxxflags:       none,    convert,  '-O2 -pipe'
61host_includes:       none,    convert,  ''
62build_cflags:        none,    convert,  '-O2 -pipe'
63build_cxxflags:      none,    convert,  '-O2 -pipe'
64build_includes:      none,    convert,  ''
65
66# Extra path a platform can override.
67_extra_path:         none,    none,     '%{_sbdir}'
68_ld_library_path:    none,    none,     'LD_LIBRARY_PATH'
69
70# Paths
71_host_platform:      none,    none,     '%{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}'
72_host_cc:            none,    none,     'gcc'
73_host_cxx:           none,    none,     'g++'
74_arch:               none,    none,     '%{_host_arch}'
75_topdir:             dir,     required, '%{_cwd}'
76_configdir:          dir,     optional, '%{_topdir}/config:%{_sbdir}/config:%{_sbtop}/bare/config'
77_tardir:             dir,     optional, '%{_topdir}/tar'
78_sourcedir:          dir,     optional, '%{_topdir}/sources'
79_patchdir:           dir,     optional, '%{_topdir}/patches:%{_sbdir}/patches'
80_builddir:           dir,     optional, '%{_topdir}/build/%{buildname}'
81_buildcxcdir:        dir,     optional, '%{_topdir}/build/%{buildname}-cxc'
82_docdir:             dir,     none,     '%{_defaultdocdir}'
83_tmppath:            dir,     none,     '%{_topdir}/build/tmp'
84_tmproot:            dir,     none,     '%{_tmppath}/sb-%{_uid}/%{_bset}'
85_tmpcxcroot:         dir,     none,     '%{_tmppath}/sb-%{_uid}-cxc/%{_bset}'
86buildroot:           dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}'
87buildcxcroot:        dir,     none,     '%{_tmppath}/%{buildname}-%{_uid}-cxc'
88_datadir:            dir,     none,     '%{_prefix}/share'
89_defaultdocdir:      dir,     none,     '%{_prefix}/share/doc'
90_exeext:             none,    none,     ''
91_exec_prefix:        dir,     none,     '%{_prefix}'
92_bindir:             dir,     none,     '%{_exec_prefix}/bin'
93_sbindir:            dir,     none,     '%{_exec_prefix}/sbin'
94_libexecdir:         dir,     none,     '%{_exec_prefix}/libexec'
95_datarootdir:        dir,     none,     '%{_prefix}/share'
96_datadir:            dir,     none,     '%{_datarootdir}'
97_sysconfdir:         dir,     none,     '%{_prefix}/etc'
98_sharedstatedir:     dir,     none,     '%{_prefix}/com'
99_localstatedir:      dir,     none,     '%{prefix}/var'
100_includedir:         dir,     none,     '%{_prefix}/include'
101_lib:                dir,     none,     'lib'
102_libdir:             dir,     none,     '%{_exec_prefix}/%{_lib}'
103_libexecdir:         dir,     none,     '%{_exec_prefix}/libexec'
104_mandir:             dir,     none,     '%{_datarootdir}/man'
105_infodir:            dir,     none,     '%{_datarootdir}/info'
106_localedir:          dir,     none,     '%{_datarootdir}/locale'
107_localedir:          dir,     none,     '%{_datadir}/locale'
108_localstatedir:      dir,     none,     '%{_prefix}/var'
109_pathprepend:        none,    none,     ''
110_pathpostpend:       none,    none,     ''
111_prefix:             dir,     none,     '%{_usr}'
112_usr:                dir,     none,     '/usr/local'
113_usrsrc:             dir,     none,     '%{_usr}/src'
114_var:                dir,     none,     '/usr/local/var'
115_varrun:             dir,     none,     '%{_var}/run'
116
117# Defaults, override in platform specific modules.
118___setup_shell:      exe,     required, '/bin/sh'
119__aclocal:           exe,     optional, 'aclocal'
120__ar:                exe,     required, 'ar'
121__arch_install_post: exe,     none,     '%{nil}'
122__as:                exe,     required, 'as'
123__autoconf:          exe,     optional, 'autoconf'
124__autoheader:        exe,     optional, 'autoheader'
125__automake:          exe,     optional, 'automake'
126__autoreconf:        exe,     optional, 'autoreconf'
127__awk:               exe,     required, 'awk'
128__bash:              exe,     optional, '/bin/bash'
129__bison:             exe,     required, '/usr/bin/bison'
130__bzip2:             exe,     required, '/usr/bin/bzip2'
131__cat:               exe,     required, '/bin/cat'
132__cc:                exe,     required, '/usr/bin/gcc'
133__chgrp:             exe,     required, '/usr/bin/chgrp'
134__chmod:             exe,     required, '/bin/chmod'
135__chown:             exe,     required, '/usr/sbin/chown'
136__cp:                exe,     required, '/bin/cp'
137__cpp:               exe,     none,     '%{__cc} -E'
138__cvs:               exe,     required, '/usr/bin/cvs'
139__cvs_z:             none,    none,     '%{__cvs} -z 9'
140__cxx:               exe,     required, '/usr/bin/g++'
141__flex:              exe,     required, '/usr/bin/flex'
142__git:               exe,     required, '/usr/bin/git'
143__grep:              exe,     required, '/usr/bin/grep'
144__gzip:              exe,     required, '/usr/bin/gzip'
145__id:                exe,     required, '/usr/bin/id'
146__id_u:              exe,     none,     '%{__id} -u'
147__install:           exe,     required, '/usr/bin/install'
148__install_info:      exe,     optional, '/usr/bin/install-info'
149__ld:                exe,     required, '/usr/bin/ld'
150__ldconfig:          exe,     required, '/sbin/ldconfig'
151__ln_s:              exe,     none,     'ln -s'
152__make:              exe,     required, 'make'
153__makeinfo:          exe,     required, '/usr/bin/makeinfo'
154__mkdir:             exe,     required, '/bin/mkdir'
155__mkdir_p:           exe,     none,     '/bin/mkdir -p'
156__mv:                exe,     required, '/bin/mv'
157__nm:                exe,     required, '/usr/bin/nm'
158__objcopy:           exe,     optional, '/usr/bin/objcopy'
159__objdump:           exe,     optional, '/usr/bin/objdump'
160__patch_bin:         exe,     required, '/usr/bin/patch'
161__patch_opts:        none,    none,     '%{nil}'
162__patch:             exe,     none,     '%{__patch_bin} %{__patch_opts}'
163__perl:              exe,     optional, 'perl'
164__svn:               exe,     optional, '/usr/bin/svn'
165__ranlib:            exe,     required, 'ranlib'
166__rm:                exe,     required, '/bin/rm'
167__rmfile:            exe,     none,     '%{__rm} -f'
168__rmdir:             exe,     none,     '%{__rm} -rf'
169__sed:               exe,     required, '/usr/bin/sed'
170__setup_post:        exe,     none,     '%{__chmod} -R a+rX,g-w,o-w .'
171__sh:                exe,     required, '/bin/sh'
172__tar:               exe,     required, '/usr/bin/tar'
173__tar_extract:       exe,     none,     '%{__tar} -xvvf'
174__touch:             exe,     required, '/usr/bin/touch'
175__unzip:             exe,     required, '/usr/bin/unzip'
176__xz:                exe,     required, '/usr/bin/xz'
177
178# Shell Build Settings.
179___build_args:       none,    none,     '-e'
180___build_cmd:        none,    none,     '%{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}'
181___build_post:       none,    none,     'exit 0'
182
183# Prebuild set up script.
184___build_pre:        none,    none,     '''# ___build_pre in as set up in defaults.py
185# Save the original path away.
186export SB_ORIG_PATH=${PATH}
187# Directories
188%{?_prefix:SB_PREFIX="%{_prefix}"}
189%{?_prefix:SB_PREFIX_CLEAN=$(echo "%{_prefix}" | %{__sed} -e 's/^\///')}
190SB_SOURCE_DIR="%{_sourcedir}"
191SB_BUILD_DIR="%{_builddir}"
192# host == build, use build; host != build , host uses host and build uses build
193SB_HOST_CFLAGS="%{host_cflags} %{host_includes}"
194SB_HOST_CXXFLAGS="%{host_cxxflags} %{host_includes}"
195SB_HOST_LDFLAGS="%{?host_ldflags:%{host_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
196SB_BUILD_CFLAGS="%{build_cflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
197SB_BUILD_CXXFLAGS="%{build_cxxflags} %{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include}"
198SB_BUILD_LDFLAGS="%{?build_ldflags:%{build_ldflags}}%{?_tmproot:-L%{_tmproot}/${SB_PREFIX_CLEAN}/lib}"
199SB_CFLAGS="${SB_BUILD_CFLAGS} %{build_includes}"
200SB_CXXFLAGS="${SB_BUILD_CXXFLAGS} %{build_includes}"
201SB_ARCH="%{_arch}"
202SB_OS="%{_os}"
203export SB_SOURCE_DIR SB_BUILD_DIR SB_ARCH SB_OS
204export SB_HOST_CFLAGS SB_HOST_CXXFLAGS SB_HOST_LDFLAGS
205export SB_BUILD_CFLAGS SB_BUILD_CXXFLAGS SB_BUILD_LDFLAGS
206export SB_CFLAGS SB_CXXFLAGS
207# Documentation
208SB_DOC_DIR="%{_docdir}"
209export SB_DOC_DIR
210# Packages
211SB_PACKAGE_NAME="%{name}"
212SB_PACKAGE_BUILDNAME="%{buildname}"
213SB_PACKAGE_VERSION="%{version}"
214SB_PACKAGE_RELEASE="%{release}"
215export SB_PACKAGE_NAME SB_PACKAGE_VERSION SB_PACKAGE_RELEASE
216# Build directories
217export SB_PREFIX
218%{?_builddir:SB_BUILD_DIR="%{_builddir}"}
219%{?buildroot:SB_BUILD_ROOT="%{buildroot}"}
220%{?buildroot:%{?_prefix:SB_BUILD_ROOT_BINDIR="%{buildroot}/${SB_PREFIX_CLEAN}/bin"}}
221export SB_BUILD_ROOT SB_BUILD_DIR SB_BUILD_ROOT_BINDIR
222%{?_buildcxcdir:SB_BUILD_CXC_DIR="%{_buildcxcdir}"}
223%{?buildcxcroot:SB_BUILD_CXC_ROOT="%{buildcxcroot}"}
224%{?buildcxcroot:%{?_prefix:SB_BUILD_CXC_ROOT_BINDIR="%{buildcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
225export SB_BUILD_CXC_ROOT SB_BUILD_CXC_DIR SB_BUILD_CXC_ROOT_BINDIR
226%{?_tmproot:SB_TMPROOT="%{_tmproot}"}
227%{?_tmproot:%{?_prefix:SB_TMPPREFIX="%{_tmproot}/${SB_PREFIX_CLEAN}"}}
228%{?_tmproot:%{?_prefix:SB_TMPBINDIR="%{_tmproot}/${SB_PREFIX_CLEAN}/bin"}}
229export SB_TMPROOT SB_TMPPREFIX SB_TMPBINDIR
230%{?_tmpcxcroot:SB_TMPCXCROOT="%{_tmproot}"}
231%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCPREFIX="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}"}}
232%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCBINDIR="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
233export SB_TMPCXCROOT SB_TMPCXCPREFIX SB_TMPCXCBINDIR
234# Extra path support
235%{?_extra_path:SB_EXTRAPATH="%{_extra_path}"}
236# The compiler flags
237%{?_targetcflags:CFLAGS_FOR_TARGET="%{_targetcflags}"}
238%{?_targetcxxflags:CXXFLAGS_FOR_TARGET="%{_targetcxxflags}"}
239export CFLAGS_FOR_TARGET
240export CXXFLAGS_FOR_TARGET
241# Set up the path. Put the CXC path first.
242if test -n "${SB_TMPBINDIR}" ; then
243 PATH="${SB_TMPBINDIR}:$PATH"
244fi
245if test -n "${SB_TMPCXCBINDIR}" ; then
246 PATH="${SB_TMPCXCBINDIR}:$PATH"
247fi
248if test -n "${SB_EXTRAPATH}" ; then
249 PATH="${SB_EXTRAPATH}:$PATH"
250fi
251%{?_pathprepend:PATH="%{_pathprepend}:$PATH"}
252%{?_pathpostpend:PATH="$PATH:%{_pathpostpend}"}
253export PATH
254# Default environment set up.
255LANG=C
256export LANG
257unset DISPLAY || :
258umask 022
259cd "%{_builddir}"'''
260
261___build_shell:      none,    none,     '%{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}'
262
263___build_template:   none,    none,     '''#!%{___build_shell}
264%{___build_pre}
265%{nil}'''
266
267# Configure command
268configure:           none,    none,     '''
269CFLAGS="${CFLAGS:-${SB_CFLAGS}" ; export CFLAGS ;
270CXXFLAGS="${CXXFLAGS:-${SB_CFLAGS}}" ; export CXXFLAGS ;
271FFLAGS="${FFLAGS:-${SB_CFLAGS}}" ; export FFLAGS ;
272./configure --build=%{_build} --host=%{_host} \
273      --target=%{_target_platform} \
274      --program-prefix=%{?_program_prefix} \
275      --prefix=%{_prefix} \
276      --exec-prefix=%{_exec_prefix} \
277      --bindir=%{_bindir} \
278      --sbindir=%{_sbindir} \
279      --sysconfdir=%{_sysconfdir} \
280      --datadir=%{_datadir} \
281      --includedir=%{_includedir} \
282      --libdir=%{_libdir} \
283      --libexecdir=%{_libexecdir} \
284      --localstatedir=%{_localstatedir} \
285      --sharedstatedir=%{_sharedstatedir} \
286      --mandir=%{_mandir} \
287      --infodir=%{_infodir}'''
288
289# Build script support.
290build_directory:     none,    none,     '''
291if test "%{_build}" != "%{_host}" ; then
292  if test -z "%{_target}" ; then
293    build_dir="build-xc"
294  else
295    build_dir="build-cxc"
296  fi
297else
298  build_dir="build"
299fi'''
300
301# Host/build flags.
302host_build_flags:    none,    none,     '''
303# Host and build flags, Cross build if host and build are different and
304# Cxc build idf target is deifned and also different.
305# Note, gcc is not ready to be compiled with -std=gnu99 (this needs to be checked).
306if test "%{_build}" != "%{_host}" ; then
307  # Cross build
308  CC=$(echo "%{_host}-%{_host_cc}" | sed -e 's,-std=gnu99 ,,')
309  CXX=$(echo "%{_host}-%{_host_cxx}" | sed -e 's,-std=gnu99 ,,')
310  CFLAGS="${SB_HOST_CFLAGS}"
311  CXXFLAGS="${SB_HOST_CXXFLAGS}"
312  LDFLAGS="${SB_HOST_LDFLAGS}"
313  # Host
314  CFLAGS_FOR_HOST="${SB_HOST_CFLAGS}"
315  CXXFLAGS_FOR_HOST="${SB_HOST_CXXFLAGS}"
316  LDFLAGS_FOR_HOST="${SB_HOST_LDFLAGS}"
317  CXXFLAGS_FOR_HOST="${SB_HOST_CFLAGS}"
318  CC_FOR_HOST=$(echo "%{_host_cc} ${SB_HOST_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
319  CXX_FOR_HOST=$(echo "%{_host_cxx} ${SB_HOST_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
320  # Build
321  CFLAGS_FOR_BUILD="${SB_BUILD_CFLAGS}"
322  CXXFLAGS_FOR_BUILD="${SB_BUILD_CXXFLAGS}"
323  LDFLAGS_FOR_BUILD="${SB_BUILD_LDFLAGS}"
324  CXXFLAGS_FOR_BUILD="${SB_BUILD_CFLAGS}"
325  CC_FOR_BUILD=$(echo "%{__cc} ${SB_BUILD_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
326  CXX_FOR_BUILD=$(echo "%{__cxx} ${SB_BUILD_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
327else
328  LDFLAGS="${SB_BUILD_LDFLAGS}"
329  CC=$(echo "%{__cc} ${SB_BUILD_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
330  CXX=$(echo "%{__cxx} ${SB_BUILD_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
331  CC_FOR_BUILD=${CC}
332  CXX_FOR_BUILD=${CXX}
333fi
334export CC CXX CFLAGS CXXFLAGS LDFLAGS
335export CC_FOR_HOST CXX_FOR_HOST CFLAGS_FOR_HOST CXXFLAGS_FOR_HOST LDFLAGS_FOR_HOST
336export CC_FOR_BUILD CXX_FOR_BUILD CFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD LDFLAGS_FOR_BUILD'''
337
338# Build/build flags.
339build_build_flags:    none,    none,     '''
340# Build and build flags means force build == host
341# gcc is not ready to be compiled with -std=gnu99
342LDFLAGS="${SB_HOST_LDFLAGS}"
343CC=$(echo "%{__cc} ${SB_CFLAGS}" | sed -e 's,-std=gnu99 ,,')
344CXX=$(echo "%{__cxx} ${SB_CXXFLAGS}" | sed -e 's,-std=gnu99 ,,')
345CC_FOR_BUILD=${CC}
346CXX_FOR_BUILD=${CXX}
347export CC CXX CC_FOR_BUILD CXX_FOR_BUILD CFLAGS LDFLAGS'''
348
349# Default package settings
350_forced_static:     none,         none, '-Xlinker -Bstatic ${LIBS_STATIC} -Xlinker -Bdynamic'
351__xz:                exe,     required, '/usr/bin/xz'
352
353# Mail Support
354_mail_smtp_host:   none,         none, 'localhost'
355_mail_tools_to:    none,         none, 'rtems-tooltestresults@rtems.org'
356
357# Newlib ICONV encodings
358_newlib_iconv_encodings: none,      none, '''big5,cp775,cp850,cp852,cp855,\
359cp866,euc_jp,euc_kr,euc_tw,iso_8859_1,iso_8859_10,iso_8859_11,\
360iso_8859_13,iso_8859_14,iso_8859_15,iso_8859_2,iso_8859_3,\
361iso_8859_4,iso_8859_5,iso_8859_6,iso_8859_7,iso_8859_8,iso_8859_9,\
362iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,\
363ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,\
364utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,\
365win_1253,win_1254,win_1255,win_1256,win_1257,win_1258'''
Note: See TracBrowser for help on using the repository browser.