Skip to content
Closed
Changes from 1 commit
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
40 changes: 40 additions & 0 deletions Z/Zlibcloudflare/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "Zlibcloudflare"
version = v"1.2.8"

# Collection of sources required to complete build
sources = [
GitSource("https://github.com/cloudflare/zlib.git", "959b4ea305821e753385e873ec4edfaa9a5d49b7")
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/zlib*
cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} -DCMAKE_BUILD_TYPE=Release -DUNIX=true -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
make -j ${nproc}
make install
install_license ../README
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Platform("x86_64", "linux"; libc = "glibc"),
Platform("x86_64", "linux"; libc = "musl")
]


# The products that we will ensure are always built
products = [
LibraryProduct("libz", :libz)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't say I like having multiple libraries around with same name (and likely soname?), point which I made repeatedly in #3801. That's going to be brittle, to say the least.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with renaming it since I think few ppl would use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to link other libraries to this or you just want to ccall into this library directly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably need to copy the source code of https://github.com/JuliaIO/CodecZlib.jl

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When trying to build for aarch64:

-- Performing Test ARM_CRC
-- Performing Test ARM_CRC - Failed
-- Performing Test HAS_SSE2
-- Performing Test HAS_SSE2 - Success
-- Performing Test HAS_SSSE3
-- Performing Test HAS_SSSE3 - Success
-- Performing Test HAS_SSE42
-- Performing Test HAS_SSE42 - Success
-- Performing Test HAS_PCLMUL
-- Performing Test HAS_PCLMUL - Success

sigh... 🤦

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Judging by the plethora of -march and other -m options they really like to use, this might be a good exercise for our totally-untested-in-the-wild multiarchitecture infrastructure 🙃

Copy link
Member

@giordano giordano Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming the variable :libz -> :libzcloudfare is hardly a problem at all 🙂 My suggestion was to rename the library, with, most importantly, its SONAME everywhere in the build system and inside the pkgconfig file, which should also be renamed 🙂 Unless you can show that you can build the JLL and call into the right libz as it is now (which I have many doubts with, especially in relation with JuliaPackaging/JLLWrappers.jl#31).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since the output is a single SO file, can we just rename it after make?

Copy link
Member

@giordano giordano Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I'm trying to say repeatedly here and in #3801, I'm worried about the soname, not just the filename itself. And to do that consistently you must fix the soname everywhere in the build system.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, not familiar with ABI/linker, guess this is too much patching work for too little gain. Thanks for the explanation.

]

# Dependencies that must be installed before this package can be built
dependencies = Dependency[
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6")