Skip to content

Commit

Permalink
fix: reorganize dependencies (another attempt to fix tamatebako/tebak…
Browse files Browse the repository at this point in the history
  • Loading branch information
maxirmx committed Jan 17, 2025
1 parent 599510b commit c6fbe0c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 12 deletions.
28 changes: 17 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
# Copyright (c) 2021-2025 [Ribose Inc](https://www.ribose.com).
# All rights reserved.
# This file is a part of tebako
#
Expand Down Expand Up @@ -361,8 +361,10 @@ ExternalProject_Add(${RUBY_PRJ}
DOWNLOAD_NO_PROGRESS true
SOURCE_DIR ${RUBY_SOURCE_DIR}
BUILD_IN_SOURCE true
PATCH_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
CONFIGURE_COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
CONFIGURE_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
# Make it for MacOS otherwise LDFLAGS are invalid
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
--without-gmp \
--disable-dtrace \
--disable-debug-env \
Expand All @@ -379,23 +381,27 @@ ExternalProject_Add(${RUBY_PRJ}
COMMAND ${GNU_BASH} -c "ruby ${EXE}/tebako-packager pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}"
)

add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ} ${LIBDWARFS_WR_PRJ})

if(IS_GNU)
add_dependencies(${RUBY_PRJ} ${PATCHELF_PRJ})
endif(IS_GNU)

# add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ})

if (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has completed"
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)
else (${SETUP_MODE})
if(IS_GNU)
add_dependencies(setup ${PATCHELF_PRJ})
endif(IS_GNU)

else (${SETUP_MODE})
add_custom_target(setup
${CMAKE_COMMAND} -E echo "Tebako setup has been verified"
DEPENDS ${DWARFS_WR_PRJ} ${RUBY_PRJ}
)
if(IS_GNU)
add_dependencies(setup ${PATCHELF_PRJ})
endif(IS_GNU)



set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand All @@ -406,7 +412,7 @@ else (${SETUP_MODE})

add_custom_target(packaged_filesystem
COMMAND ruby ${DEPS_BIN_DIR}/deploy.rb
DEPENDS ${RUBY_PRJ}
DEPENDS setup
BYPRODUCTS ${DATA_BIN_FILE}
)

Expand Down
4 changes: 4 additions & 0 deletions lib/tebako/options_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ def deps_bin_dir
@deps_bin_dir ||= File.join(deps, "bin")
end

def deps_lib_dir
@deps_lib_dir ||= File.join(deps, "lib")
end

def fs_current
fs_current = Dir.pwd
if RUBY_PLATFORM =~ /msys|mingw|cygwin/
Expand Down
2 changes: 1 addition & 1 deletion lib/tebako/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@
# POSSIBILITY OF SUCH DAMAGE.

module Tebako
VERSION = "0.12.2"
VERSION = "0.12.3"
end
30 changes: 30 additions & 0 deletions spec/options_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,36 @@
end
end
end

describe "#deps_lib_dir" do
let(:options_manager) { Tebako::OptionsManager.new({}) }
it "returns the correct lib directory path" do
allow(options_manager).to receive(:prefix).and_return("/fake/prefix")
expect(options_manager.deps_lib_dir).to eq("/fake/prefix/deps/lib")
end
end

describe "#press_announce_ref" do
let(:options_manager) { Tebako::OptionsManager.new({}) }
it "returns the announce reference string" do
allow(options_manager).to receive(:ref).and_return("ref")
expect(options_manager.press_announce_ref(true)).to eq(" referencing runtime at 'ref'")
expect(options_manager.press_announce_ref(false)).to eq("")
end
end

describe "#ref" do
it "returns 'tebako-runtime' if no ref is specified" do
options_manager = described_class.new({})
expect(options_manager.ref).to eq("tebako-runtime")
end

it "returns the given ref, converting backslashes to forward slashes" do
options = { "ref" => "some\\path\\ref" }
options_manager = described_class.new(options)
expect(options_manager.ref).to eq("some/path/ref")
end
end
end

# rubocop:enable Metrics/BlockLength

0 comments on commit c6fbe0c

Please sign in to comment.