commit f85d480f6c717949a417b54148ee71bc11d0b8b0
parent dbe3d97fc20131d11b80279a41d993f3266b21a3
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 5 Sep 2018 11:06:51 +0200
Add a bash script that packages the sources of the post-process tools
Diffstat:
| A | pkg.sh | | | 79 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
1 file changed, 79 insertions(+), 0 deletions(-)
diff --git a/pkg.sh b/pkg.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+#
+# Copyright (C) 2017-2018 |Meso|Star>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+if [ $# -lt 2 ]; then
+ echo "Usage: $0 SOLSTICE-PP-PATH VERSION"
+ exit 1
+fi
+
+solpp=$1
+version=$2
+
+
+if [ ! -d $solpp \
+ -o ! -f $solpp/Makefile \
+ -o ! -f $solpp/Makefile.in ]; then
+ echo "Invalid SOLSTICE-PP-PATH \"$1\""
+ exit 1
+fi
+
+dir_curr=$(pwd) # Current directory
+dir_temp=$(mktemp -d) # Working directory
+dir_solpp=Solstice-PP-Sources-$version
+
+# Create the pkg directory
+mkdir $dir_temp/$dir_solpp
+
+# Define the solpp sources
+src=$(cd $solpp; find -maxdepth 1 -name "*.c" -o -name "*.h" | sed 's/\.\///g')
+
+# Copy the sources and the COPYING file into the pkg directory
+cp $solpp/COPYING $dir_temp/$dir_solpp
+for i in $src; do
+ cp $solpp/$i $dir_temp/$dir_solpp
+done
+
+# Generate the Makefile
+{
+ echo "# Copying and distribution of this file, with or without modification,"
+ echo "# are permitted in any medium without royalty provided the copyright"
+ echo "# notice and this notice are preserved. This file is offered as-is,"
+ echo "# without any warranty."
+ echo ""
+ cat $solpp/Makefile.in | sed -n '/^CFLAGS/p'
+ echo "SOURCES = $(echo $src | sed 's/[ \t]*[a-z0-9]\+\.h//g')"
+ echo 'PROG = $(SOURCES:%.c=%)'
+ echo ""
+ echo '.PHONY: default all clean'
+ echo 'default: $(PROG)'
+ echo ""
+ echo '$(PROG): %: %.c solpp.h'
+ echo -e '\t@echo -e "CC $<"; $(CC) -o $@ $(CFLAGS) $<'
+ echo ""
+ echo 'clean:'
+ echo -e '\t@rm $(PROG)'
+} > $dir_temp/$dir_solpp/Makefile
+
+#Make the package
+cd $dir_temp
+tar czf ${dir_solpp}.tar.gz $dir_solpp
+cp ${dir_solpp}.tar.gz $dir_curr
+
+echo "${dir_solpp}.tar.gz"
+