Skip to content

Commit

Permalink
Optimize out INCBIN setup
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Mar 12, 2024
1 parent 8b1f285 commit 380b058
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/alpine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VER: 04
CACHE_VER: 06
TZ: "Etc/UTC"
VERBOSE: no

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gem-test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VER: 02
CACHE_VER: 06
DEBIAN_FRONTEND: "noninteractive"
TZ: "Etc/UTC"
# show cmake output
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VER: 03
CACHE_VER: 06
VERBOSE: no

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ concurrency:
cancel-in-progress: true

env:
CACHE_VER: 05
CACHE_VER: 06
DEBIAN_FRONTEND: "noninteractive"
TZ: "Etc/UTC"
# show cmake output (yes/no)
Expand Down
101 changes: 67 additions & 34 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,21 @@ if(IS_MSYS)
include(${CMAKE_SOURCE_DIR}/tools/cmake-scripts/setup-openssl.cmake)
endif(IS_MSYS)

def_ext_prj_g(INCBIN "348e36b")
def_ext_prj_g(DWARFS_WR "v0.5.0.rc9")
#def_ext_prj_g(INCBIN "348e36b")


if(IS_MSYS)
def_ext_prj_t(LIBDWARFS_WR "0.5.0.rc9" "085eb1aeed100c5662ff9afff386c2f0cbe2065ddefe5adcd45a755b547532b0")

string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1;\\2;\\3" LIBDWARFS_WR_VER_COMPONENTS ${LIBDWARFS_WR_VER})

list(GET LIBDWARFS_WR_VER_COMPONENTS 0 LIBDWARFS_WR_VER_MAJOR)
list(GET LIBDWARFS_WR_VER_COMPONENTS 1 LIBDWARFS_WR_VER_MINOR)
list(GET LIBDWARFS_WR_VER_COMPONENTS 2 LIBDWARFS_WR_VER_PATCH)
set (LIBDWARFS_WR_VER_M ${LIBDWARFS_WR_VER_MAJOR}.${LIBDWARFS_WR_VER_MINOR}.${LIBDWARFS_WR_VER_PATCH})
else(IS_MSYS)
def_ext_prj_g(DWARFS_WR "v0.5.0.rc9")
endif(IS_MSYS)

find_library(_LIBNCURSES "libncurses.a")
if(${_LIBNCURSES} STREQUAL "_LIBNCURSES-NOTFOUND")
Expand All @@ -264,8 +277,12 @@ else()
message(STATUS "ncurses: ${_LIBNCURSES}")
endif(WITH_NCURSES_BUILD)

message(STATUS "incbin: @${INCBIN_TAG} at ${INCBIN_SOURCE_DIR}")
message(STATUS "dwarfs with tebako wrapper: @${DWARFS_WR_TAG} at ${DWARFS_WR_SOURCE_DIR}")
#message(STATUS "incbin: @${INCBIN_TAG} at ${INCBIN_SOURCE_DIR}")
if(IS_MSYS)
message(STATUS "dwarfs with tebako wrapper: deploying v${{DWARFS_WR_VER} to ${{DWARFS_WR_SOURCE_DIR}")
else(IS_MSYS)
message(STATUS "dwarfs with tebako wrapper: @${DWARFS_WR_TAG} at ${DWARFS_WR_SOURCE_DIR}")
endif(IS_MSYS)

# ...................................................................
# Filesystem locations
Expand Down Expand Up @@ -311,16 +328,16 @@ message(STATUS "Not building Ruby extensions: ${RUBY_WITHOUT_EXT}")
# ...................................................................
# incbin

ExternalProject_Add(${INCBIN_PRJ}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/graphitemaster/incbin.git
GIT_TAG ${INCBIN_TAG}
BUILD_IN_SOURCE true
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INCLUDE_DIR}/incbin
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCBIN_SOURCE_DIR}/incbin.h ${DEPS_INCLUDE_DIR}/incbin
)
#ExternalProject_Add(${INCBIN_PRJ}
# PREFIX ${DEPS}
# GIT_REPOSITORY https://github.com/graphitemaster/incbin.git
# GIT_TAG ${INCBIN_TAG}
# BUILD_IN_SOURCE true
# CONFIGURE_COMMAND ""
# BUILD_COMMAND ""
# INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_INCLUDE_DIR}/incbin
# COMMAND ${CMAKE_COMMAND} -E copy_if_different ${INCBIN_SOURCE_DIR}/incbin.h ${DEPS_INCLUDE_DIR}/incbin
#)

