opt/ccache/Pkgfile
2020-11-09 22:34:51 +11:00

42 lines
1.2 KiB
Plaintext

# Description: A fast compiler cache.
# URL: https://ccache.dev/
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: cmake
# Optional: clang-ccache-bindings asciidoc zstd
name=ccache
version=4.0
release=1
source=(https://github.com/$name/$name/releases/download/v$version/$name-$version.tar.xz
ccache.1
ccache-man.patch)
build() {
[[ -e '/usr/bin/ninja' ]] && PKGMK_CCACHE+=' -G Ninja'
# https://github.com/ccache/ccache/issues/684
patch -d $name-$version -p1 -i $SRC/ccache-man.patch
cmake -S $name-$version -B build $PKGMK_CCACHE \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS -DNDEBUG" \
-D CMAKE_C_FLAGS_RELEASE="$CFLAGS -DNDEBUG" \
-D ZSTD_FROM_INTERNET="$(prt-get isinst zstd &> /dev/null && echo OFF || echo ON)"
cmake --build build
DESTDIR=$PKG cmake --install build
# install bundled man page else generate it with asciidoc
if [ ! -e '/usr/bin/asciidoc' ]; then
install -d $PKG/usr/share/man/man1
install -m 644 $SRC/ccache.1 $PKG/usr/share/man/man1/
fi
install -d $PKG/usr/lib/ccache
for c in cc gcc g++ cpp c++; do
ln -s /usr/bin/ccache $PKG/usr/lib/ccache/$c
done
}