[libdvbpsi-devel] update gen_dr_h.sh to use the new header file tree
Daniel Kamil Kozar
git at videolan.org
Mon Jan 11 09:43:18 CET 2016
libdvbpsi | branch: master | Daniel Kamil Kozar <dkk089 at gmail.com> | Thu Oct 8 21:57:20 2015 +0200| [24f030afe19557c7e6a19afe31eb3c2c471c982c] | committer: Daniel Kamil Kozar
update gen_dr_h.sh to use the new header file tree
> http://git.videolan.org/gitweb.cgi/libdvbpsi.git/?a=commit;h=24f030afe19557c7e6a19afe31eb3c2c471c982c
---
misc/gen_dr_h.sh | 103 ++++++++++++++++++++++++++++--------------------------
1 file changed, 54 insertions(+), 49 deletions(-)
diff --git a/misc/gen_dr_h.sh b/misc/gen_dr_h.sh
index cdab6b5..a23f05e 100755
--- a/misc/gen_dr_h.sh
+++ b/misc/gen_dr_h.sh
@@ -1,61 +1,66 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
# Use as: $0 > src/descriptors/dr.h
#
-dr_h="src/descriptors/dr.h"
-dr=`ls src/descriptors/*.h`
+readonly DR_H="src/descriptors/dr.h"
+readonly DR_H_DIR=${DR_H%/*} # Bash's internal dirname equivalent
# check directory
-if ! test -d `dirname $dr_h`; then
- echo "Directory `dirname $dr_h` does not exist!!."
- echo "Are you sure to be in the libdvbpsi top directory?"
+if [[ ! -d $DR_H_DIR ]]; then
+ echo >&2 "Directory $DR_H_DIR does not exist!!."
+ echo >&2 "Please run this script in the libdvbpsi top directory."
exit 1;
fi
-echo "/*****************************************************************************"
-echo " * dr.h"
-echo " * Copyright (C) 2001-2010 VideoLAN"
-echo " *"
-echo " * Authors: Arnaud de Bossoreille de Ribou <bozo at via.ecp.fr>"
-echo " *"
-echo " * This library is free software; you can redistribute it and/or"
-echo " * modify it under the terms of the GNU Lesser General Public"
-echo " * License as published by the Free Software Foundation; either"
-echo " * version 2.1 of the License, or (at your option) any later version."
-echo " *"
-echo " * This library is distributed in the hope that it will be useful,"
-echo " * but WITHOUT ANY WARRANTY; without even the implied warranty of"
-echo " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU"
-echo " * Lesser General Public License for more details."
-echo " *"
-echo " * You should have received a copy of the GNU Lesser General Public"
-echo " * License along with this library; if not, write to the Free Software"
-echo " * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA"
-echo " *"
-echo " *****************************************************************************/"
-echo ""
-echo "/*!"
-echo " * \file <dr.h>"
-echo " * \author Arnaud de Bossoreille de Ribou <bozo at via.ecp.fr>"
-echo " * \brief Gather all dr_*.h into one."
-echo " *"
-echo " * Gathers all dr_*.h into one. Use this header if you need a lot of them."
-echo " */"
-echo ""
-echo "#ifndef _DVBPSI_DR_H_"
-echo "#define _DVBPSI_DR_H_"
-echo ""
-
-for h in $dr; do
- f=`basename $h`
- if ! test "$f" = "dr.h"; then
- echo "#include \"$f\""
- fi
+cat <<EOF
+/*****************************************************************************
+ * dr.h
+ * Copyright (C) 2001-2010 VideoLAN
+ *
+ * Authors: Arnaud de Bossoreille de Ribou <bozo at via.ecp.fr>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ *****************************************************************************/
+
+/*!
+ * \file <dr.h>
+ * \author Arnaud de Bossoreille de Ribou <bozo at via.ecp.fr>
+ * \brief Gather all dr_*.h into one.
+ *
+ * Gathers all dr_*.h into one. Use this header if you need a lot of them.
+ */
+
+#ifndef _DVBPSI_DR_H_
+#define _DVBPSI_DR_H_
+EOF
+
+cd $DR_H_DIR
+for dir in atsc dvb mpeg custom; do
+ cd $dir || { echo >&2 "$dir not found - tree incomplete" && exit 1; }
+ for h in *.h; do
+ echo "#include \"$dir/$h\""
+ done
+ cd ..
done
-echo ""
-echo "#else"
-echo "#error \"Multiple inclusions of dr.h\""
-echo "#endif"
+cat <<EOF
+
+#else
+#error "Multiple inclusions of dr.h"
+#endif
+EOF
exit 0
More information about the libdvbpsi-devel
mailing list