Hi,
I was wondering if it might be useful to have a
Dude/SPECS/include/options.inc file that could
have stuff like options to build with debug symbols.
So that then if someone wanted to build a compiler
optimized, debug build they could place in their
~/.pkgbuildmacros file:
%_with_sun_branding 1
%_with_debug_optimized 1
This also requires simple changes to the flags*.inc
files, to:
(1) Replace -s with either %{_C_DEBUG_OR_STRIP},
%{_CXX_DEBUG_OR_STRIP}, %{_STRIP_IF_NOT_DEBUG} or
%{_LD_DEBUG_OR_STRIP}, depending on the context.
(2) %include options.inc
I have diffs for that but they are sort of unreadable
as there are so many compiler and linker options.
Thanks, Mark
The proposed Dude/SPECS/include/options.inc
#
# Option: --with-debug-optimized
#
# use --with-debug-optimized to build binaries compiler optimized with
# debug info (-g) and not to strip them.
# default: don't include debug info and strip the binaries (strip -x)
#
%define option_with_debug_optimized
%{?_with_debug_optimized:1}%{?!_with_debug_optimized:0}
%define option_without_debug_optimized
%{!?_with_debug_optimized:1}%{?_with_debug_optimized:0}
#
#
# Option: --with-debug
#
# TODO: At the moment --with-debug is not implemented, so this is just a
placeholder.
#
# use --with-debug to build binaries without compiler optimization, with
# debug info (-g) and not to strip them.
# default: don't include debug info and strip the binaries (strip -x)
#
%define option_with_debug %{?_with_debug:1}%{?!_with_debug:0}
%define option_without_debug %{!?_with_debug:1}%{?_with_debug:0}
#
# Option: --with-debug-format-stabs
#
# If --with-debug-optimized or --with-debug was specified,
# then --with-debug-format-stabs turns on the compiler option
# -xdebugformat=stabs
# default: whatever the compiler default debug format is
# if --with-debug-optimized or --with-debug was specified.
#
%define option_with_debug_format_stabs
%{?_with_debug_format_stabs:1}%{?!_with_debug_format_stabs:0}
%define option_without_debug_format_stabs
%{!?_with_debug_format_stabs:1}%{?_with_debug_format_stabs:0}
%if %option_with_debug_format_stabs
%define with_debug_format_stabs 1
%define _C_DEBUG_FORMAT -xdebugformat=stabs
%define _CXX_DEBUG_FORMAT -xdebugformat=stabs
%else
%define with_debug_format_stabs 0
%define _C_DEBUG_FORMAT
%define _CXX_DEBUG_FORMAT
%endif
%if %option_with_debug_optimized
%define with_debug_symbols 1
%define with_compiler_optimized 1
%define _C_DEBUG_OR_STRIP -g %{_C_DEBUG_FORMAT}
%define _CXX_DEBUG_OR_STRIP -g0 %{_CXX_DEBUG_FORMAT}
%define _LD_DEBUG_OR_STRIP -g
%else
%if %option_with_debug
%define with_debug_symbols 1
%define with_compiler_optimized 0
%define _C_DEBUG_OR_STRIP -g %{_C_DEBUG_FORMAT}
%define _CXX_DEBUG_OR_STRIP -g %{_CXX_DEBUG_FORMAT}
%define _LD_DEBUG_OR_STRIP -g
%else
%define with_debug_symbols 0
%define with_compiler_optimized 1
%define _C_DEBUG_OR_STRIP -s %{_C_DEBUG_FORMAT}
%define _CXX_DEBUG_OR_STRIP -s %{_CXX_DEBUG_FORMAT}
%define _LD_DEBUG_OR_STRIP -s
%endif
%endif
%if %with_debug_symbols
%define pkgbuild_postprocess /bin/true
%define _STRIP_IF_NOT_DEBUG
%else
%define _STRIP_IF_NOT_DEBUG -s
%endif
--