5 templatedir=element-templates
11 Usage: gst-project-maker [OPTIONS] PROJECT_NAME
12 Create an autotools project based on GStreamer from a template.
14 --help Print this information
15 --prefix PREFIX Use PREFIX instead of "gst"
16 Example: 'gst-project-maker my_project' will create the project gst-my-project.
25 echo Unknown option: $1
29 if [ "$name" = "" ]; then
38 if [ "$name" = "" ] ; then
39 echo "Usage: gst-project-maker [OPTIONS] PROJECT_NAME"
44 PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/')
45 NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/')
46 Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
47 Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/')
49 if [ "$prefix" != "gst" ] ; then
50 cmdline_prefix="--prefix $prefix"
55 GST_IS_REPLACE=${PREFIX}_IS_${NAME}
56 GST_REPLACE=${PREFIX}_${NAME}
57 GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME}
58 GstReplace=${Prefix}${Name}
59 gst_replace=${prefix}_${name}
60 gst__replace=${prefix}-${name}
61 gstreplace=${prefix}$(echo $name | sed -e 's/_//g')
62 replace=$(echo $name | sed -e 's/_//g')
64 if [ "$REAL_NAME" = "" ] ; then
67 if [ "$EMAIL_ADDRESS" = "" ] ; then
68 EMAIL_ADDRESS=fixme@example.com
73 basedir=`pwd`/$gst__replace
78 cat >$basedir/AUTHORS <<EOF
79 $REAL_NAME <$EMAIL_ADDRESS>
82 cat >$basedir/COPYING <<EOF
83 Put your license here.
86 cat >$basedir/ChangeLog <<EOF
87 Put your changelog here.
90 cat >$basedir/NEWS <<EOF
91 News about your project.
94 cat >$basedir/README <<EOF
95 README for your project.
98 cat >$basedir/autogen.sh <<EOF
100 # you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE,
101 # ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them
102 # unset and get the defaults
104 autoreconf --verbose --force --install --make || {
105 echo 'autogen.sh failed';
110 echo 'configure failed';
115 echo "Now type 'make' to compile this module."
118 chmod 755 $basedir/autogen.sh
120 cat >$basedir/configure.ac <<EOF
121 dnl required version of autoconf
124 dnl TODO: fill in your package name and package version here
125 AC_INIT([${gst__replace}],[1.0.0])
127 dnl required versions of gstreamer and plugins-base
131 AC_CONFIG_SRCDIR([plugins/${gstreplace}.c])
132 AC_CONFIG_HEADERS([config.h])
134 dnl required version of automake
135 AM_INIT_AUTOMAKE([1.10])
136 AC_CONFIG_MACRO_DIR([m4])
138 dnl enable mainainer mode by default
139 AM_MAINTAINER_MODE([enable])
141 dnl check for tools (compiler etc.)
145 dnl required version of libtool
149 dnl give error and exit if we don't have pkgconfig
150 AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [ ], [
151 AC_MSG_ERROR([You need to have pkg-config installed!])
154 dnl Check for the required version of GStreamer core (and gst-plugins-base)
155 dnl This will export GST_CFLAGS and GST_LIBS variables for use in Makefile.am
157 dnl If you need libraries from gst-plugins-base here, also add:
158 dnl for libgstaudio-1.0: gstreamer-audio-1.0 >= \$GST_REQUIRED
159 dnl for libgstvideo-1.0: gstreamer-video-1.0 >= \$GST_REQUIRED
160 dnl for libgsttag-1.0: gstreamer-tag-1.0 >= \$GST_REQUIRED
161 dnl for libgstpbutils-1.0: gstreamer-pbutils-1.0 >= \$GST_REQUIRED
162 dnl for libgstfft-1.0: gstreamer-fft-1.0 >= \$GST_REQUIRED
163 dnl for libgstinterfaces-1.0: gstreamer-interfaces-1.0 >= \$GST_REQUIRED
164 dnl for libgstrtp-1.0: gstreamer-rtp-1.0 >= \$GST_REQUIRED
165 dnl for libgstrtsp-1.0: gstreamer-rtsp-1.0 >= \$GST_REQUIRED
167 PKG_CHECK_MODULES(GST, [
168 gstreamer-1.0 >= \$GST_REQUIRED
169 gstreamer-base-1.0 >= \$GST_REQUIRED
170 gstreamer-controller-1.0 >= \$GST_REQUIRED
176 You need to install or upgrade the GStreamer development
177 packages on your system. On debian-based systems these are
178 libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev.
179 on RPM-based systems gstreamer1.0-devel, libgstreamer1.0-devel
180 or similar. The minimum version required is \$GST_REQUIRED.
184 dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS)
185 AC_MSG_CHECKING([to see if compiler understands -Wall])
186 save_CFLAGS="\$CFLAGS"
187 CFLAGS="\$CFLAGS -Wall"
188 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [
189 GST_CFLAGS="\$GST_CFLAGS -Wall"
195 dnl set the plugindir where plugins should be installed (for plugins/Makefile.am)
196 if test "x\${prefix}" = "x\$HOME"; then
197 plugindir="\$HOME/.gstreamer-1.0/plugins"
199 plugindir="\\\$(libdir)/gstreamer-1.0"
203 dnl set proper LDFLAGS for plugins
204 GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
205 AC_SUBST(GST_PLUGIN_LDFLAGS)
207 AC_CONFIG_FILES([Makefile plugins/Makefile tools/Makefile])
211 cat >$basedir/Makefile.am <<EOF
212 SUBDIRS = plugins tools
214 EXTRA_DIST = autogen.sh
216 ACLOCAL_AMFLAGS = -I m4
221 mkdir -p $basedir/plugins
223 cat >$basedir/plugins/Makefile.am <<EOF
224 plugin_LTLIBRARIES = lib$gstreplace.la
226 # sources used to compile this plug-in
227 lib${gstreplace}_la_SOURCES = ${gstreplace}plugin.c ${gstreplace}.c ${gstreplace}.h
229 # compiler and linker flags used to compile this plugin, set in configure.ac
230 lib${gstreplace}_la_CFLAGS = \$(GST_CFLAGS)
231 lib${gstreplace}_la_LIBADD = \$(GST_LIBS)
232 lib${gstreplace}_la_LDFLAGS = \$(GST_PLUGIN_LDFLAGS)
233 lib${gstreplace}_la_LIBTOOLFLAGS = --tag=disable-static
243 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
245 * Permission is hereby granted, free of charge, to any person obtaining a
246 * copy of this software and associated documentation files (the "Software"),
247 * to deal in the Software without restriction, including without limitation
248 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
249 * and/or sell copies of the Software, and to permit persons to whom the
250 * Software is furnished to do so, subject to the following conditions:
252 * The above copyright notice and this permission notice shall be included in
253 * all copies or substantial portions of the Software.
255 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
256 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
257 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
258 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
259 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
260 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
261 * DEALINGS IN THE SOFTWARE.
263 * Alternatively, the contents of this file may be used under the
264 * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
265 * which case the following provisions apply instead of the ones
268 * This library is free software; you can redistribute it and/or
269 * modify it under the terms of the GNU Library General Public
270 * License as published by the Free Software Foundation; either
271 * version 2 of the License, or (at your option) any later version.
273 * This library is distributed in the hope that it will be useful,
274 * but WITHOUT ANY WARRANTY; without even the implied warranty of
275 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
276 * Library General Public License for more details.
278 * You should have received a copy of the GNU Library General Public
279 * License along with this library; if not, write to the
280 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
281 * Boston, MA 02110-1301, USA.
289 #include "gstreplace.h"
292 plugin_init (GstPlugin * plugin)
294 gst_element_register (plugin, "replace", GST_RANK_NONE,
304 "FIXME Template plugin",
309 "http://gstreamer.net/"
316 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
317 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
318 -e "s/GstBaseReplace/$GstBaseReplace/g" \
319 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
320 -e "s/GST_REPLACE/$GST_REPLACE/g" \
321 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
322 -e "s/GstReplace/$GstReplace/g" \
323 -e "s/gst_replace/$gst_replace/g" \
324 -e "s/gstreplace/$gstreplace/g" \
325 -e "s/replace/$replace/g" >$basedir/plugins/${gstreplace}plugin.c
327 gst-indent $basedir/plugins/${gstreplace}plugin.c
328 rm -f $basedir/plugins/${gstreplace}plugin.c~
330 cat >$basedir/plugins/${gstreplace}.c <<EOF
331 /* This file should be replaced by element source generated by
332 * gst-element-maker, or by your own source code. To generate suitable
333 * element source using gst-element-maker, run:
335 * gst-element-maker $cmdline_prefix $replace BASE_CLASS
337 * Where BASE_CLASS is replaced by one of the base class templates,
338 * such as basesrc, basetransform, audiofilter, videofilter2, etc.
339 * Then copy the resulting $gstreplace.c file over this file, and
340 * $gstreplace.h over $gstreplace.h.
342 /* The rest of this file is shim code to allow the project to compile */
345 cat >$basedir/plugins/${gstreplace}.h <<EOF
346 /* This file should be replaced by element header generated by
347 * gst-element-maker, or by your own source code. To generate suitable
348 * element header using gst-element-maker, run:
350 * gst-element-maker $cmdline_prefix $replace BASE_CLASS
352 * Where BASE_CLASS is replaced by one of the base class templates,
353 * such as basesrc, basetransform, audiofilter, videofilter2, etc.
354 * Then copy the resulting $gstreplace.h file over this file, and
355 * $gstreplace.c over $gstreplace.c.
357 /* The rest of this file is shim code to allow the project to compile */
358 #define ${GST_TYPE_REPLACE} G_TYPE_NONE
362 mkdir -p $basedir/tools
364 cat >$basedir/tools/Makefile.am <<EOF
365 bin_PROGRAMS = ${gst__replace}
367 # sources used to compile this plug-in
368 ${gst_replace}_SOURCES = ${gstreplace}.c
370 # compiler and linker flags used to compile the program, set in configure.ac
371 ${gst_replace}_CFLAGS = \$(GST_CFLAGS)
372 ${gst_replace}_LDADD = \$(GST_LIBS)
376 cat >$basedir/tools/${gstreplace}.c <<EOF
377 /* This file should be replaced by application source generated by
378 * gst-app-maker, or by your own source code. To generate suitable
379 * app source using gst-app-maker, run:
381 * gst-app-maker $cmdline_prefix $replace
383 * Then copy the resulting $gstreplace.c file over this file.
385 /* The rest of this file is shim code to allow the project to compile */
387 int main (void) { printf ("FIXME\n"); return 0; }