Skip to content

Commit

Permalink
Fix OSX builds
Browse files Browse the repository at this point in the history
  • Loading branch information
milesgranger committed Sep 21, 2024
1 parent c133b41 commit ccf3fe7
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 49 deletions.
47 changes: 24 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,30 +33,30 @@ jobs:
# - name: Test
# run: cross test --target ${{ matrix.target }} --release

test-wasm32-emscripten:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
build: [static, shared]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
# test-wasm32-emscripten:
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# build: [static, shared]
# steps:
# - uses: actions/checkout@v4
# with:
# submodules: recursive

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-emscripten
# - name: Install Rust toolchain
# uses: dtolnay/rust-toolchain@stable
# with:
# target: wasm32-unknown-emscripten

- name: Install build deps
run: sudo apt install nasm gcc-multilib
# - name: Install build deps
# run: sudo apt install nasm gcc-multilib

- name: Install Emscripten
uses: mymindstorm/setup-emsdk@v14
# - name: Install Emscripten
# uses: mymindstorm/setup-emsdk@v14

- name: Build
run: cargo build --target wasm32-unknown-emscripten --no-default-features --features ${{ matrix.build }}
# - name: Build
# run: cargo build --target wasm32-unknown-emscripten --no-default-features --features ${{ matrix.build }}

test-native:
runs-on: ${{ matrix.os }}
Expand All @@ -66,8 +66,8 @@ jobs:
os:
- macos-13 # x86_64
- macos-14 # M1
- windows-latest
- ubuntu-latest
# - windows-latest
# - ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -77,6 +77,7 @@ jobs:
uses: dtolnay/rust-toolchain@stable

- name: Install nasm
if: runner.os != 'macOS'
uses: ilammy/setup-nasm@v1

- name: Set MSVC developer prompt
Expand All @@ -85,7 +86,7 @@ jobs:

- name: Install build deps (OSX)
if: runner.os == 'macOS'
run: brew install automake autoconf coreutils libtool gcc
run: brew install automake autoconf coreutils libtool nasm

