mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
app-arch/brotli: add port (#1916)
This commit is contained in:
149
app-arch/brotli/brotli-1.0.2.recipe
Normal file
149
app-arch/brotli/brotli-1.0.2.recipe
Normal file
@@ -0,0 +1,149 @@
|
||||
SUMMARY="A generic-purpose lossless compression algorithm"
|
||||
DESCRIPTION="A generic-purpose lossless compression algorithm that \
|
||||
compresses data using a combination of a modern variant of the LZ77 algorithm, \
|
||||
Huffman coding and 2nd order context modeling, with a compression ratio \
|
||||
comparable to the best currently available general-purpose compression methods. \
|
||||
It is similar in speed with deflate but offers more dense compression."
|
||||
HOMEPAGE="https://github.com/google/brotli"
|
||||
COPYRIGHT="2009, 2010, 2013-2017 Brotli Authors"
|
||||
LICENSE="MIT"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://github.com/google/brotli/archive/v$portVersion.tar.gz"
|
||||
CHECKSUM_SHA256="c2cf2a16646b44771a4109bb21218c8e2d952babb827796eb8a800c1f94b7422"
|
||||
|
||||
ARCHITECTURES="x86_gcc2 x86_64"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
# For now the library will follow $portVersion,
|
||||
# but upstream said that will change in the future.
|
||||
libVersion="1.0.2"
|
||||
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
|
||||
|
||||
PROVIDES="
|
||||
brotli$secondaryArchSuffix = $portVersion
|
||||
cmd:brotli$secondaryArchSuffix = $portVersion
|
||||
lib:libbrotlicommon$secondaryArchSuffix = $libVersionCompat
|
||||
lib:libbrotlidec$secondaryArchSuffix = $libVersionCompat
|
||||
lib:libbrotlienc$secondaryArchSuffix = $libVersionCompat
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
"
|
||||
|
||||
PROVIDES_devel="
|
||||
brotli${secondaryArchSuffix}_devel = $portVersion
|
||||
devel:libbrotlicommon$secondaryArchSuffix = $libVersionCompat
|
||||
devel:libbrotlicommon_static$secondaryArchSuffix = $libVersion
|
||||
devel:libbrotlidec$secondaryArchSuffix = $libVersionCompat
|
||||
devel:libbrotlidec_static$secondaryArchSuffix = $libVersion
|
||||
devel:libbrotlienc$secondaryArchSuffix = $libVersionCompat
|
||||
devel:libbrotlienc_static$secondaryArchSuffix = $libVersion
|
||||
"
|
||||
REQUIRES_devel="
|
||||
brotli$secondaryArchSuffix == $portVersion base
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:cmake
|
||||
cmd:g++$secondaryArchSuffix
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
"
|
||||
|
||||
PYTHON_PACKAGES=(python python3)
|
||||
PYTHON_VERSIONS=(2.7 3.6)
|
||||
# We don't have python2 for secondaryArch,
|
||||
# and gcc2 doesn't support the flags passed by python3
|
||||
if [ -n "$secondaryArchSuffix" ]; then
|
||||
unset PYTHON_PACKAGES[0]
|
||||
unset PYTHON_VERSIONS[0]
|
||||
elif [ "$effectiveTargetArchitecture" = "x86_gcc2" ]; then
|
||||
unset PYTHON_PACKAGES[1]
|
||||
unset PYTHON_VERSIONS[1]
|
||||
fi
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
eval "PROVIDES_${pythonPackage}=\"\
|
||||
${portName}_$pythonPackage = $portVersion\
|
||||
\"; \
|
||||
REQUIRES_$pythonPackage=\"\
|
||||
haiku\n\
|
||||
cmd:python$pythonVersion\
|
||||
\""
|
||||
BUILD_REQUIRES="$BUILD_REQUIRES
|
||||
setuptools_$pythonPackage"
|
||||
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
|
||||
cmd:python$pythonVersion"
|
||||
done
|
||||
|
||||
if [ -z "$secondaryArchSuffix" ]; then
|
||||
REQUIRES_python+="
|
||||
lib:libpython${PYTHON_VERSIONS[0]}
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
devel:libpython${PYTHON_VERSIONS[0]}
|
||||
"
|
||||
fi
|
||||
if [ "$effectiveTargetArchitecture" != "x86_gcc2" ]; then
|
||||
REQUIRES_python3+="
|
||||
lib:libpython${PYTHON_VERSIONS[1]}m$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES+="
|
||||
devel:libpython${PYTHON_VERSIONS[1]}m$secondaryArchSuffix
|
||||
"
|
||||
fi
|
||||
|
||||
BUILD()
|
||||
{
|
||||
runConfigure --omit-buildspec ./configure-cmake --disable-debug
|
||||
make $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
make install
|
||||
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
|
||||
python=python$pythonVersion
|
||||
installLocation=$prefix/lib/$python/vendor-packages/
|
||||
export PYTHONPATH=$installLocation:$PYTHONPATH
|
||||
mkdir -p $installLocation
|
||||
rm -rf build
|
||||
$python setup.py build install \
|
||||
--root=/ --prefix=$prefix
|
||||
|
||||
packageEntries $pythonPackage \
|
||||
$prefix/lib/python*
|
||||
done
|
||||
|
||||
install -d -m 755 "$manDir"/man{1,3}
|
||||
install -t "$manDir/man1" docs/brotli.1
|
||||
install -t "$manDir/man3" docs/*.3
|
||||
|
||||
fixPkgconfig
|
||||
prepareInstalledDevelLibs libbrotli{common,dec,enc}{,-static}
|
||||
packageEntries devel \
|
||||
"$manDir/man3" \
|
||||
"$developDir"
|
||||
}
|
||||
|
||||
TEST()
|
||||
{
|
||||
make test
|
||||
|
||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
||||
|
||||
python=python$pythonVersion
|
||||
rm -rf build
|
||||
$python setup.py test
|
||||
rm python/_brotli.so
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user