5 templatedir=element-templates
11 Usage: $(basename "$0") [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: '$(basename "$0") 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: $(basename "$0") [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 plugins can be installed locally by using "\$HOME" as prefix:
100 $ meson --prefix="\$HOME" build/
101 $ ninja -C build/ install
103 However be advised that the automatic scan of plugins in the user home
104 directory won't work under gst-build devenv.
107 cat >$basedir/meson.build <<EOF
108 project('${gst__replace}', 'c',
110 default_options : [ 'warning_level=1',
111 'buildtype=debugoptimized' ])
113 core_conf = configuration_data()
114 core_conf.set('PACKAGE', '"@0@"'.format(meson.project_name()))
115 core_conf.set('VERSION', '"@0@"'.format(meson.project_version()))
117 configure_file(output : 'config.h', configuration : core_conf)
119 configinc = include_directories('.')
121 common_args = ['-DHAVE_CONFIG_H']
125 # Check for the required version of GStreamer core (and gst-plugins-base)
127 # If you need libraries from gst-plugins-base here, also add:
128 # for libgstaudio-1.0: gstreamer-audio-1.0
129 # for libgstvideo-1.0: gstreamer-video-1.0
130 # for libgsttag-1.0: gstreamer-tag-1.0
131 # for libgstpbutils-1.0: gstreamer-pbutils-1.0
132 # for libgstfft-1.0: gstreamer-fft-1.0
133 # for libgstinterfaces-1.0: gstreamer-interfaces-1.0
134 # for libgstrtp-1.0: gstreamer-rtp-1.0
135 # for libgstrtsp-1.0: gstreamer-rtsp-1.0
137 gst_dep = dependency('gstreamer-1.0', version : gst_req,
138 fallback : ['gstreamer', 'gst_dep'])
139 gst_base_dep = dependency('gstreamer-base-1.0', version : gst_req,
140 fallback : ['gstreamer', 'gst_base_dep'])
142 # Set the directory where plugins should be installed.
144 # If the prefix is the user home directory, adjust the plugin installation
145 # path so that GStreamer can find it. Requires meson >= 0.53.0
147 if fs.is_samepath(get_option('prefix'), '~')
148 plugins_install_dir = '@0@/.local/share/gstreamer-1.0/plugins'.format(get_option('prefix'))
150 plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir'))
153 plugin_deps = [gst_dep, gst_base_dep]
154 tool_deps = [gst_dep]
161 mkdir -p $basedir/plugins
163 cat >$basedir/plugins/meson.build <<EOF
164 lib_args = common_args + []
166 # sources used to compile this plug-in
168 '${gstreplace}plugin.c',
173 shlib = shared_library('${gstreplace}',
176 include_directories: [configinc],
177 dependencies : plugin_deps,
178 gnu_symbol_visibility : 'hidden',
180 install_dir : plugins_install_dir,
183 # Make this library usable as a Meson subproject.
184 gst_${replace}_dep = declare_dependency(
185 include_directories: include_directories('.'),
188 pkg_mod = import('pkgconfig')
190 name : '${gst__replace}',
191 filebase : '${gst__replace}',
192 description : 'Meson sample project.',
195 version : '"@0@"'.format(meson.project_version()),
205 * Copyright (C) $(date +%Y) $REAL_NAME <$EMAIL_ADDRESS>
207 * Permission is hereby granted, free of charge, to any person obtaining a
208 * copy of this software and associated documentation files (the "Software"),
209 * to deal in the Software without restriction, including without limitation
210 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
211 * and/or sell copies of the Software, and to permit persons to whom the
212 * Software is furnished to do so, subject to the following conditions:
214 * The above copyright notice and this permission notice shall be included in
215 * all copies or substantial portions of the Software.
217 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
218 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
219 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
220 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
221 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
222 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
223 * DEALINGS IN THE SOFTWARE.
225 * Alternatively, the contents of this file may be used under the
226 * GNU Lesser General Public License Version 2.1 (the "LGPL"), in
227 * which case the following provisions apply instead of the ones
230 * This library is free software; you can redistribute it and/or
231 * modify it under the terms of the GNU Library General Public
232 * License as published by the Free Software Foundation; either
233 * version 2 of the License, or (at your option) any later version.
235 * This library is distributed in the hope that it will be useful,
236 * but WITHOUT ANY WARRANTY; without even the implied warranty of
237 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
238 * Library General Public License for more details.
240 * You should have received a copy of the GNU Library General Public
241 * License along with this library; if not, write to the
242 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
243 * Boston, MA 02110-1301, USA.
251 #include "gstreplace.h"
254 plugin_init (GstPlugin * plugin)
256 gst_element_register (plugin, "replace", GST_RANK_NONE,
266 "FIXME Template plugin",
271 "http://gstreamer.net/"
278 -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \
279 -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \
280 -e "s/GstBaseReplace/$GstBaseReplace/g" \
281 -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \
282 -e "s/GST_REPLACE/$GST_REPLACE/g" \
283 -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \
284 -e "s/GstReplace/$GstReplace/g" \
285 -e "s/gst_replace/$gst_replace/g" \
286 -e "s/gstreplace/$gstreplace/g" \
287 -e "s/replace/$replace/g" >$basedir/plugins/${gstreplace}plugin.c
289 gst-indent $basedir/plugins/${gstreplace}plugin.c || echo "Warning: could not run gst-indent on the generated code." 1>&2
290 rm -f $basedir/plugins/${gstreplace}plugin.c~
292 cat >$basedir/plugins/${gstreplace}.c <<EOF
293 /* This file should be replaced by element source generated by
294 * gst-element-maker, or by your own source code. To generate suitable
295 * element source using gst-element-maker, run:
297 * gst-element-maker $cmdline_prefix $replace BASE_CLASS
299 * Where BASE_CLASS is replaced by one of the base class templates,
300 * such as basesrc, basetransform, audiofilter, videofilter2, etc.
301 * Then copy the resulting $gstreplace.c file over this file, and
302 * $gstreplace.h over $gstreplace.h.
304 /* The rest of this file is shim code to allow the project to compile */
307 cat >$basedir/plugins/${gstreplace}.h <<EOF
308 /* This file should be replaced by element header generated by
309 * gst-element-maker, or by your own source code. To generate suitable
310 * element header using gst-element-maker, run:
312 * gst-element-maker $cmdline_prefix $replace BASE_CLASS
314 * Where BASE_CLASS is replaced by one of the base class templates,
315 * such as basesrc, basetransform, audiofilter, videofilter2, etc.
316 * Then copy the resulting $gstreplace.h file over this file, and
317 * $gstreplace.c over $gstreplace.c.
319 /* The rest of this file is shim code to allow the project to compile */
320 #define ${GST_TYPE_REPLACE} G_TYPE_NONE
324 mkdir -p $basedir/tools
326 cat >$basedir/tools/meson.build <<EOF
327 exe_args = common_args + []
329 # sources used to compile this program
334 executable('${gstreplace}',
338 include_directories: [configinc],
339 dependencies : tool_deps,
343 cat >$basedir/tools/${gstreplace}.c <<EOF
344 /* This file should be replaced by application source generated by
345 * gst-app-maker, or by your own source code. To generate suitable
346 * app source using gst-app-maker, run:
348 * gst-app-maker $cmdline_prefix $replace
350 * Then copy the resulting $gstreplace.c file over this file.
352 /* The rest of this file is shim code to allow the project to compile */
354 int main (void) { printf ("FIXME\n"); return 0; }