- name: Test (shared)
run: cargo test --no-default-features --features shared --lib --release -vv
Expand Down
27 changes: 9 additions & 18 deletions isal-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ fn main() {

let mut configure_args = vec![
format!("--prefix={}", install_path.display()),
format!("--host={}", target),
format!("--enable-static={}", if is_static { "yes" } else { "no" }),
format!("--enable-shared={}", if is_shared { "yes" } else { "no" }),
format!("--host={}", target),
format!("LDFLAGS=-{}", if is_static { "static" } else { "shared" }),
format!("CC=gcc"),
"--with-pic=yes".to_string(),
];
let opt = if profile == "release" { "-O3" } else { "-O1" };
configure_args.push(format!("CFLAGS=-g {}", opt));

if target.starts_with("wasm32") {
configure_args.push("CC=emcc".to_string());
}
if profile == "release" {
configure_args.push("CFLAGS=-g -O3".to_string());
} else {
configure_args.push("CFLAGS=-g -O1".to_string());
if !cfg!(target_os = "macos") {
let ldflag = if is_static { "static" } else { "shared" };
configure_args.push(format!("LDFLAGS=-{}", ldflag));
configure_args.push("--with-pic=yes".to_string());
}

let status = Command::new("./configure")
Expand All @@ -72,7 +72,7 @@ fn main() {
}

Command::new("make")
.args(["install-libLTLIBRARIES"])
.args(&["install-libLTLIBRARIES"])
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
Expand Down Expand Up @@ -109,21 +109,12 @@ fn main() {
}
}

#[allow(unused_variables)]
let libname = if cfg!(target_os = "windows") {
"isa-l"
} else {
"isal"
};

if cfg!(target_os = "windows") {
for entry in std::fs::read_dir(install_path).unwrap() {
let entry = entry.unwrap();
let path = entry.path();
println!("{}", path.display());
}
}

#[cfg(feature = "static")]
println!("cargo:rustc-link-lib=static={}", libname);

Expand Down
2 changes: 1 addition & 1 deletion isal-sys/isa-l
Submodule isa-l updated 194 files
26 changes: 19 additions & 7 deletions isal-sys/src/igzip_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ pub mod bindings {
// copy from target dir when updating bindings
#[cfg(not(feature = "regenerate-bindings"))]
pub mod bindings {

/* automatically generated by rust-bindgen 0.69.4 */

pub const _STDINT_H: u32 = 1;
Expand Down Expand Up @@ -397,7 +396,7 @@ pub mod bindings {
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct isal_huff_histogram {
#[doc = "!< Histogram of Literal/Len symbols seen"]
#[doc = "!< Histogram of Literal/Len symbols\n!< seen"]
pub lit_len_histogram: [u64; 286usize],
#[doc = "!< Histogram of Distance Symbols seen"]
pub dist_histogram: [u64; 30usize],
Expand Down Expand Up @@ -450,9 +449,11 @@ pub mod bindings {
)
);
}
#[doc = " @brief Holds modified histogram"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct isal_mod_hist {
#[doc = "!< Distance"]
pub d_hist: [u32; 30usize],
pub ll_hist: [u32; 513usize],
}
Expand Down Expand Up @@ -571,6 +572,7 @@ pub mod bindings {
)
);
}
#[doc = " @brief Holds Zlib header information"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct isal_zlib_header {
Expand Down Expand Up @@ -638,6 +640,7 @@ pub mod bindings {
)
);
}
#[doc = " @brief Holds Gzip header information"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct isal_gzip_header {
Expand Down Expand Up @@ -1094,9 +1097,9 @@ pub mod bindings {
pub deflate_hdr_count: u32,
#[doc = "!< Number of bits in the partial byte in header"]
pub deflate_hdr_extra_bits: u32,
#[doc = "!< bits 4:0 are the code length, bits 31:5 are the code"]
#[doc = "!< bits 4:0 are the code length, bits 31:5 are\n!< the code"]
pub dist_table: [u32; 2usize],
#[doc = "!< bits 4:0 are the code length, bits 31:5 are the code"]
#[doc = "!< bits 4:0 are the code length, bits 31:5 are\n!< the code"]
pub len_table: [u32; 256usize],
#[doc = "!< literal code"]
pub lit_table: [u16; 257usize],
Expand Down Expand Up @@ -1412,10 +1415,13 @@ pub mod bindings {
)
);
}
#[doc = " @brief Large lookup table for decoding huffman codes"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct inflate_huff_code_large {
#[doc = "!< Short code lookup table"]
pub short_code_lookup: [u32; 4096usize],
#[doc = "!< Long code lookup table"]
pub long_code_lookup: [u16; 1264usize],
}
#[test]
Expand Down Expand Up @@ -1454,10 +1460,13 @@ pub mod bindings {
)
);
}
#[doc = " @brief Small lookup table for decoding huffman codes"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct inflate_huff_code_small {
#[doc = "!< Short code lookup table"]
pub short_code_lookup: [u16; 1024usize],
#[doc = "!< Long code lookup table"]
pub long_code_lookup: [u16; 80usize],
}
#[test]
Expand Down Expand Up @@ -1544,15 +1553,14 @@ pub mod bindings {
pub tmp_out_valid: i32,
#[doc = "!< Number of bytes processed in tmp_out_buffer"]
pub tmp_out_processed: i32,
#[doc = "!< Temporary buffer containing data from the input stream"]
#[doc = "!< Temporary buffer containing data from the\n!< input stream"]
pub tmp_in_buffer: [u8; 328usize],
#[doc = "!< Temporary buffer containing data from the output stream"]
pub tmp_out_buffer: [u8; 65824usize],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union inflate_state__bindgen_ty_1 {
#[doc = "!< Length left to read of type 0 block when outbuffer overflow occurred"]
#[doc = "!< Length left to read of type 0 block when outbuffer\n!< overflow occurred"]
pub type0_block_len: i32,
#[doc = "!< Count of bytes remaining to be parsed"]
pub count: i32,
Expand Down Expand Up @@ -1903,6 +1911,10 @@ pub mod bindings {
#[doc = " @brief Set gzip header default values\n\n @param gz_hdr: Gzip header to initialize."]
pub fn isal_gzip_header_init(gz_hdr: *mut isal_gzip_header);
}
extern "C" {
#[doc = " @brief Set zlib header default values\n\n @param z_hdr: zlib header to initialize."]
pub fn isal_zlib_header_init(z_hdr: *mut isal_zlib_header);
}
extern "C" {
#[doc = " @brief Write gzip header to output stream\n\n Writes the gzip header to the output stream. On entry this function assumes\n that the output buffer has been initialized, so stream->next_out,\n stream->avail_out and stream->total_out have been set. If the output buffer\n contains insufficient space, stream is not modified.\n\n @param stream: Structure holding state information on the compression stream.\n @param gz_hdr: Structure holding the gzip header information to encode.\n\n @returns Returns 0 if the header is successfully written, otherwise returns\n the minimum size required to successfully write the gzip header to the output\n buffer."]
pub fn isal_write_gzip_header(
Expand Down

0 comments on commit ccf3fe7

Please sign in to comment.