$OpenBSD: patch-source_Makefile,v 1.4 2017/05/27 16:41:41 espie Exp $
Index: source/Makefile
--- source/Makefile.orig
+++ source/Makefile
@@ -215,9 +215,6 @@ ifdef msys
 		BUILD_LIBPNG = YesPlease
 		COPY_FONTS = yes
 	endif
-	ifeq ($(shell gcc -v -static -static-libstdc++ 2>&1 | grep 'unrecognized option'),)
-		EXTRA_LIBS += -static -static-libgcc -static-libstdc++
-	endif
 endif
 ifeq ($(uname_S),Darwin)
 	STRIP := strip -x
@@ -325,11 +322,8 @@ endif
 #
 ifndef NO_APPLE_GCC
 ifeq ($(uname_S),Darwin)
-ifneq ($(shell gcc -v 2>&1 | grep Apple),)
-APPLE_GCC = YesPlease
 endif
 endif
-endif
 
 
 ifdef WIN32
@@ -511,15 +505,7 @@ ifneq ($(GCC_VER),)
 GCC_VER_SUFFIX:=-$(GCC_VER)
 endif
 
-# Attempt to use a full compiler name, to make
-# distcc builds work nicely.
-LMACH := $(shell gcc -dumpmachine)-
-ifeq ($(LMACH),-)
 LMACH :=
-endif
-ifeq ($(shell which $(LMACH)gcc$(GCC_VER_SUFFIX) > /dev/null 2> /dev/null && echo "Yes"),)
-LMACH :=
-endif
 
 ifneq ($(FORCE_CC),)
 GCC := $(FORCE_CC)
@@ -639,9 +625,9 @@ ifndef BUILD_LUA
       BUILD_LUA = yes
     endif
   else
-    ifneq ($(shell $(PKGCONFIG) lua5.1 --exists || echo no),)
-      ifneq ($(shell $(PKGCONFIG) lua-5.1 --exists || echo no),)
-        ifneq ($(shell $(PKGCONFIG) lua --exists || echo no),)
+    ifneq ($(shell $(PKGCONFIG) lua --exists || echo no),)
+      ifneq ($(shell $(PKGCONFIG) lua${MODLUA_DEP_VERSION} --exists || echo no),)
+        ifneq ($(shell $(PKGCONFIG) lua${MODLUA_DEP_VERSION} --exists || echo no),)
           BUILD_LUA = yes
         else
           ifeq ($(shell $(PKGCONFIG) lua --modversion | head -c 3),5.1)
@@ -651,16 +637,16 @@ ifndef BUILD_LUA
           endif
         endif
       else
-        LUA_PACKAGE = lua-5.1
+        LUA_PACKAGE = lua${MODLUA_DEP_VERSION}
       endif
     else
-      LUA_PACKAGE = lua5.1
+      LUA_PACKAGE = lua${MODLUA_DEP_VERSION}
     endif
   endif
 endif
 ifndef BUILD_LUA
   ifndef LUA_PACKAGE
-    LUA_PACKAGE = lua5.1
+    LUA_PACKAGE = lua${MODLUA_DEP_VERSION}
   endif
   INCLUDES_L += $(shell $(PKGCONFIG) $(LUA_PACKAGE) --cflags-only-I | sed -e 's/-I/-isystem /')
   CFLAGS_L  += $(shell $(PKGCONFIG) $(LUA_PACKAGE) --cflags-only-other)
@@ -673,7 +659,7 @@ endif
 
 ifndef BUILD_SQLITE
   ifeq ($(shell grep -q sqlite3_prepare $(SQLITE_INCLUDE_DIR)/sqlite3.h 2>/dev/null && echo yes),yes)
-    # INCLUDES_L += -isystem $(SQLITE_INCLUDE_DIR)
+    INCLUDES_L += -isystem $(SQLITE_INCLUDE_DIR)
     LIBS += $(SQLITE_LIB)
     ifneq ($(shell grep -q sqlite3_prepare_v2 $(SQLITE_INCLUDE_DIR)/sqlite3.h 2>/dev/null && echo yes),yes)
       DEFINES_L += -DANCIENT_SQLITE
@@ -1122,51 +1108,6 @@ ifndef NO_OPTIMIZE
     endif
   endif
 endif
-endif
-
-ifdef BUILD_PCRE
-CONTRIBS += pcre
-CONTRIB_LIBS += $(LIBPCRE)
-endif
-ifdef BUILD_FREETYPE
-CONTRIBS += freetype
-CONTRIB_LIBS += $(LIBFREETYPE)
-endif
-ifdef BUILD_LIBPNG
-CONTRIBS += libpng
-CONTRIB_LIBS := $(LIBPNG) $(CONTRIB_LIBS)
-endif
-ifdef BUILD_SDL2
-CONTRIBS += sdl2
-CONTRIB_LIBS := $(LIBSDL2) $(CONTRIB_LIBS)
-ifeq ($(uname_S),Linux)
-LIBS += -ldl -lrt
-endif
-endif
-ifdef BUILD_SDL2IMAGE
-CONTRIBS += sdl2-image
-CONTRIB_LIBS := $(LIBSDL2IMAGE) $(CONTRIB_LIBS)
-endif
-ifdef BUILD_SDL2MIXER
-CONTRIBS += sdl2-mixer
-CONTRIB_LIBS := $(LIBSDL2MIXER) $(CONTRIB_LIBS)
-endif
-ifdef BUILD_ZLIB
-CONTRIBS += zlib
-CONTRIB_LIBS += $(LIBZ)
-endif
-ifdef BUILD_LUA
-ifdef USE_LUAJIT
-CONTRIBS += luajit/src
-CFOTHER_L += -DUSE_LUAJIT
-else
-CONTRIBS += lua/src
-endif
-CONTRIB_LIBS += $(LIBLUA)
-endif
-ifdef BUILD_SQLITE
-CONTRIBS += sqlite
-CONTRIB_LIBS += $(LIBSQLITE)
 endif
 
 EXTRA_OBJECTS += version.o