# ...................................................................
# DwarFS with tebako wrapper
Expand All @@ -341,25 +358,41 @@ set(__LIBXXHASH "${DEPS_LIB_DIR}/libxxhash.a")
set(__LIBZSTD "${DEPS_LIB_DIR}/libzstd.a")
set(__LIBARCHIVE "${DEPS_LIB_DIR}/libarchive.a")

ExternalProject_Add(${DWARFS_WR_PRJ}
if(IS_MSYS)
ExternalProject_Add(${LIBDWARFS_WR_PRJ}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/tamatebako/libdwarfs.git
GIT_TAG ${DWARFS_WR_TAG}
SOURCE_DIR ${DWARFS_WR_SOURCE_DIR}
BINARY_DIR ${DWARFS_WR_BINARY_DIR}
URL https://github.com/tamatebako/libdwarfs/releases/download/v${LIBDWARFS_WR_VER}/libdwarfs-wr-${LIBDWARFS_WR_VER_M}-mingw-ucrt64.7z
URL_HASH SHA256=${LIBDWARFS_WR_HASH}
DOWNLOAD_NO_PROGRESS true
SOURCE_DIR ${LIBDWARFS_WR_SOURCE_DIR}
UPDATE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} --build ${DWARFS_WR_BINARY_DIR} --parallel ${NCORES}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DWITH_TESTS:BOOL=OFF
-DWITH_ASAN:BOOL=OFF
-DWITH_COVERAGE:BOOL=OFF
-DTEBAKO_BUILD_SCOPE=MKD
-DRB_W32=${RB_W32}
BUILD_BYPRODUCTS ${__LIBDWARFS_WR}
${__LIBDWARFS} ${__LIBFSST} ${__LIBFOLLY} ${__LIBT_METADATA}
${__LIBT_LIGHT} ${__LIBXXHASH} ${__LIBZSTD} ${__LIBARCHIVE}
)
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBDWARFS_WR_SOURCE_DIR} ${DEPS}
TEST_COMMAND ""
)
else(IS_MSYS)
ExternalProject_Add(${DWARFS_WR_PRJ}
PREFIX ${DEPS}
GIT_REPOSITORY https://github.com/tamatebako/libdwarfs.git
GIT_TAG ${DWARFS_WR_TAG}
SOURCE_DIR ${DWARFS_WR_SOURCE_DIR}
BINARY_DIR ${DWARFS_WR_BINARY_DIR}
UPDATE_COMMAND ""
BUILD_COMMAND ${CMAKE_COMMAND} --build ${DWARFS_WR_BINARY_DIR} --parallel ${NCORES}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${DEPS}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DWITH_TESTS:BOOL=OFF
-DWITH_ASAN:BOOL=OFF
-DWITH_COVERAGE:BOOL=OFF
-DTEBAKO_BUILD_SCOPE=MKD
-DRB_W32=${RB_W32}
BUILD_BYPRODUCTS ${__LIBDWARFS_WR}
${__LIBDWARFS} ${__LIBFSST} ${__LIBFOLLY} ${__LIBT_METADATA}
${__LIBT_LIGHT} ${__LIBXXHASH} ${__LIBZSTD} ${__LIBARCHIVE}
)
endif(IS_MSYS)

if(WITH_NCURSES_BUILD)
ExternalProject_Add(${NCURSES_PRJ}
Expand Down Expand Up @@ -449,12 +482,12 @@ endif(WITH_NCURSES_BUILD)
if (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has completed"
DEPENDS ${DWARFS_WR_PRJ} ${INCBIN_PRJ} ${RUBY_PRJ}
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)
else (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has been verified"
DEPENDS ${DWARFS_WR_PRJ} ${INCBIN_PRJ} ${RUBY_PRJ}
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)

file(GLOB GEMSPECS LIST_DIRECTORIES false ${FS_ROOT}/*.gemspec)
Expand Down Expand Up @@ -633,7 +666,7 @@ else (${SETUP_MODE})
${DEPS_INCLUDE_DIR}/tebako/tebako-version.h
)

add_dependencies(tebako-fs ${INCBIN_PRJ} packaged_filesystem)
add_dependencies(tebako-fs packaged_filesystem)

if (${RUBY_VER} VERSION_LESS "3.0.0")
add_custom_target(patched_ruby
Expand Down

0 comments on commit 380b058

Please sign in to comment.