◐ Shell
clean mode source ↗

Message 404899 - Python tracker

I'm using a very simple conditional logic in Setup, which is based
on sed, mostly to add platform specific variables:

In Setup:

# @if macosx: TIME_DEFS=
# @if not macosx: TIME_DEFS=-lrt
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c
$(TIME_DEFS) # -lm # time operations and variables

In Makefile:

        # Install the custom Modules/Setup file
        if test "$(MACOSX_PLATFORM)"; then \
                sed     -e 's/# @if macosx: *//' \
                        $(PYRUNDIR)/$(MODULESSETUP) > $(PYTHONDIR)/Modules/Setup; \
        elif test "$(FREEBSD_PLATFORM)"; then \
                sed     -e 's/# @if freebsd: *//' \
                        $(PYRUNDIR)/$(MODULESSETUP) > $(PYTHONDIR)/Modules/Setup; \
        else \
                sed     -e 's/# @if not macosx: *//' \
                        -e 's/# @if not freebsd: *//' \
                        $(PYRUNDIR)/$(MODULESSETUP) > $(PYTHONDIR)/Modules/Setup; \
        fi;

Setup used to be templated as well in the past, but that logic was removed
at some point. Perhaps it's time to reintroduce it.