2018-06-28 08:06:56 +00:00
|
|
|
#!/usr/bin/env bash
|
2009-02-11 18:16:09 +00:00
|
|
|
#
|
|
|
|
# ReactOS Build Environment for Unix-based Operating Systems - Packaging tool for the Base package
|
2019-10-20 10:35:11 +00:00
|
|
|
# Copyright 2009-2019 Colin Finck <colin@reactos.org>
|
2009-02-11 18:16:09 +00:00
|
|
|
#
|
|
|
|
# Released under GNU GPL v2 or any later version.
|
|
|
|
|
|
|
|
#
|
|
|
|
# Functions
|
|
|
|
#
|
|
|
|
check_file()
|
|
|
|
{
|
2020-06-11 14:26:22 +00:00
|
|
|
if [[ ! -f "$1" ]]; then
|
2009-02-11 18:16:09 +00:00
|
|
|
echo "File \"$1\" is required, but does not exist!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# The real entry point
|
|
|
|
cd `dirname $0`
|
|
|
|
|
|
|
|
#
|
|
|
|
# Prerequisites
|
|
|
|
#
|
|
|
|
# Check the parameters
|
2020-06-11 14:26:22 +00:00
|
|
|
if [[ "$2" = "" ]]; then
|
2009-02-11 18:16:09 +00:00
|
|
|
echo "makepackage - Package a RosBE-Unix version"
|
|
|
|
echo "Syntax: ./makepackage.sh <package> <version>"
|
|
|
|
echo
|
|
|
|
echo " package - Package name (i.e. \"Base-i386\")"
|
|
|
|
echo " version - Version number of the Build Environment to package (i.e. \"1.4\")"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
package_name="$1"
|
|
|
|
package_version="$2"
|
|
|
|
|
|
|
|
# Set the full package name
|
2020-06-11 14:26:22 +00:00
|
|
|
full_package_name="RosBE-Unix"
|
2009-02-11 18:16:09 +00:00
|
|
|
|
|
|
|
case "$package_name" in
|
|
|
|
"Base-i386")
|
|
|
|
# Add no suffix
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
# Add the package name as the suffix
|
|
|
|
full_package_name+="-$package_name"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-06-11 14:26:22 +00:00
|
|
|
full_package_name+="-$package_version"
|
|
|
|
full_package_file="$full_package_name.tar.bz2"
|
|
|
|
|
2009-02-11 18:16:09 +00:00
|
|
|
# Check if the required directory structure exists
|
2018-06-28 16:54:47 +00:00
|
|
|
if ! git status >& /dev/null; then
|
2019-12-24 16:45:38 +00:00
|
|
|
echo "This script needs to be run in a working copy of the \"RosBE\" repository!"
|
2009-02-11 18:16:09 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Build the source file list
|
|
|
|
sources="binutils gcc "
|
|
|
|
tools=""
|
|
|
|
|
|
|
|
case "$package_name" in
|
|
|
|
"Base-i386")
|
2019-12-24 16:45:38 +00:00
|
|
|
sources+="bison cmake flex gmp mingw_w64 mpc mpfr ninja"
|
2011-12-05 21:40:23 +00:00
|
|
|
tools+="cpucount scut"
|
2009-02-11 18:16:09 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
# Check if all required files exist
|
|
|
|
for source in $sources; do
|
|
|
|
check_file "$package_name/sources/$source.tar.bz2"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Check if all required tools exist
|
|
|
|
for tool in $tools; do
|
|
|
|
check_file "../Tools/$tool.c"
|
2014-02-12 21:26:24 +00:00
|
|
|
done
|
2009-02-11 18:16:09 +00:00
|
|
|
|
|
|
|
# Check if other needed files exist
|
|
|
|
check_file "$package_name/README.pdf"
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# The Process
|
|
|
|
#
|
2009-11-03 21:40:22 +00:00
|
|
|
# Copy the directory and delete some stuff
|
2009-02-14 18:22:46 +00:00
|
|
|
echo "Copying the \"$package_name\" directory..."
|
|
|
|
rm -rf "$full_package_name"
|
2009-02-11 18:16:09 +00:00
|
|
|
cp -R "$package_name" "$full_package_name"
|
|
|
|
|
2018-06-28 16:54:47 +00:00
|
|
|
find "$full_package_name" -type d -name ".git" -exec rm -rf {} ";" >& /dev/null
|
2009-11-03 21:40:22 +00:00
|
|
|
find "$full_package_name" -type f -name "SVN-Readme.txt" -exec rm {} ";"
|
2009-02-11 18:16:09 +00:00
|
|
|
rm "$full_package_name/README.odt"
|
|
|
|
|
|
|
|
# Copy the shared tools
|
2020-05-25 18:09:44 +00:00
|
|
|
mkdir -p "$full_package_name/tools"
|
2009-02-11 18:16:09 +00:00
|
|
|
for tool in $tools; do
|
|
|
|
echo "Copying $tool.c..."
|
|
|
|
cp "../Tools/$tool.c" "$full_package_name/tools/$tool.c"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Finally create a package out of this
|
|
|
|
echo "Creating the package..."
|
2020-06-11 14:26:22 +00:00
|
|
|
tar cjf "$full_package_file" "$full_package_name"
|
2009-02-11 18:16:09 +00:00
|
|
|
|
|
|
|
echo
|
|
|
|
echo "Done!"
|