Article 6CRV8 Please help me update gRPC SlackBuild

Please help me update gRPC SlackBuild

by
unInstance
from LinuxQuestions.org on (#6CRV8)
I want to update gRPC SlackBuild and migrate it to cmake.

I have created a separate SlackBuild for abseil-cpp, and it seems to be working:
Code:cd "$(dirname "$0")" ; CWD=$(pwd)

PRGNAM=abseil-cpp
VERSION=${VERSION:-20230125.3}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
NAMVER=$PRGNAM-$VERSION

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi

if [ -n "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

TMP="${TMP:-/tmp/SBo}"
SRC="$TMP/$NAMVER"
PKG="$TMP/package-$PRGNAM"
OUTPUT="${OUTPUT:-/tmp}"

if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
else
SLKCFLAGS="-O2"
fi

set -e

rm -rf "$PKG"
mkdir -p "$TMP" "$PKG" "$OUTPUT"
cd "$TMP"
rm -rf "$PRGNAM-$VERSION"
tar xvf "$CWD/$PRGNAM-$VERSION.tar.gz"
cd "$PRGNAM-$VERSION"
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

INSTPREFIX='/usr'

cmake -Bbuild \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX="$INSTPREFIX" \
-DCMAKE_CXX_STANDARD=17 \
-DBUILD_SHARED_LIBS=ON \
-DABSL_BUILD_TEST_HELPERS=ON \
-DABSL_USE_EXTERNAL_GOOGLETEST=ON \
-DABSL_FIND_GOOGLETEST=ON \
-DABSL_PROPAGATE_CXX_STD=ON \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
cd build
cmake --build .

mkdir -p "$PKG/install"
mkdir -p "$PKG/usr/doc/$NAMVER"
mkdir -p "$PKG/usr/share/$NAMVER"
cat "$CWD/$PRGNAM.SlackBuild" > "$PKG/usr/doc/$NAMVER/$PRGNAM.SlackBuild"
cat "$CWD/README" > "$PKG/usr/doc/$NAMVER/README"
cat "$CWD/slack-desc" > "$PKG/install/slack-desc"

# Copy useful things directly from the repository folder.
cat "$SRC/LICENSE" > "$PKG/usr/share/$NAMVER/LICENSE"
cat "$SRC/README.md" > "$PKG/usr/doc/$NAMVER/repository-README.md"
cat "$SRC/FAQ.md" > "$PKG/usr/doc/$NAMVER/repository-FAQ.md"

cd "$PKG"
/sbin/makepkg -l y -c n "$OUTPUT/$NAMVER-$ARCH-$BUILD$TAG.$PKGTYPE"This is my half-done gRPC SlackBuild (mostly copied over from archlinux):
Code:cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=grpc
VERSION=${VERSION:-1.56.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION

# use system protobuf for grpcio_tools
sed -r -i \
-e '/^CC_FILES=\[/,/\]/{/^CC_FILES=\[/n;/\]/!d;}' \
-e '/^CC_INCLUDES=\[/,/\]/{/^CC_INCLUDES=\[/n;/\]/!d;}' \
-e "s@^(PROTO_INCLUDE=')[^']+'@\1/usr/include'@" \
-e '/^PROTOBUF_SUBMODULE_VERSION=/d' \
tools/distrib/python/grpcio_tools/protoc_lib_deps.py
ln -s ../../../.. tools/distrib/python/grpcio_tools/grpc_root

cmake -Bbuild \
-DCMAKE_BUILD_TYPE=None \
-DCMAKE_CXX_FLAGS="${CXXFLAGS} -DNDEBUG" \
-DgRPC_INSTALL=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DCMAKE_INSTALL_PREFIX=/usr \
-DgRPC_BUILD_TESTS=ON \
-DgRPC_BUILD_CODEGEN=ON \
-DgRPC_BUILD_CSHARP_EXT=ON \
-DgRPC_BACKWARDS_COMPATIBILITY_MODE=OFF \
-DgRPC_ZLIB_PROVIDER='package' \
-DgRPC_CARES_PROVIDER='package' \
-DgRPC_RE2_PROVIDER='package' \
-DgRPC_SSL_PROVIDER='package' \
-DgRPC_PROTOBUF_PROVIDER='package' \
-DgRPC_PROTOBUF_PACKAGE_TYPE='MODULE' \
-DgRPC_BENCHMARK_PROVIDER:STRING='package' \
-DgRPC_ABSL_PROVIDER:STRING='package' \
-DgRPC_USE_PROTO_LITE=OFF \
-DgRPC_BUILD_GRPC_CPP_PLUGIN=ON \
-DgRPC_BUILD_GRPC_CSHARP_PLUGIN=ON \
-DgRPC_BUILD_GRPC_NODE_PLUGIN=ON \
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=ON \
-DgRPC_BUILD_GRPC_PHP_PLUGIN=ON \
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=ON \
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=ON \
-GNinja
cd build
cmake --build .

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPEThis is the error I get trying to build gRPC:
Code:CMake Error at cmake/abseil-cpp.cmake:38 (find_package):
Could not find a package configuration file provided by "absl" with any of
the following names:

abslConfig.cmake
absl-config.cmake

Add the installation prefix of "absl" to CMAKE_PREFIX_PATH or set
"absl_DIR" to a directory containing one of the above files. If "absl"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
CMakeLists.txt:318 (include)If I understand this correctly, cmake builds have to provide *.cmake files, so that other cmake builds can find other projects. Why does my abseil-cpp not provide such a file?
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments