makefile: Assure that besm6 simulator builds on recent macOS versions

Extend set of paths searched for font files since common fonts have
moved on macOS versions since besm6 simulator support was added.
This commit is contained in:
Mark Pizzolato 2022-09-19 12:19:05 -07:00
parent dc320a84da
commit 060f55d23e

153
makefile
View file

@ -649,12 +649,8 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
endif
ifneq (,$(call find_include,SDL2/SDL))
ifneq (,$(call find_lib,SDL2))
ifneq (,$(findstring Haiku,$(OSTYPE)))
ifneq (,$(shell which sdl2-config))
SDLX_CONFIG = sdl2-config
endif
else
SDLX_CONFIG = $(realpath $(dir $(call find_include,SDL2/SDL))../../bin/sdl2-config)
ifneq (,$(shell which sdl2-config))
SDLX_CONFIG = sdl2-config
endif
ifneq (,$(SDLX_CONFIG))
VIDEO_CCDEFS += -DHAVE_LIBSDL -DUSE_SIM_VIDEO `$(SDLX_CONFIG) --cflags`
@ -670,6 +666,64 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin)
ifeq (Darwin,$(OSTYPE))
VIDEO_CCDEFS += -DSDL_MAIN_AVAILABLE
endif
ifneq (,$(and $(BESM6_BUILD), $(or $(and $(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf)), $(and $(call find_include,SDL/SDL_ttf),$(call find_lib,SDL_ttf)))))
FONTPATH += /usr/share/fonts /Library/Fonts /usr/lib/jvm /System/Library/Frameworks/JavaVM.framework/Versions /System/Library/Fonts C:/Windows/Fonts
FONTPATH := $(dir $(foreach dir,$(strip $(FONTPATH)),$(wildcard $(dir)/.)))
FONTNAME += DejaVuSans.ttf LucidaSansRegular.ttf FreeSans.ttf AppleGothic.ttf tahoma.ttf
$(info font paths are: $(FONTPATH))
$(info font names are: $(FONTNAME))
find_fontfile = $(strip $(firstword $(foreach dir,$(strip $(FONTPATH)),$(wildcard $(dir)/$(1))$(wildcard $(dir)/*/$(1))$(wildcard $(dir)/*/*/$(1))$(wildcard $(dir)/*/*/*/$(1)))))
find_font = $(abspath $(strip $(firstword $(foreach font,$(strip $(FONTNAME)),$(call find_fontfile,$(font))))))
ifneq (,$(call find_font))
FONTFILE=$(call find_font)
else
$(info ***)
$(info *** No font file available, BESM-6 video panel disabled.)
$(info ***)
$(info *** To enable the panel display please specify one of:)
$(info *** a font path with FONTPATH=path)
$(info *** a font name with FONTNAME=fontname.ttf)
$(info *** a font file with FONTFILE=path/fontname.ttf)
$(info ***)
endif
endif
ifeq (,$(and ${VIDEO_LDFLAGS}, ${FONTFILE}, $(BESM6_BUILD)))
$(info *** No SDL ttf support available. BESM-6 video panel disabled.)
$(info ***)
ifeq (Darwin,$(OSTYPE))
ifeq (/opt/local/bin/port,$(shell which port))
$(info *** Info *** Install the MacPorts libSDL2-ttf development package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** # port install libsdl2-ttf-dev)
endif
ifeq (/usr/local/bin/brew,$(shell which brew))
ifeq (/opt/local/bin/port,$(shell which port))
$(info *** Info ***)
$(info *** Info *** OR)
$(info *** Info ***)
endif
$(info *** Info *** Install the HomeBrew sdl2_ttf package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** $$ brew install sdl2_ttf)
endif
else
ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get)))
$(info *** Info *** Install the development components of libSDL2-ttf)
$(info *** Info *** packaged for your Linux operating system distribution:)
$(info *** Info *** $$ sudo apt-get install libsdl2-ttf-dev)
else
$(info *** Info *** Install the development components of libSDL2-ttf packaged by your)
$(info *** Info *** operating system distribution and rebuild your simulator to)
$(info *** Info *** enable this extra functionality.)
endif
endif
else
ifneq (,$(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf))
$(info using libSDL2_ttf: $(call find_lib,SDL2_ttf) $(call find_include,SDL2/SDL_ttf))
$(info ***)
BESM6_PANEL_OPT = -DFONTFILE=${FONTFILE} $(filter-out -DSDL_MAIN_AVAILABLE,${VIDEO_CCDEFS}) ${VIDEO_LDFLAGS} -lSDL2_ttf
endif
endif
endif
endif
endif
@ -1901,92 +1955,7 @@ BESM6 = ${BESM6D}/besm6_cpu.c ${BESM6D}/besm6_sys.c ${BESM6D}/besm6_mmu.c \
${BESM6D}/besm6_tty.c ${BESM6D}/besm6_panel.c ${BESM6D}/besm6_printer.c \
${BESM6D}/besm6_pl.c ${BESM6D}/besm6_mg.c \
${BESM6D}/besm6_punch.c ${BESM6D}/besm6_punchcard.c ${BESM6D}/besm6_vu.c
ifneq (,$(BESM6_BUILD))
BESM6_OPT = -I ${BESM6D} -DUSE_INT64 $(BESM6_PANEL_OPT)
ifneq (,$(and ${SDLX_CONFIG},${VIDEO_LDFLAGS}, $(or $(and $(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf)), $(and $(call find_include,SDL/SDL_ttf),$(call find_lib,SDL_ttf)))))
FONTPATH += /usr/share/fonts /Library/Fonts /usr/lib/jvm /System/Library/Frameworks/JavaVM.framework/Versions C:/Windows/Fonts
FONTPATH := $(dir $(foreach dir,$(strip $(FONTPATH)),$(wildcard $(dir)/.)))
FONTNAME += DejaVuSans.ttf LucidaSansRegular.ttf FreeSans.ttf AppleGothic.ttf tahoma.ttf
#cmake-insert:set(BESM6_FONT)
#cmake-insert:foreach (fdir IN ITEMS
#cmake-insert: "/usr/share/fonts" "/Library/Fonts" "/usr/lib/jvm"
#cmake-insert: "/System/Library/Frameworks/JavaVM.framework/Versions"
#cmake-insert: "$ENV{WINDIR}/Fonts")
#cmake-insert: foreach (font IN ITEMS
#cmake-insert: "DejaVuSans.ttf" "LucidaSansRegular.ttf" "FreeSans.ttf" "AppleGothic.ttf" "tahoma.ttf")
#cmake-insert: if (EXISTS ${fdir})
#cmake-insert: file(GLOB_RECURSE found_font ${fdir}/${font})
#cmake-insert: if (found_font)
#cmake-insert: get_filename_component(fontfile ${found_font} ABSOLUTE)
#cmake-insert: list(APPEND BESM6_FONT ${fontfile})
#cmake-insert: endif ()
#cmake-insert: endif ()
#cmake-insert: endforeach()
#cmake-insert:endforeach()
#cmake-insert:
#cmake-insert:if (NOT BESM6_FONT)
#cmake-insert: message("No font file available, BESM-6 video panel disabled")
#cmake-insert: set(BESM6_PANEL_OPT)
#cmake-insert:endif ()
#cmake-insert:
#cmake-insert:if (BESM6_FONT AND WITH_VIDEO)
#cmake-insert: list(GET BESM6_FONT 0 BESM6_FONT)
#cmake-insert:endif ()
$(info font paths are: $(FONTPATH))
$(info font names are: $(FONTNAME))
find_fontfile = $(strip $(firstword $(foreach dir,$(strip $(FONTPATH)),$(wildcard $(dir)/$(1))$(wildcard $(dir)/*/$(1))$(wildcard $(dir)/*/*/$(1))$(wildcard $(dir)/*/*/*/$(1)))))
find_font = $(abspath $(strip $(firstword $(foreach font,$(strip $(FONTNAME)),$(call find_fontfile,$(font))))))
ifneq (,$(call find_font))
FONTFILE=$(call find_font)
else
$(info ***)
$(info *** No font file available, BESM-6 video panel disabled.)
$(info ***)
$(info *** To enable the panel display please specify one of:)
$(info *** a font path with FONTPATH=path)
$(info *** a font name with FONTNAME=fontname.ttf)
$(info *** a font file with FONTFILE=path/fontname.ttf)
$(info ***)
endif
endif
ifeq (,$(and ${VIDEO_LDFLAGS}, ${FONTFILE}, $(BESM6_BUILD)))
$(info *** No SDL ttf support available. BESM-6 video panel disabled.)
$(info ***)
ifeq (Darwin,$(OSTYPE))
ifeq (/opt/local/bin/port,$(shell which port))
$(info *** Info *** Install the MacPorts libSDL2-ttf development package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** # port install libsdl2-ttf-dev)
endif
ifeq (/usr/local/bin/brew,$(shell which brew))
ifeq (/opt/local/bin/port,$(shell which port))
$(info *** Info ***)
$(info *** Info *** OR)
$(info *** Info ***)
endif
$(info *** Info *** Install the HomeBrew sdl2_ttf package to provide this)
$(info *** Info *** functionality for your OS X system:)
$(info *** Info *** $$ brew install sdl2_ttf)
endif
else
ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get)))
$(info *** Info *** Install the development components of libSDL2-ttf)
$(info *** Info *** packaged for your Linux operating system distribution:)
$(info *** Info *** $$ sudo apt-get install libsdl2-ttf-dev)
else
$(info *** Info *** Install the development components of libSDL2-ttf packaged by your)
$(info *** Info *** operating system distribution and rebuild your simulator to)
$(info *** Info *** enable this extra functionality.)
endif
endif
BESM6_OPT = -I ${BESM6D} -DUSE_INT64
else ifneq (,$(and $(findstring sdl2,${VIDEO_LDFLAGS}),$(call find_include,SDL2/SDL_ttf),$(call find_lib,SDL2_ttf)))
$(info using libSDL2_ttf: $(call find_lib,SDL2_ttf) $(call find_include,SDL2/SDL_ttf))
$(info ***)
BESM6_PANEL_OPT = -DFONTFILE=${FONTFILE} ${VIDEO_CCDEFS} ${VIDEO_LDFLAGS} -lSDL2_ttf
endif
endif
BESM6_OPT = -I ${BESM6D} -DUSE_INT64 $(BESM6_PANEL_OPT)
PDP6D = ${SIMHD}/PDP10
ifneq (,${DISPLAY_OPT})