Files
BMLFS/build-scripts/snappy.build
2021-09-29 12:02:45 -05:00

65 lines
2.3 KiB
Bash

#! /bin/bash
# snappy
# Source: https://github.com/google/snappy/archive/1.1.9/snappy-1.1.9.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: CMake
# Recommended: NONE
# Optional: NONE
# If coptimizing with GCC:
export CFLAGS="-march=native -pipe "
export CFLAGS+="-O3 -ffat-lto-objects -flto=4 "
export CFLAGS+="-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector "
export CFLAGS+="--param=ssp-buffer-size=32 -Wformat -Wformat-security "
export CFLAGS+="-Wno-error -Wl,-z,max-page-size=0x1000"
export CXXFLAGS=$CFLAGS
export LDFLAGS="-flto=4 -Wl,-O2 -Wl,--as-needed "
patch -Np1 -i ../patches/snappy-alpine/cmakelists.patch
patch -Np1 -i ../patches/snappy-void/inline.patch
mkdir build && cd build &&
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DBUILD_SHARED_LIBS=yes \
-DBUILD_STATIC_LIBS=yes \
-DSNAPPY_REQUIRE_AVX2=yes \
-DSNAPPY_BUILD_TESTS=no \
-DSNAPPY_BUILD_BENCHMARKS=no \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" .. && \
read -p "Compile?" && make -j2 &&
sudo -S make DESTDIR=$BUILD install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
snappy: snappy (A fast compressor/decompressor)
snappy:
snappy: Snappy is a compression/decompression library. It does not aim for
snappy: maximum compression, or compatibility with any other compression
snappy: library; instead, it aims for very high speeds and reasonable
snappy: compression. For instance, compared to the fastest mode of zlib,
snappy: Snappy is an order of magnitude faster for most inputs, but the
snappy: resulting compressed files are anywhere from 20% to 100% bigger.
snappy:
snappy:
snappy:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/snappy-1.1.9-$(uname -m)-mlfs.txz &&
sudo -S rm -rf ${BUILD}/*