Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/platforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"linux_x86_64": [
{
"platform": "x86_64-linux",
"os": "ubuntu-latest",
"os": "ubuntu-22.04",
"ruby": "3.4",
"description": "Linux x86_64 (generic)",
"build": true,
Expand All @@ -65,7 +65,7 @@
},
{
"platform": "x86_64-linux-gnu",
"os": "ubuntu-latest",
"os": "ubuntu-22.04",
"ruby": "3.4",
"description": "Linux x86_64 GNU libc",
"build": true,
Expand All @@ -83,7 +83,7 @@
"linux_aarch64": [
{
"platform": "aarch64-linux",
"os": "ubuntu-latest",
"os": "ubuntu-22.04",
"ruby": "3.4",
"description": "Linux ARM64 (generic)",
"build": true,
Expand All @@ -93,7 +93,7 @@
},
{
"platform": "aarch64-linux-gnu",
"os": "ubuntu-latest",
"os": "ubuntu-22.04",
"ruby": "3.4",
"description": "Linux ARM64 GNU libc",
"build": true,
Expand Down
34 changes: 29 additions & 5 deletions .github/workflows/gem-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,32 @@ jobs:

- run: bundle exec rake gem:native:${{ matrix.platform }}

# Display compiled libraries for debugging
# Display compiled libraries for debugging - MUST FAIL if none found
- name: Inspect built libraries
if: matrix.platform != 'any'
shell: bash
run: |
echo "=== Platform: ${{ matrix.platform }} ==="
echo "=== Compiled libraries ==="
ls lib/ffi-libarchive-binary/*.dll lib/ffi-libarchive-binary/*.so lib/ffi-libarchive-binary/*.dylib 2>/dev/null || echo "No compiled libraries found"
FOUND=0
for ext in dll so dylib; do
for f in lib/ffi-libarchive-binary/*.$ext; do
if [ -f "$f" ]; then
echo "$f"
FOUND=1
fi
done
done
if [ "$FOUND" -eq 0 ]; then
echo "ERROR: No compiled libraries found!"
echo "=== Library directory contents ==="
ls -la lib/ffi-libarchive-binary/ 2>/dev/null || echo "Directory not found"
exit 1
fi
echo "=== Library directory contents ==="
ls -la lib/ffi-libarchive-binary/ 2>/dev/null || echo "Directory not found"
ls -la lib/ffi-libarchive-binary/

# Unpack gem and display contents
# Unpack gem and verify it contains compiled libraries - MUST FAIL if none found
- name: Inspect gem contents
shell: bash
run: |
Expand All @@ -108,7 +122,17 @@ jobs:
echo "=== Files in gem ==="
ls -R */lib/ 2>/dev/null | head -50
echo "=== Compiled libraries in gem ==="
ls */lib/ffi-libarchive-binary/*.dll */lib/ffi-libarchive-binary/*.so */lib/ffi-libarchive-binary/*.dylib 2>/dev/null || echo "No compiled libraries found in gem"
FOUND=0
for ext in dll so dylib; do
for f in $(find . -name "*.$ext" 2>/dev/null); do
echo "$f"
FOUND=1
done
done
if [ "$FOUND" -eq 0 ] && [ "${{ matrix.platform }}" != "any" ]; then
echo "ERROR: No compiled libraries found in gem!"
exit 1
fi

- uses: actions/upload-artifact@v6
if: failure()
Expand Down
18 changes: 15 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,29 @@ jobs:
name: ${{ github.run_number }}-${{ matrix.platform }}-pkg
path: pkg

# Unpack gem and display compiled libraries for debugging
# Unpack gem and display compiled libraries for debugging - MUST FAIL if none found
- name: Inspect gem contents
shell: bash
run: |
cd pkg
gem unpack ffi-libarchive-binary-*.gem
echo "=== Platform: ${{ matrix.platform }} ==="
echo "=== Compiled libraries in gem ==="
ls */lib/ffi-libarchive-binary/*.dll */lib/ffi-libarchive-binary/*.so */lib/ffi-libarchive-binary/*.dylib 2>/dev/null || echo "No compiled libraries found in gem"
FOUND=0
for ext in dll so dylib; do
for f in $(find . -name "*.$ext" 2>/dev/null); do
echo "$f"
FOUND=1
done
done
if [ "$FOUND" -eq 0 ]; then
echo "ERROR: No compiled libraries found in gem!"
echo "=== Full lib directory contents ==="
ls -la */lib/ffi-libarchive-binary/ 2>/dev/null || echo "Directory not found"
exit 1
fi
echo "=== Full lib directory contents ==="
ls -la */lib/ffi-libarchive-binary/ 2>/dev/null || echo "Directory not found"
ls -la */lib/ffi-libarchive-binary/

# Install the native gem
- name: Install native gem
Expand Down
5 changes: 5 additions & 0 deletions ext/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ libraries:
# - OpenSSL uses version 1.1.1w for Windows x64 (more stable for x86_64)
# - xz uses version 5.2.4 for all Windows platforms (MinGW compatibility)
# - Other libraries use cross-platform versions under 'all'
libiconv:
all:
version: "1.18"
url: "https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.18.tar.gz"
sha256: "3b08f5f4f9b4eb82f151a7040bfd6fe6c6fb922efe4b1659c66ea933276965e8"
zlib:
all:
version: "1.3.2"
Expand Down
2 changes: 1 addition & 1 deletion lib/ffi-libarchive-binary/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def self.libraries
def self.library_for(libname)
if MiniPortile::windows?
# Detect Windows ARM64
if RUBY_PLATFORM =~ /aarch64|arm64/i
if RUBY_PLATFORM.match?(/aarch64|arm64/i)
libraries[libname]["windows-arm64"] || libraries[libname]["windows"] || libraries[libname]["all"]
else
libraries[libname]["windows-x64"] || libraries[libname]["windows"] || libraries[libname]["all"]
Expand Down
28 changes: 19 additions & 9 deletions lib/ffi-libarchive-binary/libarchive_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
require_relative "base_recipe"
require_relative "zlib_recipe"
require_relative "libexpat_recipe"
require_relative "libiconv_recipe"
require_relative "openssl_recipe"
require_relative "xz_recipe"

Expand All @@ -32,6 +33,7 @@ def initialize
def create_dependencies
@zlib_recipe = ZLibRecipe.new
@expat_recipe = LibexpatRecipe.new
@iconv_recipe = LibiconvRecipe.new
@openssl_recipe = OpensslRecipe.new
@xz_recipe = XZRecipe.new
end
Expand All @@ -42,18 +44,22 @@ def generator_flags

def default_flags
[
"-DENABLE_OPENSSL:BOOL=ON", "-DENABLE_LIBB2:BOOL=OFF", "-DENABLE_LZ4:BOOL=OFF",
"-DENABLE_LZO::BOOL=OFF", "-DENABLE_LZMA:BOOL=ON", "-DENABLE_ZSTD:BOOL=OFF",
"-DENABLE_ZLIB::BOOL=ON", "-DENABLE_BZip2:BOOL=OFF", "-DENABLE_LIBXML2:BOOL=OFF",
"-DENABLE_EXPAT::BOOL=ON", "-DENABLE_TAR:BOOL=OFF", "-DENABLE_CPIO::BOOL=OFF",
"-DENABLE_OPENSSL:BOOL=ON", "-DENABLE_LIBB2:BOOL=OFF", "-DENABLE_LZ4:BOOL=OFF",
"-DENABLE_LZO:BOOL=OFF", "-DENABLE_LZMA:BOOL=ON", "-DENABLE_ZSTD:BOOL=OFF",
"-DENABLE_ZLIB:BOOL=ON", "-DENABLE_BZip2:BOOL=OFF", "-DENABLE_LIBXML2:BOOL=OFF",
"-DENABLE_EXPAT:BOOL=ON", "-DENABLE_TAR:BOOL=OFF", "-DENABLE_CPIO:BOOL=OFF",
"-DENABLE_CAT:BOOL=OFF", "-DENABLE_ACL:BOOL=OFF", "-DENABLE_TEST:BOOL=OFF",
"-DENABLE_UNZIP:BOOL=OFF", "-DOPENSSL_USE_STATIC_LIBS=ON", "-DENABLE_XAR:BOOL=ON",

# Provide root directories - let CMake find libraries in lib or lib64
"-DOPENSSL_ROOT_DIR:PATH=#{@openssl_recipe.path}",

# Add include paths to C flags so CMake's header detection can find them
"-DCMAKE_C_FLAGS=-I#{@expat_recipe.path}/include -I#{@openssl_recipe.path}/include -I#{@xz_recipe.path}/include -I#{@zlib_recipe.path}/include",
"-DCMAKE_C_FLAGS=-I#{@expat_recipe.path}/include " \
"-I#{@iconv_recipe.path}/include " \
"-I#{@openssl_recipe.path}/include " \
"-I#{@xz_recipe.path}/include " \
"-I#{@zlib_recipe.path}/include",

# Provide search paths for CMake to find libraries
"-DCMAKE_INCLUDE_PATH:STRING=#{include_path}",
Expand All @@ -71,18 +77,19 @@ def configure_defaults
end

def include_path
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
paths = [@zlib_recipe.path, @expat_recipe.path, @iconv_recipe.path, @openssl_recipe.path, @xz_recipe.path]
paths.map { |k| "#{k}/include" }.join(";")
end

def library_path
paths = [@zlib_recipe.path, @expat_recipe.path, @openssl_recipe.path, @xz_recipe.path]
paths = [@zlib_recipe.path, @expat_recipe.path, @iconv_recipe.path, @openssl_recipe.path, @xz_recipe.path]
paths.map { |k| "#{k}/lib;#{k}/lib64" }.join(";")
end

def activate
@zlib_recipe.activate
@expat_recipe.activate
@iconv_recipe.activate
@openssl_recipe.activate
@xz_recipe.activate

Expand All @@ -100,15 +107,18 @@ def cook
@expat_recipe.host = @host if @host
@expat_recipe.cook_if_not

@iconv_recipe.host = @host if @host
@iconv_recipe.cook_if_not

@openssl_recipe.host = @host if @host
@openssl_recipe.cook_if_not

@xz_recipe.host = @host if @host
@xz_recipe.cook_if_not

# Set explicit LZMA environment variables for libarchive configure
ENV['LIBLZMA_CFLAGS'] = "-I#{@xz_recipe.path}/include"
ENV['LIBLZMA_LIBS'] = "-L#{@xz_recipe.path}/lib -llzma"
ENV["LIBLZMA_CFLAGS"] = "-I#{@xz_recipe.path}/include"
ENV["LIBLZMA_LIBS"] = "-L#{@xz_recipe.path}/lib -llzma"

super

Expand Down
2 changes: 1 addition & 1 deletion lib/ffi-libarchive-binary/libexpat_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def configure
# Set cross-compiler environment variables for aarch64
env_vars = cross_compiler_env(host)
cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
[cflags(host), ldflags(host), "./configure"] + computed_options
[cflags(host), ldflags(host), "./configure"] + computed_options
execute("configure", cmd)
end

Expand Down
44 changes: 44 additions & 0 deletions lib/ffi-libarchive-binary/libiconv_recipe.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# frozen_string_literal: true

require_relative "base_recipe"

module LibarchiveBinary
class LibiconvRecipe < BaseRecipe
def initialize
super("libiconv")

@target = ROOT.join(@target).to_s
end

def configure_defaults
[
"--host=#{@host}",
"--disable-shared",
"--enable-static",
"--disable-nls",
]
end

def configure
# Set cross-compiler environment variables for aarch64
env_vars = cross_compiler_env(host)
cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
[cflags(host), ldflags(host), "./configure"] + computed_options
execute("configure", cmd)
end

def checkpoint
File.join(@target, "#{name}-#{version}-#{host}.installed")
end

def cook_if_not
cook unless File.exist?(checkpoint)
end

def cook
super

FileUtils.touch(checkpoint)
end
end
end
4 changes: 2 additions & 2 deletions lib/ffi-libarchive-binary/libxml2_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def configure_defaults
"--without-http",
"--without-ftp",
"--enable-static",
"--disable-shared"
"--disable-shared",
]
end

Expand All @@ -52,4 +52,4 @@ def cook
FileUtils.touch(checkpoint)
end
end
end
end
2 changes: 1 addition & 1 deletion lib/ffi-libarchive-binary/xz_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def configure
# Set cross-compiler environment variables for aarch64
env_vars = cross_compiler_env(host)
cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
[cflags(host), ldflags(host), "./configure"] + computed_options
[cflags(host), ldflags(host), "./configure"] + computed_options
execute("configure", cmd)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/ffi-libarchive-binary/zlib_recipe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def configure
# Set cross-compiler environment variables for aarch64
env_vars = cross_compiler_env(host)
cmd = ["env"] + env_vars.map { |k, v| "#{k}=#{v}" } +
[cflags(host), ldflags(host), "./configure"] + computed_options
[cflags(host), ldflags(host), "./configure"] + computed_options
execute("configure", cmd)
end
end
Expand Down
Loading