2021-06-08 03:11:08 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Licensed to the Apache Software Foundation (ASF) under one
|
|
|
|
# or more contributor license agreements. See the NOTICE file
|
|
|
|
# distributed with this work for additional information
|
|
|
|
# regarding copyright ownership. The ASF licenses this file
|
|
|
|
# to you under the Apache License, Version 2.0 (the
|
|
|
|
# "License"); you may not use this file except in compliance
|
|
|
|
# with the License. You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
echo "ERROR: Need at least 1 argument, $# were provided"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
pkg-resolver/check_platform.py "$1"
|
|
|
|
if [ $? -eq 1 ]; then
|
|
|
|
echo "ERROR: Unsupported platform $1"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2024-02-22 17:09:46 +00:00
|
|
|
default_version="3.21.12"
|
2021-06-08 03:11:08 +00:00
|
|
|
version_to_install=$default_version
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
version_to_install="$2"
|
|
|
|
fi
|
|
|
|
|
2024-02-22 17:09:46 +00:00
|
|
|
if [ "$version_to_install" != "3.21.12" ]; then
|
2021-06-08 03:11:08 +00:00
|
|
|
echo "WARN: Don't know how to install version $version_to_install, installing the default version $default_version instead"
|
|
|
|
version_to_install=$default_version
|
|
|
|
fi
|
|
|
|
|
2024-02-22 17:09:46 +00:00
|
|
|
if [ "$version_to_install" == "3.21.12" ]; then
|
2021-06-08 03:11:08 +00:00
|
|
|
# hadolint ignore=DL3003
|
|
|
|
mkdir -p /opt/protobuf-src &&
|
|
|
|
curl -L -s -S \
|
2024-02-22 17:09:46 +00:00
|
|
|
https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.12.tar.gz \
|
2021-06-08 03:11:08 +00:00
|
|
|
-o /opt/protobuf.tar.gz &&
|
|
|
|
tar xzf /opt/protobuf.tar.gz --strip-components 1 -C /opt/protobuf-src &&
|
|
|
|
cd /opt/protobuf-src &&
|
2024-02-22 17:09:46 +00:00
|
|
|
./autogen.sh &&
|
2021-06-08 03:11:08 +00:00
|
|
|
./configure --prefix=/opt/protobuf &&
|
|
|
|
make "-j$(nproc)" &&
|
|
|
|
make install &&
|
|
|
|
cd /root &&
|
|
|
|
rm -rf /opt/protobuf-src
|
|
|
|
else
|
|
|
|
echo "ERROR: Don't know how to install version $version_to_install"
|
|
|
|
exit 1
|
|
|
|
fi
|