$OpenBSD$

Don't do git stuff.
Use SDL2 and curl from ports.

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -10,39 +10,6 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     set(VERSION_BUILD ".dbg" )
 endif()
 
-find_package(Git)
-if(Git_FOUND)
-    execute_process(
-        COMMAND ${GIT_EXECUTABLE} status
-        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-        ERROR_VARIABLE RESULT_STRING
-        OUTPUT_STRIP_TRAILING_WHITESPACE
-    )
-
-    string(LENGTH "${RESULT_STRING}" LENGTH_RESULT_STRING)
-
-    if(${LENGTH_RESULT_STRING} EQUAL 0)
-
-        execute_process(
-            COMMAND ${GIT_EXECUTABLE} log -1 --format=%H
-            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-            OUTPUT_VARIABLE GIT_COMMIT_HASH
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-        string(SUBSTRING ${GIT_COMMIT_HASH} 0 7 GIT_COMMIT_HASH)
-        set(VERSION_HASH ${GIT_COMMIT_HASH} )
-
-        execute_process(
-            COMMAND ${GIT_EXECUTABLE} rev-list HEAD --count
-            WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-            OUTPUT_VARIABLE VERSION_REVISION
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
-
-    endif()
-endif()
-
 project(TIC-80 VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION} LANGUAGES C CXX)
 message("Building for target : ${CMAKE_SYSTEM_NAME}")
 
@@ -326,7 +293,7 @@ macro(MACRO_CORE SCRIPT DEFINE BUILD_DEPRECATED)
         squirrel 
         duktape 
         blipbuf 
-        zlib)
+        z)
 
     if(${BUILD_DEPRECATED})
         target_compile_definitions(tic80core${SCRIPT} PRIVATE DEPRECATED_CHUNKS)
@@ -368,9 +335,6 @@ if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
     endif()
     
     set(SDL_SHARED OFF CACHE BOOL "" FORCE)
-
-    add_subdirectory(${THIRDPARTY_DIR}/sdl2)
-
 endif()
 
 ################################
@@ -391,7 +355,7 @@ if(BUILD_SDL AND BUILD_PLAYER AND NOT RPI)
         target_link_options(player-sdl PRIVATE -static)
     endif()
 
-    target_link_libraries(player-sdl tic80core SDL2-static SDL2main)
+    target_link_libraries(player-sdl tic80core SDL2 SDL2main)
 endif()
 
 ################################
@@ -518,24 +482,6 @@ endif()
 
 if (NOT N3DS)
 
-set(ZLIB_DIR ${THIRDPARTY_DIR}/zlib)
-set(ZLIB_SRC 
-    ${ZLIB_DIR}/adler32.c
-    ${ZLIB_DIR}/compress.c
-    ${ZLIB_DIR}/crc32.c
-    ${ZLIB_DIR}/deflate.c
-    ${ZLIB_DIR}/inflate.c
-    ${ZLIB_DIR}/infback.c
-    ${ZLIB_DIR}/inftrees.c
-    ${ZLIB_DIR}/inffast.c
-    ${ZLIB_DIR}/trees.c
-    ${ZLIB_DIR}/uncompr.c
-    ${ZLIB_DIR}/zutil.c
-)
-
-add_library(zlib STATIC ${ZLIB_SRC})
-target_include_directories(zlib INTERFACE ${THIRDPARTY_DIR}/zlib)
-
 else ()
 
 add_library(zlib STATIC IMPORTED)
@@ -568,7 +514,7 @@ if(BUILD_DEMO_CARTS)
     target_link_libraries(prj2cart tic80core)
 
     add_executable(bin2txt ${TOOLS_DIR}/bin2txt.c)
-    target_link_libraries(bin2txt zlib)
+    target_link_libraries(bin2txt z)
 
     add_executable(xplode 
         ${TOOLS_DIR}/xplode.c 
@@ -655,9 +601,6 @@ if (USE_CURL)
     if(RPI)
         set(CURL_ZLIB OFF CACHE BOOL "" )
     endif()
-
-    add_subdirectory(${THIRDPARTY_DIR}/curl)
-
 endif()
 
 ################################
@@ -681,36 +624,8 @@ endif()
 # PNG
 ################################
 
-set(LIBPNG_DIR ${THIRDPARTY_DIR}/libpng)
-set(LIBPNG_SRC 
-    ${LIBPNG_DIR}/png.c
-    ${LIBPNG_DIR}/pngerror.c
-    ${LIBPNG_DIR}/pngget.c
-    ${LIBPNG_DIR}/pngmem.c
-    ${LIBPNG_DIR}/pngpread.c
-    ${LIBPNG_DIR}/pngread.c
-    ${LIBPNG_DIR}/pngrio.c
-    ${LIBPNG_DIR}/pngrtran.c
-    ${LIBPNG_DIR}/pngrutil.c
-    ${LIBPNG_DIR}/pngset.c
-    ${LIBPNG_DIR}/pngtrans.c
-    ${LIBPNG_DIR}/pngwio.c
-    ${LIBPNG_DIR}/pngwrite.c
-    ${LIBPNG_DIR}/pngwtran.c
-    ${LIBPNG_DIR}/pngwutil.c
-)
+target_link_libraries(tic80core${SCRIPT} png)
 
-configure_file(${LIBPNG_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
-
-add_library(png STATIC ${LIBPNG_SRC})
-
-target_compile_definitions(png PRIVATE PNG_ARM_NEON_OPT=0)
-
-target_include_directories(png 
-    PUBLIC ${CMAKE_CURRENT_BINARY_DIR} 
-    PRIVATE ${THIRDPARTY_DIR}/zlib
-    INTERFACE ${THIRDPARTY_DIR}/libpng)
-
 ################################
 # TIC-80 studio
 ################################
@@ -759,7 +674,7 @@ target_include_directories(tic80studio PUBLIC ${CMAKE_
 target_link_libraries(tic80studio tic80core zip wave_writer argparse giflib png)
 
 if(USE_CURL)
-    target_link_libraries(tic80studio libcurl)
+    target_link_libraries(tic80studio curl)
 endif()
 
 if(USE_LIBUV)
@@ -846,7 +761,7 @@ if(ANDROID)
 endif()
 
 if(NOT EMSCRIPTEN)
-    target_link_libraries(sdlgpu SDL2-static)
+    target_link_libraries(sdlgpu SDL2)
 endif()
 
 endif()
@@ -914,7 +829,7 @@ if(BUILD_SDL)
         elseif(RPI)
             target_link_libraries(tic80 libSDL2.a bcm_host)
         else()
-            target_link_libraries(tic80 SDL2-static)
+            target_link_libraries(tic80 SDL2)
         endif()
     endif()
 
@@ -1058,7 +973,7 @@ if(BUILD_STUB)
             elseif(RPI)
                 target_link_libraries(tic80${SCRIPT} libSDL2.a bcm_host pthread dl)
             else()
-                target_link_libraries(tic80${SCRIPT} SDL2-static)
+                target_link_libraries(tic80${SCRIPT} SDL2)
             endif()
         endif()
 
