mirror of
				https://gitlab.alpinelinux.org/alpine/aports.git
				synced 2025-10-31 08:21:49 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			316 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			316 lines
		
	
	
		
			8.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| --- a/CMakeLists.txt
 | |
| +++ b/CMakeLists.txt
 | |
| @@ -164,51 +164,15 @@
 | |
|  # LUA
 | |
|  ################################
 | |
|  
 | |
| -set(LUA_DIR ${THIRDPARTY_DIR}/lua)
 | |
| -set(LUA_SRC
 | |
| -    ${LUA_DIR}/lapi.c
 | |
| -    ${LUA_DIR}/lcode.c
 | |
| -    ${LUA_DIR}/lctype.c
 | |
| -    ${LUA_DIR}/ldebug.c
 | |
| -    ${LUA_DIR}/ldo.c
 | |
| -    ${LUA_DIR}/ldump.c
 | |
| -    ${LUA_DIR}/lfunc.c
 | |
| -    ${LUA_DIR}/lgc.c
 | |
| -    ${LUA_DIR}/llex.c
 | |
| -    ${LUA_DIR}/lmem.c
 | |
| -    ${LUA_DIR}/lobject.c
 | |
| -    ${LUA_DIR}/lopcodes.c
 | |
| -    ${LUA_DIR}/lparser.c
 | |
| -    ${LUA_DIR}/lstate.c
 | |
| -    ${LUA_DIR}/lstring.c
 | |
| -    ${LUA_DIR}/ltable.c
 | |
| -    ${LUA_DIR}/ltm.c
 | |
| -    ${LUA_DIR}/lundump.c
 | |
| -    ${LUA_DIR}/lvm.c
 | |
| -    ${LUA_DIR}/lzio.c
 | |
| -    ${LUA_DIR}/lauxlib.c
 | |
| -    ${LUA_DIR}/lbaselib.c
 | |
| -    ${LUA_DIR}/lcorolib.c
 | |
| -    ${LUA_DIR}/ldblib.c
 | |
| -    ${LUA_DIR}/liolib.c
 | |
| -    ${LUA_DIR}/lmathlib.c
 | |
| -    ${LUA_DIR}/loslib.c
 | |
| -    ${LUA_DIR}/lstrlib.c
 | |
| -    ${LUA_DIR}/ltablib.c
 | |
| -    ${LUA_DIR}/lutf8lib.c
 | |
| -    ${LUA_DIR}/loadlib.c
 | |
| -    ${LUA_DIR}/linit.c
 | |
| -)
 | |
| +# [patch] Use system lua
 | |
| +find_package(PkgConfig)
 | |
| +pkg_check_modules(Lua REQUIRED lua5.3 IMPORTED_TARGET GLOBAL)
 | |
| +add_library(Lua::Lua ALIAS PkgConfig::Lua)
 | |
| +set(LUA_INCLUDE_DIR "/usr/include/lua5.3")
 | |
| +set(LUA_LIBRARIES "/usr/lib/lua5.3")
 | |
| +include_directories(${LUA_INCLUDE_DIR})
 | |
| +link_directories(${LUA_LIBRARIES})
 | |
|  
 | |
| -add_library(lua STATIC ${LUA_SRC})
 | |
| -
 | |
| -target_compile_definitions(lua PRIVATE LUA_COMPAT_5_2)
 | |
| -target_include_directories(lua INTERFACE ${THIRDPARTY_DIR}/lua)
 | |
| -
 | |
| -if(N3DS)
 | |
| -    target_compile_definitions(lua PUBLIC LUA_32BITS)
 | |
| -endif()
 | |
| -
 | |
|  ################################
 | |
|  # LPEG
 | |
|  ################################
 | |
| @@ -421,22 +403,10 @@
 | |
|  # GIFLIB
 | |
|  ################################
 | |
|  
 | |
| -set(GIFLIB_DIR ${THIRDPARTY_DIR}/giflib)
 | |
| -set(GIFLIB_SRC
 | |
| -    ${GIFLIB_DIR}/dgif_lib.c
 | |
| -    ${GIFLIB_DIR}/egif_lib.c
 | |
| -    ${GIFLIB_DIR}/gif_err.c
 | |
| -    ${GIFLIB_DIR}/gif_font.c
 | |
| -    ${GIFLIB_DIR}/gif_hash.c
 | |
| -    ${GIFLIB_DIR}/gifalloc.c
 | |
| -    ${GIFLIB_DIR}/openbsd-reallocarray.c
 | |
| -)
 | |
| -add_library(giflib STATIC ${GIFLIB_SRC})
 | |
