Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grass-addons: initial integration #12889

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions projects/grass-addons/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2025 Google LLC
#
# Licensed 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.
#
################################################################################

FROM gcr.io/oss-fuzz-base/base-builder

RUN apt-get update && apt-get install -y \
libstdc++-10-dev \
build-essential \
python3 \
curl \
clang \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*

RUN git clone --depth 1 https://github.com/OSGeo/grass-addons.git /src/grass-addons

WORKDIR /src/grass-addons

COPY build.sh /src/

RUN chmod +x /src/build.sh

ENTRYPOINT ["/src/build.sh"]
76 changes: 76 additions & 0 deletions projects/grass-addons/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash -u
#
# Copyright 2025 Google LLC
#
# Licensed 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.
#
################################################################################

set -eux

SRC_DIR=/src/grass-addons
BUILD_DIR=/out
INSTALL_PREFIX=/usr/local
FUZZ_TARGET=$SRC_DIR/Fuzz/fuzz_target.c
OUT=$BUILD_DIR

mkdir -p build
cd build

apt-get update && apt-get install -y --no-install-recommends \
cmake \
libstdc++-10-dev \
clang \
make \
|| true

GRASS_INCLUDE_DIR=grass_include
mkdir -p $GRASS_INCLUDE_DIR/grass

curl -f -s -o $GRASS_INCLUDE_DIR/grass/gis.h https://raw.githubusercontent.com/OSGeo/grass/main/include/grass/gis.h || true
curl -f -s -o $GRASS_INCLUDE_DIR/grass/config.h https://raw.githubusercontent.com/OSGeo/grass-addons/grass8/Fuzz/fuzz_target.c || true
curl -f -s -o $GRASS_INCLUDE_DIR/grass/types.h https://raw.githubusercontent.com/OSGeo/grass-addons/grass8/Fuzz/fuzz_target.c || true

INCLUDE_DIRS=(
"$SRC_DIR/include"
"$SRC_DIR/src/raster/r.gwr"
"$SRC_DIR/src/raster/r.skyline"
"$SRC_DIR/src/raster/r.pops.spread/pops-core/tests"
"$GRASS_INCLUDE_DIR"
"/usr/include/c++/10"
"/usr/include/x86_64-linux-gnu/c++/10"
)

INCLUDE_FLAGS=$(printf " -I%s" "${INCLUDE_DIRS[@]}")

OBJECT_FILES=()
for src_file in $SRC_DIR/Fuzz/*.c; do
if [[ -f "$src_file" ]]; then
obj_file=$(basename "$src_file" .c).o
clang $CFLAGS $INCLUDE_FLAGS -c "$src_file" -o "build/$obj_file" -Wno-error
OBJECT_FILES+=("build/$obj_file")
fi
done

mkdir -p $OUT

if [[ ${#OBJECT_FILES[@]} -gt 0 ]]; then
clang $CXXFLAGS $INCLUDE_FLAGS build/*.o -o $OUT/fuzz_target
exit 0
else
exit 1
fi

if [[ ! -f "$OUT/fuzz_target" ]]; then
exit 1
fi
4 changes: 4 additions & 0 deletions projects/grass-addons/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
homepage: "https://grass.osgeo.org/grass-stable/manuals/addons/"
language: c++
primary_contact: "[email protected]"
main_repo: 'https://github.com/OSGeo/grass-addons'
Loading