mirror of
https://github.com/ivabus/pantry
synced 2024-11-14 12:35:10 +03:00
6503b1b827
* fix folly * wip * wip * instead of moving the build directory, let's just sanitize facebook's regexes * lols in apfs --------- Co-authored-by: Jacob Heider <jacob@pkgx.dev>
102 lines
2.9 KiB
YAML
102 lines
2.9 KiB
YAML
distributable:
|
|
url: https://github.com/facebook/folly/releases/download/{{version.tag}}/folly-{{version.tag}}.tar.gz
|
|
strip-components: 0
|
|
|
|
versions:
|
|
github: facebook/folly
|
|
|
|
dependencies:
|
|
boost.org: '*'
|
|
gflags.github.io: '*'
|
|
google.com/glog: '*'
|
|
libevent.org: '*'
|
|
lz4.org: 1
|
|
openssl.org: ^1.1
|
|
tukaani.org/xz: 5
|
|
facebook.com/zstd: 1
|
|
gnu.org/coreutils: 9
|
|
google.github.io/snappy: '*'
|
|
google.com/double-conversion: ^3
|
|
fmt.dev: ^9
|
|
darwin:
|
|
sourceware.org/bzip2: '*'
|
|
zlib.net: '*'
|
|
|
|
build:
|
|
dependencies:
|
|
cmake.org: ^3.0.2
|
|
freedesktop.org/pkg-config: ^0.29
|
|
script:
|
|
# folly uses the path to build as part of a regex, but out paths have "+"s in them.
|
|
# don't mess up the intentional newline
|
|
- run: |
|
|
sed -i.bak -E -f $PROP CMakeLists.txt
|
|
rm CMakeLists.txt.bak
|
|
prop: |
|
|
/^REMOVE_MATCHES_FROM_LISTS\(files hfiles/ {
|
|
i\\
|
|
string(REPLACE "+" "\\\\\\\\+" ESCAPED_FOLLY_DIR "\\\${FOLLY_DIR}")
|
|
}
|
|
|
|
s/\^\\\$\{FOLLY_DIR\}/^\\\$\{ESCAPED_FOLLY_DIR\}/g
|
|
|
|
- cmake $ARGS -DBUILD_SHARED_LIBS=ON -S . -B shared
|
|
- cmake --build shared
|
|
- cmake --install shared
|
|
|
|
- cmake $ARGS -DBUILD_SHARED_LIBS=OFF -S . -B static
|
|
- cmake --build static
|
|
|
|
- run: cp $SRCROOT/static/libfolly.a libfollybenchmark.a
|
|
working-directory: ${{prefix}}/static/folly
|
|
|
|
- run: |
|
|
sed -E -i.bak \
|
|
-e "s:{{pkgx.prefix}}:\$\{_IMPORT_PREFIX\}/../../..:g" \
|
|
-e '/^ INTERFACE_INCLUDE_DIRECTORIES/ s|/v([0-9]+)(\.[0-9]+)*[a-z]?/include|/v\1/include|g' \
|
|
-e '/^ INTERFACE_LINK_LIBRARIES/ s|/v([0-9]+)(\.[0-9]+)*[a-z]?/lib|/v\1/lib|g' \
|
|
folly-targets.cmake
|
|
rm folly-targets.cmake.bak
|
|
working-directory: ${{prefix}}/lib/cmake/folly
|
|
|
|
- run: |
|
|
sed -i.bak -e 's/-I[^ ]* *//g' libfolly.pc
|
|
rm libfolly.pc.bak
|
|
working-directory: ${{prefix}}/lib/pkgconfig
|
|
|
|
# folly has libs that end up with name @rpath/libfolly.{{version}}.dylib (offset 24)
|
|
# so we need to add @loader_path to the rpath
|
|
- run: |
|
|
for LIB in libfolly*.*.*.*-dev.dylib; do
|
|
install_name_tool -add_rpath @loader_path $LIB
|
|
done
|
|
working-directory: ${{prefix}}/lib
|
|
if: darwin
|
|
env:
|
|
ARGS:
|
|
- -DCMAKE_INSTALL_PREFIX={{prefix}}
|
|
- -DCMAKE_BUILD_TYPE=Release
|
|
- -DBUILD_TESTING=OFF
|
|
- -DCMAKE_VERBOSE_MAKEFILE=ON
|
|
linux/aarch64:
|
|
ARGS:
|
|
- -DCMAKE_C_FLAGS=-fPIC
|
|
- -DCMAKE_CXX_FLAGS=-fPIC
|
|
- -DCMAKE_EXE_LINKER_FLAGS=-pie
|
|
|
|
test:
|
|
fixture: |
|
|
#include <folly/FBVector.h>
|
|
int main() {
|
|
folly::fbvector<int> numbers({0, 1, 2, 3});
|
|
numbers.reserve(10);
|
|
for (int i = 4; i < 10; i++) {
|
|
numbers.push_back(i * 2);
|
|
}
|
|
assert(numbers[6] == 12);
|
|
return 0;
|
|
}
|
|
script: |
|
|
mv $FIXTURE b.cc
|
|
c++ -std=c++17 b.cc -lfolly -ldl -lfmt -lglog
|
|
./a.out
|