| -target_include_directories(giflib
 | |
| -    PRIVATE ${GIFLIB_DIR}
 | |
| -    INTERFACE 
 | |
| -        ${THIRDPARTY_DIR}/giflib 
 | |
| -        ${THIRDPARTY_DIR}/msf_gif)
 | |
| +# [patch] Use system giflib but include vendor msf_gif encoder
 | |
| +find_package(GIF)
 | |
| +set(MSF_GIF_INCLUDE_DIR ${THIRDPARTY_DIR}/msf_gif)
 | |
| +include_directories(${MSF_GIF_INCLUDE_DIR})
 | |
|  
 | |
|  ################################
 | |
|  # Blipbuf
 | |
| @@ -484,39 +451,10 @@
 | |
|  option(BUILD_WITH_JANET "Janet Enabled" ${BUILD_WITH_JANET_DEFAULT})
 | |
|  message("BUILD_WITH_JANET: ${BUILD_WITH_JANET}")
 | |
|  
 | |
| +# [patch] Use system janet
 | |
|  if(BUILD_WITH_JANET)
 | |
| -
 | |
| -    if(MINGW)
 | |
| -        find_program(GIT git)
 | |
| -        get_filename_component(GIT_DIR ${GIT} DIRECTORY)
 | |
| -        find_program(GITBASH bash PATHS "${GIT_DIR}/../bin" NO_DEFAULT_PATH)
 | |
| -
 | |
| -        if(NOT GITBASH)
 | |
| -            message(FATAL_ERROR "Git Bash not found!")
 | |
| -        endif()
 | |
| -
 | |
| -        add_custom_command(
 | |
| -            OUTPUT ${THIRDPARTY_DIR}/janet/build/c/janet.c
 | |
| -            COMMAND ${GITBASH} -c "CC=gcc mingw32-make build/c/janet.c"
 | |
| -            WORKING_DIRECTORY ${THIRDPARTY_DIR}/janet/
 | |
| -        )
 | |
| -    elseif(WIN32)
 | |
| -        add_custom_command(
 | |
| -            OUTPUT ${THIRDPARTY_DIR}/janet/build/c/janet.c
 | |
| -            COMMAND ./build_win.bat
 | |
| -            WORKING_DIRECTORY ${THIRDPARTY_DIR}/janet/
 | |
| -        )
 | |
| -    else()
 | |
| -        add_custom_command(
 | |
| -            OUTPUT ${THIRDPARTY_DIR}/janet/build/c/janet.c
 | |
| -            COMMAND make build/c/janet.c
 | |
| -            WORKING_DIRECTORY ${THIRDPARTY_DIR}/janet/
 | |
| -        )
 | |
| -    endif()
 | |
| -
 | |
| -    add_library(janet ${THIRDPARTY_DIR}/janet/build/c/janet.c)
 | |
| -    target_include_directories(janet PUBLIC ${THIRDPARTY_DIR}/janet/src/include)
 | |
| -    target_include_directories(janet PUBLIC ${CMAKE_SOURCE_DIR}/build/janet/)
 | |
| +  set(JANET_INCLUDE_DIR "/usr/include/janet")
 | |
| +  include_directories(${JANET_INCLUDE_DIR})
 | |
|  endif()
 | |
|  
 | |
|  ################################
 | |
| @@ -580,7 +518,8 @@
 | |
|          scheme
 | |
|          quickjs
 | |
|          blipbuf
 | |
| -        zlib
 | |
| +        # [patch] Fix zlib name
 | |
| +        z
 | |
|      )
 | |
|  
 | |
|      if(BUILD_WITH_MRUBY)
 | |
| @@ -593,7 +532,8 @@
 | |
|  
 | |
|      if(${BUILD_DEPRECATED})
 | |
|          target_compile_definitions(tic80core${SCRIPT} PRIVATE BUILD_DEPRECATED)
 | |
| -        target_link_libraries(tic80core${SCRIPT} giflib)
 | |
| +        # [patch] Fix giflib name
 | |
| +        target_link_libraries(tic80core${SCRIPT} gif)
 | |
|      endif()
 | |
|  
 | |
|      if(LINUX)
 | |
| @@ -639,21 +579,12 @@
 | |
|  ################################
 | |
|  # SDL2
 | |
|  ################################
 | |
| -if(BUILD_SDL AND NOT EMSCRIPTEN AND NOT RPI)
 | |
|  
 | |
| -    if(WIN32)
 | |
| -        set(HAVE_LIBC TRUE)
 | |
| -    endif()
 | |
| -
 | |
| -    if(ANDROID)
 | |
