-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
projects: Add GStreamer #905
Changes from 3 commits
1cb5d2f
a4ae51d
029ef53
5ed9b51
a9673d5
57610cc
09c1dd6
5889da1
af88fc7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Copyright 2017 Google Inc. | ||
# | ||
# 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 | ||
MAINTAINER bilboed@bilboed.com | ||
# Install the build dependencies | ||
|
||
# install the minimum | ||
|
||
RUN sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list" && \ | ||
apt-get update && \ | ||
apt-get install -y make autoconf automake libtool build-essential \ | ||
autopoint pkg-config bison flex gettext libglib2.0-dev libffi-dev liblzma-dev \ | ||
libvorbis-dev libtheora-dev libogg-dev git-annex | ||
|
||
# Checkout all development repositories | ||
#RUN for i in orc gstreamer gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav; do git clone --depth 1 --recursive https://anongit.freedesktop.org/git/gstreamer/$i $i; done | ||
RUN \ | ||
git clone --depth 1 --recursive https://anongit.freedesktop.org/git/gstreamer/orc orc && \ | ||
git clone --depth 1 --recursive https://anongit.freedesktop.org/git/gstreamer/gstreamer gstreamer && \ | ||
git clone --depth 1 --recursive https://anongit.freedesktop.org/git/gstreamer/gst-plugins-base gst-plugins-base | ||
|
||
WORKDIR gstreamer | ||
COPY build.sh $SRC/ | ||
COPY gst-discoverer.c $SRC/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
#!/bin/bash -eu | ||
# Copyright 2017 Google Inc. | ||
# | ||
# 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. | ||
# | ||
################################################################################ | ||
|
||
BASEFLAGS="-Wno-constant-conversion -Wno-header-guard -Wno-mismatched-tags" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will try recompiling without |
||
echo "CFLAGS" $CFLAGS | ||
echo "CXXFLAGS" $CXXFLAGS | ||
export CFLAGS="$CFLAGS $BASEFLAGS" | ||
export CXXFLAGS="$CXXFLAGS $BASEFLAGS" | ||
export LDFLAGS="$SANITIZER_FLAGS $COVERAGE_FLAGS" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think COVERAGE_FLAGS is a part of our interface. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, looked at the wrong section: https://github.com/google/oss-fuzz/blob/master/infra/base-images/base-builder/README.md#compiler-flags There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So which is it ? Good or not good ? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not good :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We actually didn't need a custom LDFLAGS. Removed it altogether |
||
PREFIX=$WORK/prefix | ||
PLUGIN_DIR=$PREFIX/lib/gstreamer-1.0 | ||
export PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig | ||
mkdir -p $PREFIX | ||
cd $WORK | ||
|
||
for i in orc gstreamer gst-plugins-base; | ||
do | ||
mkdir -p $i | ||
cd $i | ||
$SRC/$i/autogen.sh --prefix=$PREFIX --disable-shared --enable-static --disable-examples --disable-gtk-doc --disable-introspection --enable-static-plugins --disable-gst-tracer-hooks | ||
make -j$(nproc) | ||
make install | ||
cd .. | ||
done | ||
|
||
#finally build the binary \o/ | ||
BUILD_CFLAGS="$CFLAGS `pkg-config --static --cflags glib-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 gstreamer-app-1.0 orc-0.4`" | ||
|
||
# List of dependencies libraries we grab from pkg-config | ||
# Should also include dependencies of dependencies (ex: libvorbis depends on libogg) | ||
|
||
PKG_DEPS="glib-2.0 gstreamer-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 orc-0.4 \ | ||
gstreamer-riff-1.0 gstreamer-tag-1.0 gstreamer-app-1.0 zlib \ | ||
ogg vorbis vorbisenc theoraenc theoradec theora" | ||
|
||
# List of all plugins to include | ||
PLUGINS="$PLUGIN_DIR/libgstcoreelements.a \ | ||
$PLUGIN_DIR/libgsttypefindfunctions.a \ | ||
$PLUGIN_DIR/libgstplayback.a \ | ||
$PLUGIN_DIR/libgstapp.a \ | ||
$PLUGIN_DIR/libgstvorbis.a \ | ||
$PLUGIN_DIR/libgsttheora.a \ | ||
$PLUGIN_DIR/libgstogg.a" | ||
|
||
# We want to statically link everything, except for shared libraries that are present on | ||
# the base image. Those need to be specified beforehad and explicitely linked dynamically | ||
# If any of the static dependencies require a pre-installed shared library, you need | ||
# to add that library to the following list | ||
PREDEPS_LDFLAGS="-Wl,-Bdynamic -ldl -lm -pthread -lrt -lpthread" | ||
|
||
# The libraries we want to statically link to | ||
# This includes dependencies of the gst plugins | ||
#BUILD_LDFLAGS="$LDFLAGS `pkg-config --static --libs $PKG_DEPS` -Wl,-static -lpcre " | ||
BUILD_LDFLAGS="$LDFLAGS -Wl,-static `pkg-config --static --libs $PKG_DEPS`" | ||
|
||
echo | ||
echo "PREDEPS_LDFLAGS" $PREDEPS_LDFLAGS | ||
echo | ||
echo "BUILD_LDFLAGS" $BUILD_LDFLAGS | ||
echo | ||
|
||
echo $CXX $CXXFLAGS $BUILD_CFLAGS \ | ||
-v -Wl,--verbose \ | ||
$SRC//gst-discoverer.c \ | ||
$PLUGINS \ | ||
$LIB_FUZZING_ENGINE \ | ||
-o gst-discoverer \ | ||
$PREDEPS_LDFLAGS \ | ||
$BUILD_LDFLAGS \ | ||
-Wl,-Bdynamic | ||
|
||
echo | ||
echo ">>>> BUILDING gst-discoverer.o" | ||
echo | ||
|
||
$CC $CFLAGS $BUILD_CFLAGS -c $SRC/gst-discoverer.c -o $SRC/gst-discoverer.o | ||
|
||
echo | ||
echo ">>>> LINKING" | ||
echo | ||
|
||
$CXX $CXXFLAGS \ | ||
-v -Wl,--verbose \ | ||
-o $OUT/gst-discoverer \ | ||
$PREDEPS_LDFLAGS \ | ||
$SRC/gst-discoverer.o \ | ||
$PLUGINS \ | ||
$BUILD_LDFLAGS \ | ||
$LIB_FUZZING_ENGINE \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm confused. Why do you link $OUT/gst-discoverer here and gst-discoverer above? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the linking phase. The phase above is the compilation phase (C compilation vs C++ linking) |
||
-Wl,-Bdynamic | ||
|
||
echo | ||
echo ">>>> Downloading OGG corpus" | ||
echo | ||
|
||
cd $OUT | ||
wget -nd https://people.freedesktop.org/~bilboed/gst-discoverer_seed_corpus.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is better be done in Dockerfile There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Downloading the corpus ? Or putting it in $OUT/ ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, fixing it |
||
|
||
cp $LIB_FUZZING_ENGINE /work/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. whoops, leftover testing, will remove |
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case, add a new line at EOF