#!/bin/sh prefix=gst templatedir=element-templates while [ "$1" ] ; do case $1 in --help) cat <<-EOF Usage: gst-project-maker [OPTIONS] PROJECT_NAME Create an autotools project based on GStreamer from a template. Options: --help Print this information --prefix PREFIX Use PREFIX instead of "gst" Example: 'gst-project-maker my_project' will create the project gst-my-project. EOF exit 0 ;; --prefix) shift prefix=$1 ;; -*) echo Unknown option: $1 exit 1 ;; *) if [ "$name" = "" ]; then name=$1 else echo Ignored: $1 fi esac shift done if [ "$name" = "" ] ; then echo "Usage: gst-project-maker [OPTIONS] PROJECT_NAME" exit 1 fi PREFIX=$(echo $prefix | sed -e 's/\(.*\)/\U\1/') NAME=$(echo $name | sed -e 's/\(.*\)/\U\1/') Prefix=$(echo $prefix | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/') Name=$(echo $name | sed -e 's/_\(.\)/\U\1/g' -e 's/^\(.\)/\U\1/') if [ "$prefix" != "gst" ] ; then cmdline_prefix="--prefix $prefix" else cmdline_prefix="" fi GST_IS_REPLACE=${PREFIX}_IS_${NAME} GST_REPLACE=${PREFIX}_${NAME} GST_TYPE_REPLACE=${PREFIX}_TYPE_${NAME} GstReplace=${Prefix}${Name} gst_replace=${prefix}_${name} gst__replace=${prefix}-${name} gstreplace=${prefix}$(echo $name | sed -e 's/_//g') replace=$(echo $name | sed -e 's/_//g') if [ "$REAL_NAME" = "" ] ; then REAL_NAME=FIXME fi if [ "$EMAIL_ADDRESS" = "" ] ; then EMAIL_ADDRESS=fixme@example.com fi basedir=`pwd`/$gst__replace rm -rf $basedir mkdir $basedir cat >$basedir/AUTHORS < EOF cat >$basedir/COPYING <$basedir/ChangeLog <$basedir/NEWS <$basedir/README <$basedir/meson.build <= 0.53.0 fs = import('fs') if fs.is_samepath(get_option('prefix'), '~') plugins_install_dir = '@0@/.local/share/gstreamer-1.0/plugins'.format(get_option('prefix')) else plugins_install_dir = '@0@/gstreamer-1.0'.format(get_option('libdir')) endif plugin_deps = [gst_dep, gst_base_dep] tool_deps = [gst_dep] subdir('plugins') subdir('tools') EOF mkdir -p $basedir/plugins cat >$basedir/plugins/meson.build < * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * * Alternatively, the contents of this file may be used under the * GNU Lesser General Public License Version 2.1 (the "LGPL"), in * which case the following provisions apply instead of the ones * mentioned above: * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include #endif #include #include "gstreplace.h" static gboolean plugin_init (GstPlugin * plugin) { gst_element_register (plugin, "replace", GST_RANK_NONE, GST_TYPE_REPLACE); return TRUE; } GST_PLUGIN_DEFINE ( GST_VERSION_MAJOR, GST_VERSION_MINOR, replace, "FIXME Template plugin", plugin_init, VERSION, "LGPL", /* FIXME */ "GStreamer", "http://gstreamer.net/" ) EOF } generate | sed \ -e "s/GST_BASE_REPLACE/$GST_BASE_REPLACE/g" \ -e "s/GST_TYPE_BASE_REPLACE/$GST_TYPE_BASE_REPLACE/g" \ -e "s/GstBaseReplace/$GstBaseReplace/g" \ -e "s/GST_IS_REPLACE/$GST_IS_REPLACE/g" \ -e "s/GST_REPLACE/$GST_REPLACE/g" \ -e "s/GST_TYPE_REPLACE/$GST_TYPE_REPLACE/g" \ -e "s/GstReplace/$GstReplace/g" \ -e "s/gst_replace/$gst_replace/g" \ -e "s/gstreplace/$gstreplace/g" \ -e "s/replace/$replace/g" >$basedir/plugins/${gstreplace}plugin.c gst-indent $basedir/plugins/${gstreplace}plugin.c || echo "Warning: could not run gst-indent on the generated code." 1>&2 rm -f $basedir/plugins/${gstreplace}plugin.c~ cat >$basedir/plugins/${gstreplace}.c <$basedir/plugins/${gstreplace}.h <$basedir/tools/meson.build <$basedir/tools/${gstreplace}.c < int main (void) { printf ("FIXME\n"); return 0; } EOF