| -        include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
 | |
| -        set(SDL_STATIC_PIC ON CACHE BOOL "" FORCE)
 | |
| -    endif()
 | |
| -
 | |
| -    set(SDL_SHARED OFF CACHE BOOL "" FORCE)
 | |
| -
 | |
| -    add_subdirectory(${THIRDPARTY_DIR}/sdl2)
 | |
| -
 | |
| +# [patch] Use system sdl2
 | |
| +if (BUILD_SDL)
 | |
| +  find_package(SDL2)
 | |
| +  set(SDL2_INCLUDE_DIR "/usr/include/SDL2")
 | |
| +  include_directories(${SDL2_INCLUDE_DIR})
 | |
|  endif()
 | |
|  
 | |
|  ################################
 | |
| @@ -679,7 +610,8 @@
 | |
|          target_link_options(player-sdl PRIVATE -static)
 | |
|      endif()
 | |
|  
 | |
| -    target_link_libraries(player-sdl tic80core SDL2-static SDL2main)
 | |
| +    # [patch] Fix sdl2 name
 | |
| +    target_link_libraries(player-sdl tic80core SDL2 SDL2main)
 | |
|  endif()
 | |
|  
 | |
|  ################################
 | |
| @@ -820,34 +752,9 @@
 | |
|  # ZLIB
 | |
|  ################################
 | |
|  
 | |
| -if (NOT N3DS)
 | |
| +# [patch] Use system zlib
 | |
| +find_package(ZLIB)
 | |
|  
 | |
| -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)
 | |
| -set_target_properties( zlib PROPERTIES IMPORTED_LOCATION ${DEVKITPRO}/portlibs/3ds/lib/libz.a )
 | |
| -target_include_directories(zlib INTERFACE ${DEVKITPRO}/portlibs/3ds/include)
 | |
| -
 | |
| -endif ()
 | |
| -
 | |
|  ################################
 | |
|  # ZIP
 | |
|  ################################
 | |
| @@ -876,7 +783,8 @@
 | |
|      target_link_libraries(wasmp2cart tic80core)
 | |
|  
 | |
|      add_executable(bin2txt ${TOOLS_DIR}/bin2txt.c)
 | |
| -    target_link_libraries(bin2txt zlib)
 | |
| +    # [patch] Fix zlib name
 | |
| +    target_link_libraries(bin2txt z)
 | |
|  
 | |
|      add_executable(xplode
 | |
|          ${TOOLS_DIR}/xplode.c
 | |
| @@ -993,36 +901,9 @@
 | |
|  # 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
 | |
| -)
 | |
| +# [patch] Use system libpng
 | |
| +find_package(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
 | |
|  ################################
 | |
| @@ -1069,7 +950,8 @@
 | |
|  
 | |
|  target_include_directories(tic80studio PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
 | |
|  
 | |
| -target_link_libraries(tic80studio tic80core zip wave_writer argparse giflib png)
 | |
| +# [patch] Fix giflib name
 | |
| +target_link_libraries(tic80studio tic80core zip wave_writer argparse gif png)
 | |
|  
 | |
|  if(USE_NAETT)
 | |
|      target_compile_definitions(tic80studio PRIVATE USE_NAETT)
 | |
| @@ -1155,7 +1037,8 @@
 | |
|  endif()
 | |
|  
 | |
|  if(NOT EMSCRIPTEN)
 | |
| -    target_link_libraries(sdlgpu SDL2-static)
 | |
| +    # [patch] Fix sdl2 name
 | |
| +    target_link_libraries(sdlgpu SDL2)
 | |
|  endif()
 | |
|  
 | |
|  endif()
 | |
| @@ -1228,7 +1111,8 @@
 | |
|          elseif(RPI)
 | |
|              target_link_libraries(tic80 libSDL2.a bcm_host)
 | |
|          else()
 | |
| -            target_link_libraries(tic80 SDL2-static)
 | |
| +            # [patch] Fix sdl2 name
 | |
| +            target_link_libraries(tic80 SDL2)
 | |
|          endif()
 | |
|      endif()
 | |
|  
 | |
| @@ -1377,7 +1261,8 @@
 | |
|              elseif(RPI)
 | |
|                  target_link_libraries(tic80${SCRIPT} libSDL2.a bcm_host pthread dl)
 | |
|              else()
 | |
| -                target_link_libraries(tic80${SCRIPT} SDL2-static)
 | |
| +                # [patch] Fix sdl2 name
 | |
| +                target_link_libraries(tic80${SCRIPT} SDL2)
 | |
|              endif()
 | |
|          endif()
 | |
|  
 |