| #!/bin/bash |
| |
| # Copyright 2025 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| set -e |
| set -x |
| set -o pipefail |
| PREFIX=$1 |
| DEPS_PREFIX=$2 |
| |
| # copied from libleveldb |
| |
| mkdir cmake-build |
| cd cmake-build |
| cmake .. \ |
| -DBUILD_SHARED_LIBS=OFF \ |
| -DCMAKE_BUILD_TYPE=Release \ |
| -DCMAKE_INSTALL_PREFIX="$PREFIX" |
| cmake --build . --target install -j "$(nproc)" |
| |
| # CMake may output static libraries to $PREFIX/lib64. |
| # Allow dependent 3pp packages to reference using -L$DEPS_PREFIX/lib. |
| mkdir -p $PREFIX/lib |
| ( |
| # No work to do if lib64 wasn't created. |
| cd "$PREFIX/lib64" 2>/dev/null && { |
| # Replicate lib64/'s directory structure in lib/. |
| # (We take the extra effort to do this instead of just indiscriminately |
| # linking everything because linked directories would conflict with |
| # identically-named directories from other packages.) |
| find . -type d -exec mkdir -p "$PREFIX/lib/{}" \; |
| |
| # Now we can create relative symlinks to all files. |
| find . -type f -exec ln -s -r "$PREFIX/lib64/{}" "$PREFIX/lib/{}" \; |
| } || true |
| ) |