mirror of
https://github.com/reactos/RosBE.git
synced 2024-11-23 11:29:44 +00:00
- Bump version to 1.5
- Add a new "setuplibrary.sh" containing many functions from "rosbelibrary.sh". This one can be shared between "buildtoolchain.sh" (RosBE-Windows) and "RosBE-Builder.sh" (RosBE-Unix) to simplify building the toolchain and minimize code differences. - Add an optional installation directory parameter to "RosBE-Builder.sh". If this one is given, the script will perform an unattended installation to the specified directory as long as it does not yet exist. Might be useful if we consider packaging RosBE-Unix into DEB/RPM/... packages in the future. - Remove the update routines for previous versions. 1.5 changed too much stuff, so that a direct update isn't feasible in this version. - Add bash's "local" keyword where appropriate. Besides, the required source packages can now be downloaded from http://svn.reactos.org/RosBE-Sources. You no longer need to retrieve them from released RosBE-Unix versions. svn path=/trunk/tools/RosBE/; revision=1130
This commit is contained in:
parent
8e6d2dd6ad
commit
48b49abb63
@ -1,463 +1,341 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# ReactOS Build Environment for Unix-based Operating Systems - Builder Tool for the Base package
|
||||
# Copyright 2007-2009 Colin Finck <mail@colinfinck.de>
|
||||
# Copyright 2007-2009 Colin Finck <colin@reactos.org>
|
||||
# partially based on the BuildMingwCross script (http://www.mingw.org/MinGWiki/index.php/BuildMingwCross)
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
|
||||
# Constants
|
||||
ROSBE_VERSION="1.4.2"
|
||||
TARGET_ARCH="i386"
|
||||
KNOWN_ROSBE_VERSIONS="0.3.6 1.1 1.4 1.4.2"
|
||||
DEFAULT_INSTALL_DIR="/usr/local/RosBE"
|
||||
NEEDED_TOOLS="bison flex gcc g++ grep makeinfo" # GNU Make has a special check
|
||||
|
||||
# RosBE Setup Variables
|
||||
rs_host_cflags="-pipe -fno-common -O3 -march=pentium3 -mfpmath=sse"
|
||||
rs_needed_tools="bison flex gcc g++ grep makeinfo" # GNU Make has a special check
|
||||
rs_target="mingw32"
|
||||
rs_target_cflags="-pipe -gstabs+ -O3 -march=pentium -mtune=i686"
|
||||
|
||||
# Get the absolute path to the script directory
|
||||
cd `dirname $0`
|
||||
SCRIPTDIR="$PWD"
|
||||
SOURCEDIR="$SCRIPTDIR/sources"
|
||||
rs_scriptdir="$PWD"
|
||||
rs_workdir="$rs_scriptdir/sources"
|
||||
rs_sourcedir="$rs_scriptdir/sources"
|
||||
|
||||
source "$SCRIPTDIR/scripts/rosbelibrary.sh"
|
||||
# RosBE-Unix Constants
|
||||
DEFAULT_INSTALL_DIR="/usr/local/RosBE"
|
||||
KNOWN_ROSBE_VERSIONS="0.3.6 1.1 1.4 1.4.2 1.5"
|
||||
ROSBE_VERSION="1.5"
|
||||
TARGET_ARCH="i386"
|
||||
|
||||
source "$rs_scriptdir/scripts/rosbelibrary.sh"
|
||||
source "$rs_scriptdir/scripts/setuplibrary.sh"
|
||||
|
||||
|
||||
echo "*******************************************************************************"
|
||||
echo "* ReactOS Build Environment for Unix-based Operating Systems *"
|
||||
echo "* Builder Tool for the Base package *"
|
||||
echo "* by Colin Finck <mail@colinfinck.de> *"
|
||||
echo "* Builder Tool for the Base package *"
|
||||
echo "* by Colin Finck <colin@reactos.org> *"
|
||||
echo "* *"
|
||||
echo "* Version $ROSBE_VERSION *"
|
||||
echo "* Version $ROSBE_VERSION *"
|
||||
echo "*******************************************************************************"
|
||||
|
||||
echo
|
||||
echo "This script compiles and installs a complete Build Environment for building ReactOS."
|
||||
echo "This script compiles and installs a complete Build Environment for building"
|
||||
echo "ReactOS."
|
||||
echo
|
||||
|
||||
setup_check_requirements
|
||||
|
||||
# Select the installation directory
|
||||
boldmsg "Installation Directory"
|
||||
|
||||
echo "In which directory do you want to install it?"
|
||||
echo "Enter the path to the directory here or simply press ENTER to install it into the default directory."
|
||||
|
||||
# RosBE-Unix 1.4 switched from /usr/RosBE to /usr/local/RosBE, show a message for the people who might want to update
|
||||
if [ -f "/usr/RosBE/RosBE-Version" ]; then
|
||||
if [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "--help" ]; then
|
||||
echo "Syntax: ./RosBE-Builder.sh [installdir]"
|
||||
echo
|
||||
redmsg "Warning: " "-n"
|
||||
echo "The default installation path /usr/RosBE was changed to /usr/local/RosBE starting with version 1.4."
|
||||
echo "If you want to update a previous installation, enter /usr/RosBE here."
|
||||
echo " installdir - Optional parameter to specify an installation directory. If you"
|
||||
echo " do this, the script will check whether this directory does not"
|
||||
echo " yet exist and in this case, it will perform an unattended"
|
||||
echo " installation to this directory."
|
||||
echo
|
||||
echo "Usually, you just call the script without any parameters and it will guide you"
|
||||
echo "through all possible installation options."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
createdir=false
|
||||
installdir=""
|
||||
check_root
|
||||
rs_check_requirements
|
||||
|
||||
reinstall=false
|
||||
update=false
|
||||
|
||||
while [ "$installdir" = "" ]; do
|
||||
read -p "[$DEFAULT_INSTALL_DIR] " installdir
|
||||
echo
|
||||
# Select the installation directory
|
||||
rs_boldmsg "Installation Directory"
|
||||
|
||||
if [ "$installdir" = "" ]; then
|
||||
installdir=$DEFAULT_INSTALL_DIR
|
||||
fi
|
||||
if [ "$1" = "" ]; then
|
||||
installdir=""
|
||||
|
||||
# Make sure we have the absolute path to the installation directory
|
||||
installdir=`eval echo $installdir`
|
||||
echo "In which directory do you want to install it?"
|
||||
echo "Enter the path to the directory here or simply press ENTER to install it into the default directory."
|
||||
|
||||
# Check if the installation directory already exists
|
||||
if [ -f "$installdir" ]; then
|
||||
echo "The directory \"$installdir\" is a file! Please enter another directory!"
|
||||
while [ "$installdir" = "" ]; do
|
||||
read -p "[$DEFAULT_INSTALL_DIR] " installdir
|
||||
echo
|
||||
installdir=""
|
||||
|
||||
elif [ -d "$installdir" ]; then
|
||||
# Check if the directory is empty
|
||||
if [ ! "`ls $installdir`" = "" ]; then
|
||||
if [ -f "$installdir/RosBE-Version" ]; then
|
||||
# Allow the user to update an already installed RosBE version
|
||||
choice=""
|
||||
installed_version=`cat "$installdir/RosBE-Version"`
|
||||
if [ "$installdir" = "" ]; then
|
||||
installdir=$DEFAULT_INSTALL_DIR
|
||||
fi
|
||||
|
||||
for known_version in $KNOWN_ROSBE_VERSIONS; do
|
||||
if [ "$known_version" = "$installed_version" ]; then
|
||||
if [ "$installed_version" = "$ROSBE_VERSION" ]; then
|
||||
echo "The current version of the Build Environment is already installed in this directory."
|
||||
echo "Please choose one of the following options:"
|
||||
echo
|
||||
echo " (R)einstall all components of the Build Environment"
|
||||
echo " (C)hoose a different installation directory"
|
||||
echo
|
||||
# Make sure we have the absolute path to the installation directory
|
||||
installdir=`eval echo $installdir`
|
||||
|
||||
showchoice "R" "r R c C"
|
||||
else
|
||||
echo "An older version of the Build Environment has been found in this directory."
|
||||
echo "Please choose one of the following options:"
|
||||
echo
|
||||
echo " (U)pdate the existing Build Environment"
|
||||
echo " (R)einstall all components of the Build Environment"
|
||||
echo " (C)hoose a different installation directory"
|
||||
echo
|
||||
# Check if the installation directory already exists
|
||||
if [ -f "$installdir" ]; then
|
||||
echo "The directory \"$installdir\" is a file! Please enter another directory!"
|
||||
echo
|
||||
installdir=""
|
||||
elif [ -d "$installdir" ]; then
|
||||
# Check if the directory is empty
|
||||
if [ ! "`ls $installdir`" = "" ]; then
|
||||
if [ -f "$installdir/RosBE-Version" ]; then
|
||||
# Allow the user to update an already installed RosBE version
|
||||
installed_version=`cat "$installdir/RosBE-Version"`
|
||||
|
||||
showchoice "U" "u U r R c C"
|
||||
for known_version in $KNOWN_ROSBE_VERSIONS; do
|
||||
if [ "$known_version" = "$installed_version" ]; then
|
||||
if [ "$installed_version" = "$ROSBE_VERSION" ]; then
|
||||
echo "The current version of the Build Environment is already installed in this directory."
|
||||
echo "Please choose one of the following options:"
|
||||
echo
|
||||
echo " (R)einstall all components of the Build Environment"
|
||||
echo " (C)hoose a different installation directory"
|
||||
echo
|
||||
|
||||
rs_showchoice "R" "r R c C"
|
||||
else
|
||||
echo "An older version of the Build Environment has been found in this directory."
|
||||
echo "Please choose one of the following options:"
|
||||
echo
|
||||
echo " (U)pdate/(r)einstall the Build Environment"
|
||||
echo " (C)hoose a different installation directory"
|
||||
echo
|
||||
|
||||
rs_showchoice "U" "u U r R c C"
|
||||
fi
|
||||
|
||||
echo
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
echo
|
||||
break
|
||||
fi
|
||||
done
|
||||
case "$choice" in
|
||||
"U"|"u")
|
||||
# We don't support update in this version due to lots of changes
|
||||
# To reenable updating, change this to "update=true"
|
||||
reinstall=true
|
||||
;;
|
||||
"R"|"r")
|
||||
reinstall=true
|
||||
;;
|
||||
"C"|"c")
|
||||
echo "Please enter another directory!"
|
||||
installdir=""
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "The directory \"$installdir\" is not empty. Do you really want to continue? (yes/no)"
|
||||
read -p "[no] " answer
|
||||
echo
|
||||
|
||||
case "$choice" in
|
||||
"U"|"u")
|
||||
update=true
|
||||
;;
|
||||
"R"|"r")
|
||||
reinstall=true
|
||||
;;
|
||||
"C"|"c")
|
||||
if [ "$answer" != "yes" ]; then
|
||||
echo "Please enter another directory!"
|
||||
installdir=""
|
||||
;;
|
||||
esac
|
||||
else
|
||||
echo "The directory \"$installdir\" is not empty. Do you really want to continue? (yes/no)"
|
||||
read -p "[no] " answer
|
||||
echo
|
||||
|
||||
if [ "$answer" != "yes" ]; then
|
||||
echo "Please enter another directory!"
|
||||
installdir=""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
createdir=true
|
||||
echo "The directory \"$installdir\" does not exist. The installation script will create it for you."
|
||||
echo
|
||||
fi
|
||||
done
|
||||
|
||||
# Ready to start
|
||||
boldmsg "Ready to start"
|
||||
|
||||
echo "Ready to build and install the ReactOS Build Environment."
|
||||
echo "Press any key to continue or Ctrl+C to exit."
|
||||
read
|
||||
|
||||
if $update; then
|
||||
setvalues=false
|
||||
|
||||
process_cpucount=false
|
||||
process_mingwruntime=false
|
||||
process_w32api=false
|
||||
process_binutils=false
|
||||
process_gcc=false
|
||||
process_make=false
|
||||
process_nasm=false
|
||||
process_buildtime=false
|
||||
process_scut=false
|
||||
process_getincludes=false
|
||||
|
||||
# Logic behind this update part:
|
||||
# - KNOWN_ROSBE_VERSIONS contains all versions from the oldest to the newest one (in this order!)
|
||||
# - setvalues will be set to true, when the iterator reaches the installed version
|
||||
# - Then the processing settings of the installed and the later versions will be applied.
|
||||
# (i.e. if gcc changed from 0.3.7 to 0.3.8, but not from 0.3.6 to 0.3.7, the gcc build will correctly be reprocessed
|
||||
# if the user has an installed RosBE 0.3.6 and wants to update to 0.3.8)
|
||||
for known_version in $KNOWN_ROSBE_VERSIONS; do
|
||||
if [ "$known_version" = "$installed_version" ]; then
|
||||
setvalues=true
|
||||
fi
|
||||
|
||||
if $setvalues; then
|
||||
case "$known_version" in
|
||||
"0.3.6")
|
||||
# Updated components from 0.3.6 to 1.1
|
||||
process_cpucount=true
|
||||
process_mingwruntime=true
|
||||
process_w32api=true
|
||||
process_binutils=true
|
||||
process_gcc=true
|
||||
process_make=true
|
||||
process_nasm=true
|
||||
process_scut=true
|
||||
;;
|
||||
|
||||
"1.1")
|
||||
# Updated components from 1.1 to 1.4
|
||||
process_binutils=true
|
||||
process_nasm=true
|
||||
|
||||
# Reorganize the existing files
|
||||
mkdir -p "$installdir/$TARGET_ARCH/bin"
|
||||
mv "$installdir/bin/mingw32-"* "$installdir/$TARGET_ARCH/bin"
|
||||
mv "$installdir/$TARGET_ARCH/bin/mingw32-make" "$installdir/bin/make"
|
||||
mv "$installdir/bin/nasm" "$installdir/$TARGET_ARCH/bin/nasm"
|
||||
mv "$installdir/bin/ndisasm" "$installdir/$TARGET_ARCH/bin/ndisasm"
|
||||
mv "$installdir/include" "$installdir/$TARGET_ARCH/include"
|
||||
mv "$installdir/lib" "$installdir/$TARGET_ARCH/lib"
|
||||
mv "$installdir/libexec" "$installdir/$TARGET_ARCH/libexec"
|
||||
mv "$installdir/mingw32" "$installdir/$TARGET_ARCH/mingw32"
|
||||
;;
|
||||
|
||||
"1.4")
|
||||
# Updated components from 1.4 to 1.4.2
|
||||
process_getincludes=true
|
||||
esac
|
||||
else
|
||||
echo "The directory \"$installdir\" does not exist. The installation script will create it for you."
|
||||
echo
|
||||
fi
|
||||
done
|
||||
else
|
||||
process_cpucount=true
|
||||
process_mingwruntime=true
|
||||
process_w32api=true
|
||||
process_binutils=true
|
||||
process_gcc=true
|
||||
process_make=true
|
||||
process_nasm=true
|
||||
process_buildtime=true
|
||||
process_scut=true
|
||||
process_getincludes=true
|
||||
|
||||
# Delete the contents of the current installation directory if we're reinstalling
|
||||
if $reinstall; then
|
||||
rm -rf "$installdir/"*
|
||||
# Ready to start
|
||||
rs_boldmsg "Ready to start"
|
||||
|
||||
echo "Ready to build and install the ReactOS Build Environment."
|
||||
echo "Press any key to continue or Ctrl+C to exit."
|
||||
read
|
||||
else
|
||||
installdir=`eval echo $1`
|
||||
|
||||
if [ -e "$installdir" ]; then
|
||||
rs_redmsg "Installation directory \"$installdir\" already exists, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Create the directory if necessary
|
||||
if $createdir; then
|
||||
if ! mkdir -p "$installdir"; then
|
||||
redmsg "Could not create \"$installdir\", aborted!"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using \"$installdir\""
|
||||
echo
|
||||
fi
|
||||
|
||||
if $update; then
|
||||
# No update supported for RosBE-Unix 1.5 due to lots of changes.
|
||||
# Add this part back from older versions once we need to update again.
|
||||
exit 1
|
||||
else
|
||||
rs_process_binutils=true
|
||||
rs_process_buildtime=true
|
||||
rs_process_cpucount=true
|
||||
rs_process_gcc=true
|
||||
rs_process_getincludes=true
|
||||
rs_process_gmp=true
|
||||
rs_process_make=true
|
||||
rs_process_mingw_runtime_dev=true
|
||||
rs_process_mpfr=true
|
||||
rs_process_nasm=true
|
||||
rs_process_scut=true
|
||||
rs_process_w32api=true
|
||||
|
||||
if $reinstall; then
|
||||
# Empty the directory if we're reinstalling
|
||||
rs_mkdir_empty "$installdir"
|
||||
else
|
||||
# Otherwise just create the directory if it does not exist
|
||||
rs_mkdir_if_not_exists "$installdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test if the installation directory is writeable
|
||||
# Test if the installation directory is writable
|
||||
if [ ! -w "$installdir" ]; then
|
||||
redmsg "Installation directory \"$installdir\" is not writeable, aborted!"
|
||||
rs_redmsg "Installation directory \"$installdir\" is not writable, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Build the tools
|
||||
#
|
||||
boldmsg "Building..."
|
||||
mkdir "$installdir/bin" >& /dev/null
|
||||
mkdir -p "$installdir/$TARGET_ARCH/mingw32" >& /dev/null
|
||||
rs_prefixdir="$installdir/$TARGET_ARCH"
|
||||
rs_supportprefixdir="$installdir/support"
|
||||
rs_mkdir_if_not_exists "$installdir/bin"
|
||||
|
||||
# For compiling gcc, it needs to access the already compiled mingw32 binutils
|
||||
PATH="$installdir/$TARGET_ARCH/bin:$PATH"
|
||||
|
||||
# cpucount
|
||||
if $process_cpucount; then
|
||||
echo -n "Compiling cpucount... "
|
||||
gcc -s -o "$installdir/bin/cpucount" "$SCRIPTDIR/tools/cpucount.c"
|
||||
setup_check_run
|
||||
##### BEGIN almost shared buildtoolchain/RosBE-Unix building part #############
|
||||
rs_boldmsg "Building..."
|
||||
|
||||
rs_mkdir_if_not_exists "$rs_prefixdir/$rs_target"
|
||||
rs_mkdir_if_not_exists "$rs_supportprefixdir"
|
||||
|
||||
rs_extract_module "mingw_runtime_dev" "$rs_prefixdir/$rs_target"
|
||||
rs_extract_module "w32api" "$rs_prefixdir/$rs_target"
|
||||
|
||||
if $rs_process_buildtime; then
|
||||
rs_do_command gcc -s -o "$installdir/bin/buildtime" "$rs_scriptdir/tools/buildtime.c"
|
||||
fi
|
||||
|
||||
CPUCOUNT=`$installdir/bin/cpucount -x1`
|
||||
cd "$installdir/$TARGET_ARCH/mingw32"
|
||||
|
||||
# mingw-runtime
|
||||
if $process_mingwruntime; then
|
||||
echo -n "Extracting mingw-runtime... "
|
||||
tar -xjf "$SOURCEDIR/mingw-runtime.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
if $rs_process_cpucount; then
|
||||
rs_do_command gcc -s -o "$installdir/bin/cpucount" "$rs_scriptdir/tools/cpucount.c"
|
||||
fi
|
||||
|
||||
# w32api
|
||||
if $process_w32api; then
|
||||
echo -n "Extracting w32api... "
|
||||
tar -xjf "$SOURCEDIR/w32api.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
rs_cpucount=`$installdir/bin/cpucount -x1`
|
||||
|
||||
if $rs_process_getincludes; then
|
||||
rs_do_command gcc -s -o "$installdir/bin/getincludes" "$rs_scriptdir/tools/getincludes.c"
|
||||
fi
|
||||
|
||||
cd "$SOURCEDIR"
|
||||
|
||||
# binutils
|
||||
if $process_binutils; then
|
||||
rm -rf "binutils"
|
||||
rm -rf "binutils-build"
|
||||
|
||||
echo -n "Extracting binutils... "
|
||||
tar -xjf "binutils.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
|
||||
echo -n "Configuring binutils... "
|
||||
mkdir "binutils-build"
|
||||
cd "binutils-build"
|
||||
../binutils/configure --prefix="$installdir/$TARGET_ARCH" --target=mingw32 --disable-nls --with-gcc \
|
||||
--with-gnu-as --with-gnu-ld --disable-shared >& "$SCRIPTDIR/configure.log"
|
||||
setup_check_run "configure"
|
||||
|
||||
echo -n "Building binutils... "
|
||||
$makecmd -j $CPUCOUNT CFLAGS="-O2 -fno-exceptions" LDFLAGS="-s" >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Installing binutils... "
|
||||
$makecmd install >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Cleaning up binutils... "
|
||||
cd "$SOURCEDIR"
|
||||
rm -rf "binutils-build"
|
||||
rm -rf "binutils"
|
||||
setup_check_run
|
||||
if $rs_process_scut; then
|
||||
rs_do_command gcc -s -o "$installdir/bin/scut" "$rs_scriptdir/tools/scut.c"
|
||||
fi
|
||||
|
||||
# gcc
|
||||
if $process_gcc; then
|
||||
rm -rf "gcc"
|
||||
rm -rf "gcc-build"
|
||||
if rs_prepare_module "gmp"; then
|
||||
export CFLAGS="$rs_host_cflags"
|
||||
|
||||
echo -n "Extracting gcc... "
|
||||
tar -xjf "gcc.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
rs_do_command ../gmp/configure ABI=32 --prefix="$rs_supportprefixdir" --disable-shared
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd check
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "gmp"
|
||||
|
||||
echo -n "Configuring gcc... "
|
||||
mkdir "gcc-build"
|
||||
cd "gcc-build"
|
||||
../gcc/configure --prefix="$installdir/$TARGET_ARCH" --target=mingw32 \
|
||||
--with-headers="$installdir/$TARGET_ARCH/mingw32/include"--with-gcc --with-gnu-ld \
|
||||
--with-gnu-as --enable-languages=c,c++ --enable-checking=release \
|
||||
--enable-threads=win32 --disable-win32-registry --disable-nls \
|
||||
--disable-shared >& "$SCRIPTDIR/configure.log"
|
||||
setup_check_run "configure"
|
||||
|
||||
echo -n "Building gcc... "
|
||||
$makecmd -j $CPUCOUNT CFLAGS="-O2" CXXFLAGS="-O2" LDFLAGS="-s" >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Installing gcc... "
|
||||
$makecmd install >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Cleaning up gcc... "
|
||||
cd "$SOURCEDIR"
|
||||
rm -rf "gcc-build"
|
||||
rm -rf "gcc"
|
||||
setup_check_run
|
||||
export CFLAGS=""
|
||||
fi
|
||||
|
||||
# make
|
||||
if $process_make; then
|
||||
rm -rf "make"
|
||||
rm -rf "make-build"
|
||||
if rs_prepare_module "mpfr"; then
|
||||
export CFLAGS="$rs_host_cflags"
|
||||
|
||||
echo -n "Extracting make... "
|
||||
tar -xjf "make.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
rs_do_command ../mpfr/configure --prefix="$rs_supportprefixdir" --with-gmp="$rs_supportprefixdir" --disable-shared
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd check
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "mpfr"
|
||||
|
||||
echo -n "Configuring make... "
|
||||
mkdir "make-build"
|
||||
cd "make-build"
|
||||
../make/configure --prefix="$installdir" --disable-dependency-tracking \
|
||||
--disable-nls --enable-case-insensitive-file-system \
|
||||
--disable-job-server --disable-rpath >& "$SCRIPTDIR/configure.log"
|
||||
setup_check_run "configure"
|
||||
|
||||
echo -n "Building make... "
|
||||
$makecmd -j $CPUCOUNT CFLAGS="-s -O2 -mms-bitfields" >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Installing make... "
|
||||
$makecmd install >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Cleaning up make... "
|
||||
cd "$SOURCEDIR"
|
||||
rm -rf "make-build"
|
||||
rm -rf "make"
|
||||
setup_check_run
|
||||
export CFLAGS=""
|
||||
fi
|
||||
|
||||
# nasm
|
||||
if $process_nasm; then
|
||||
rm -rf "nasm"
|
||||
if rs_prepare_module "binutils"; then
|
||||
# At least the GCC 4.4.1 in Ubuntu 9.10 incorrectly warns about a potentially uninitialized variable, so don't count this as an error.
|
||||
export CFLAGS="$rs_host_cflags -Wno-error=uninitialized"
|
||||
|
||||
rs_do_command ../binutils/configure --prefix="$rs_prefixdir" --target="$rs_target" --disable-nls
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "binutils"
|
||||
|
||||
export CFLAGS=""
|
||||
fi
|
||||
|
||||
echo -n "Extracting nasm... "
|
||||
tar -xjf "nasm.tar.bz2" >& "$SCRIPTDIR/tar.log"
|
||||
setup_check_run "tar"
|
||||
if rs_prepare_module "gcc"; then
|
||||
export CFLAGS="$rs_host_cflags"
|
||||
export CFLAGS_FOR_TARGET="$rs_target_cflags"
|
||||
export CXXFLAGS_FOR_TARGET="$rs_target_cflags"
|
||||
|
||||
rs_do_command ../gcc/configure --prefix="$rs_prefixdir" --target="$rs_target" --with-gmp="$rs_supportprefixdir" --with-mpfr="$rs_supportprefixdir" --enable-languages=c,c++ --enable-checking=release --enable-version-specific-runtime-libs --enable-threads=win32 --disable-win32-registry --disable-shared --disable-nls
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "gcc"
|
||||
|
||||
export CFLAGS=""
|
||||
export CFLAGS_FOR_TARGET=""
|
||||
export CXXFLAGS_FOR_TARGET=""
|
||||
fi
|
||||
|
||||
if rs_prepare_module "make"; then
|
||||
export CFLAGS="$rs_host_cflags"
|
||||
|
||||
rs_do_command ../make/configure --prefix="$installdir" --disable-dependency-tracking --disable-nls --enable-case-insensitive-file-system --disable-job-server --disable-rpath
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "make"
|
||||
|
||||
export CFLAGS=""
|
||||
fi
|
||||
|
||||
# NASM doesn't compile in a dedicated build directory, so just extract it
|
||||
if rs_extract_module "nasm" "$rs_workdir"; then
|
||||
export CFLAGS="$rs_host_cflags"
|
||||
|
||||
echo -n "Configuring nasm... "
|
||||
cd "nasm"
|
||||
./configure --prefix="$installdir/$TARGET_ARCH" >& "$SCRIPTDIR/configure.log"
|
||||
setup_check_run "configure"
|
||||
rs_do_command ./configure --prefix="$rs_prefixdir"
|
||||
rs_do_command $rs_makecmd -j $rs_cpucount
|
||||
rs_do_command $rs_makecmd install
|
||||
rs_clean_module "nasm"
|
||||
|
||||
echo -n "Building nasm... "
|
||||
$makecmd -j $CPUCOUNT >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Installing nasm... "
|
||||
$makecmd install >& "$SCRIPTDIR/make.log"
|
||||
setup_check_run "make"
|
||||
|
||||
echo -n "Cleaning up nasm... "
|
||||
cd "$SOURCEDIR"
|
||||
rm -rf "nasm"
|
||||
setup_check_run
|
||||
export CFLAGS=""
|
||||
fi
|
||||
|
||||
# Final actions
|
||||
echo
|
||||
boldmsg "Final actions"
|
||||
rs_boldmsg "Final actions"
|
||||
cd "$installdir"
|
||||
|
||||
if [ "$installdir" = "/usr/RosBE" ] && $update; then
|
||||
# Changed default installation directory starting with RosBE-Unix 1.4
|
||||
echo "Do you want to move /usr/RosBE to /usr/local/RosBE? (yes/no)"
|
||||
read -p "[yes] " answer
|
||||
echo "Removing unneeded files..."
|
||||
rm -rf share
|
||||
rm -rf $rs_prefixdir/include $rs_prefixdir/info $rs_prefixdir/man $rs_prefixdir/share
|
||||
rm -f $rs_prefixdir/lib/* >& /dev/null
|
||||
|
||||
if [ "$answer" = "" ] || [ "$answer" = "yes" ]; then
|
||||
mv "/usr/RosBE" "/usr/local/RosBE"
|
||||
installdir="/usr/local/RosBE"
|
||||
fi
|
||||
fi
|
||||
# Keep the "include" and "lib" directories of the support files in case a subsequent RosBE-Unix package needs them
|
||||
rm -rf $rs_supportprefixdir/info $rs_supportprefixdir/share
|
||||
|
||||
if $process_buildtime; then
|
||||
echo -n "Compiling buildtime... "
|
||||
gcc -s -o "$installdir/bin/buildtime" "$SCRIPTDIR/tools/buildtime.c"
|
||||
setup_check_run
|
||||
fi
|
||||
echo "Removing debugging symbols..."
|
||||
find -executable -type f -exec strip -s {} ";" >& /dev/null
|
||||
##### END almost shared buildtoolchain/RosBE-Unix building part ###############
|
||||
|
||||
if $process_scut; then
|
||||
echo -n "Compiling scut... "
|
||||
gcc -s -o "$installdir/bin/scut" "$SCRIPTDIR/tools/scut.c"
|
||||
setup_check_run
|
||||
fi
|
||||
|
||||
if $process_getincludes; then
|
||||
echo -n "Compiling getincludes... "
|
||||
gcc -s -o "$installdir/bin/getincludes" "$SCRIPTDIR/tools/getincludes.c"
|
||||
setup_check_run
|
||||
fi
|
||||
echo "Copying scripts..."
|
||||
cp -R "$rs_scriptdir/scripts/"* "$installdir"
|
||||
|
||||
echo -n "Removing unneeded files... "
|
||||
rm -rf "$installdir/share"
|
||||
rm -rf "$installdir/$TARGET_ARCH/mingw32/sys-include"
|
||||
rm -rf "$installdir/$TARGET_ARCH/info"
|
||||
rm -rf "$installdir/$TARGET_ARCH/man"
|
||||
rm -rf "$installdir/$TARGET_ARCH/share"
|
||||
setup_check_run
|
||||
|
||||
echo -n "Removing debugging symbols... "
|
||||
ls "$installdir/$TARGET_ARCH/bin/"* "$installdir/$TARGET_ARCH/mingw32/bin/"* | grep -v "gccbug" |
|
||||
while read file; do
|
||||
strip "$file"
|
||||
done
|
||||
setup_check_run
|
||||
|
||||
echo -n "Copying scripts... "
|
||||
cp -R "$SCRIPTDIR/scripts/"* "$installdir"
|
||||
setup_check_run
|
||||
|
||||
echo -n "Writing version... "
|
||||
echo "Writing version..."
|
||||
echo "$ROSBE_VERSION" > "$installdir/RosBE-Version"
|
||||
setup_check_run
|
||||
echo
|
||||
|
||||
# Finish
|
||||
boldmsg "Finished successfully!"
|
||||
rs_boldmsg "Finished successfully!"
|
||||
echo "To create a shortcut to the Build Environment on the Desktop, please switch back to your"
|
||||
echo "normal User Account (I assume you ran this script as \"root\")."
|
||||
echo "Then execute the following command:"
|
||||
|
@ -2,7 +2,7 @@
|
||||
#
|
||||
# Script for initializing RosBE
|
||||
# Part of RosBE for Unix-based Operating Systems
|
||||
# Copyright 2007-2009 Colin Finck <mail@colinfinck.de>
|
||||
# Copyright 2007-2009 Colin Finck <colin@reactos.org>
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
|
||||
@ -57,9 +57,9 @@ source "$_ROSBE_ROSSCRIPTDIR/$_ROSBE_ARCH/setvars.sh"
|
||||
# Display banner
|
||||
echo "*******************************************************************************"
|
||||
echo "* ReactOS Build Environment for Unix-based Operating Systems *"
|
||||
echo "* by Colin Finck <mail@colinfinck.de> *"
|
||||
echo "* by Colin Finck <colin@reactos.org> *"
|
||||
echo "* *"
|
||||
echo "* Version $_ROSBE_VERSION *"
|
||||
echo "* Version $_ROSBE_VERSION *"
|
||||
echo "*******************************************************************************"
|
||||
echo
|
||||
echo "For a list of all included commands, type: \"help\""
|
||||
|
@ -21,7 +21,7 @@ source "$SCRIPTDIR/rosbelibrary.sh"
|
||||
ROSBE_VERSION=`cat "$SCRIPTDIR/RosBE-Version"`
|
||||
|
||||
# Select the source directory
|
||||
boldmsg "ReactOS Source Directory"
|
||||
rs_boldmsg "ReactOS Source Directory"
|
||||
|
||||
echo "Enter the directory where the ReactOS sources are located."
|
||||
echo "This directory will become the current directory, when you start the Build Environment."
|
||||
@ -42,7 +42,7 @@ while [ "$sourcedir" = "" ]; do
|
||||
done
|
||||
|
||||
# Select the shortcut directory
|
||||
boldmsg "Shortcut Directory"
|
||||
rs_boldmsg "Shortcut Directory"
|
||||
|
||||
echo "In which directory do you want to create the shortcut?"
|
||||
echo "Enter the path to the directory here or simply press ENTER to install it into the Desktop directory of the current user."
|
||||
@ -62,7 +62,7 @@ while [ "$shortcutdir" = "" ]; do
|
||||
done
|
||||
|
||||
# Create the shortcut
|
||||
boldmsg "Create Shortcut"
|
||||
rs_boldmsg "Create Shortcut"
|
||||
|
||||
echo -n "Creating shortcut... "
|
||||
shortcut="$shortcutdir/ReactOS Build Environment.desktop"
|
||||
@ -76,4 +76,4 @@ echo "Icon=$SCRIPTDIR/RosBE.png" >> "$shortcut"
|
||||
echo "Exec=bash \"$SCRIPTDIR/RosBE.sh\" \"$sourcedir\"" >> "$shortcut"
|
||||
echo "Terminal=true" >> "$shortcut"
|
||||
|
||||
greenmsg "OK"
|
||||
rs_greenmsg "OK"
|
||||
|
@ -4,67 +4,11 @@
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
|
||||
# Print a message in a bold font
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
boldmsg()
|
||||
{
|
||||
echo -e $2 "\e[1m$1\e[0m"
|
||||
}
|
||||
|
||||
# Print a message in green color
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
greenmsg()
|
||||
{
|
||||
echo -e $2 "\e[32m$1\e[0m"
|
||||
}
|
||||
|
||||
# Print a message in red color
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
redmsg()
|
||||
{
|
||||
echo -e $2 "\e[31m$1\e[0m"
|
||||
}
|
||||
|
||||
# Allow a choice between several options
|
||||
# If a valid choice was done, the result is stored in $choice
|
||||
# Parameter 1 - The default value
|
||||
# Parameter 2 - All possible values
|
||||
showchoice()
|
||||
{
|
||||
default_value="$1"
|
||||
valid_choices="$2"
|
||||
|
||||
breakloop=false
|
||||
choice=""
|
||||
|
||||
while true; do
|
||||
read -p "Your choice [$default_value]: " choice
|
||||
|
||||
if [ "$choice" = "" ]; then
|
||||
choice="$default_value"
|
||||
break
|
||||
fi
|
||||
|
||||
for valid_choice in $valid_choices; do
|
||||
if [ "$choice" = "$valid_choice" ]; then
|
||||
breakloop=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if $breakloop; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Change the _ROSBE_ARCH variable appropriately
|
||||
# Check whether the given architecture is supported and if so, change the _ROSBE_ARCH variable appropriately
|
||||
# Parameter 1: The architecture to set
|
||||
change_architecture()
|
||||
{
|
||||
new_arch="$1"
|
||||
local new_arch="$1"
|
||||
|
||||
if [ -f "$_ROSBE_ROSSCRIPTDIR/$new_arch/version.sh" ]; then
|
||||
# Architecture parameter seems valid
|
||||
@ -78,24 +22,18 @@ change_architecture()
|
||||
export _ROSBE_ARCH
|
||||
}
|
||||
|
||||
# Set the PATH variable properly for the specified architecture
|
||||
set_path_variable()
|
||||
# Check whether we're running as root and warn the user in case we don't
|
||||
check_root()
|
||||
{
|
||||
# Set the PATH
|
||||
PATH="$_ROSBE_ROSSCRIPTDIR/$_ROSBE_ARCH/bin:$_ROSBE_ROSSCRIPTDIR/bin:$_ROSBE_OLDPATH"
|
||||
}
|
||||
|
||||
# Check for several requirements, which need to be met in order to run the installation script properly
|
||||
setup_check_requirements()
|
||||
{
|
||||
# Check whether we're running as root
|
||||
if [ ! "`whoami`" = "root" ]; then
|
||||
boldmsg "User is not \"root\""
|
||||
rs_boldmsg "User is not \"root\""
|
||||
|
||||
echo "The default installation path for the Build Environment is \"$DEFAULT_INSTALL_DIR\"."
|
||||
echo "Therefore it is recommended to run this script as the \"root\" user. Otherwise you probably cannot create the necessary directories."
|
||||
echo "An alternative is to specify another installation directory at the installation process."
|
||||
echo "Do you really want to continue? (yes/no)"
|
||||
|
||||
local answer
|
||||
read -p "[no] " answer
|
||||
|
||||
if [ "$answer" = "yes" ]; then
|
||||
@ -104,84 +42,11 @@ setup_check_requirements()
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test if the script directory is writeable
|
||||
if [ ! -w "$SCRIPTDIR" ]; then
|
||||
redmsg "The script directory \"$SCRIPTDIR\" is not writeable, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test if the script directory contains spaces
|
||||
case "$SCRIPTDIR" in
|
||||
*" "*)
|
||||
redmsg "The script directory \"$SCRIPTDIR\" contains spaces!"
|
||||
redmsg "Therefore some build tools cannot be compiled properly."
|
||||
echo
|
||||
redmsg "Please move \"$SCRIPTDIR\" to a directory, which does not contain spaces."
|
||||
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
# Check if all necessary tools exist
|
||||
boldmsg "Checking for the needed tools..."
|
||||
|
||||
toolmissing=false
|
||||
for tool in $NEEDED_TOOLS; do
|
||||
echo -n "Checking for $tool... "
|
||||
|
||||
if which "$tool" >& /dev/null; then
|
||||
greenmsg "OK"
|
||||
else
|
||||
redmsg "MISSING"
|
||||
toolmissing=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Special check for GNU Make
|
||||
# For example FreeBSD's "make" is not GNU Make, so we have to define a variable
|
||||
echo -n "Checking for GNU Make... "
|
||||
|
||||
if make -v 2>&1 | grep "GNU Make" >& /dev/null; then
|
||||
makecmd="make"
|
||||
greenmsg "OK"
|
||||
elif gmake -v 2>&1 | grep "GNU Make" >& /dev/null; then
|
||||
makecmd="gmake"
|
||||
greenmsg "OK"
|
||||
else
|
||||
redmsg "MISSING"
|
||||
toolmissing=true
|
||||
fi
|
||||
|
||||
if $toolmissing; then
|
||||
echo "At least one needed tool is missing, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# Check whether the previous command finished with errorlevel 0
|
||||
# If it did so, print a green "OK" and delete the debug logfile for the command.
|
||||
# If that wasn't the case, print a red "FAILED" and give information about the debug logfile.
|
||||
setup_check_run()
|
||||
# Set the PATH variable properly for the specified architecture
|
||||
set_path_variable()
|
||||
{
|
||||
if [ $? -ne 0 ]; then
|
||||
redmsg "FAILED"
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
echo "If you did not do something wrong, please contact the ReactOS Team."
|
||||
else
|
||||
echo "Please take a look at the log file \"$SCRIPTDIR/$1.log\""
|
||||
echo "If you did not do something wrong, please save the log file and contact the ReactOS Team."
|
||||
fi
|
||||
|
||||
echo "Aborted!"
|
||||
exit 1
|
||||
else
|
||||
greenmsg "OK"
|
||||
|
||||
if [ "$1" != "" ]; then
|
||||
rm "$SCRIPTDIR/$1.log"
|
||||
fi
|
||||
fi
|
||||
# Set the PATH
|
||||
PATH="$_ROSBE_ROSSCRIPTDIR/$_ROSBE_ARCH/bin:$_ROSBE_ROSSCRIPTDIR/bin:$_ROSBE_OLDPATH"
|
||||
}
|
||||
|
230
RosBE-Unix/Base-i386/scripts/setuplibrary.sh
Normal file
230
RosBE-Unix/Base-i386/scripts/setuplibrary.sh
Normal file
@ -0,0 +1,230 @@
|
||||
###############################################################################
|
||||
# Shared setup functions for RosBE-Windows' buildtoolchain and RosBE-Unix
|
||||
# Copyright 2009 Colin Finck <colin@reactos.org>
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
###############################################################################
|
||||
# Conventions:
|
||||
# - Prepend all functions of this library with "rs_" (RosBE Setup)
|
||||
# - Also prepend all variables used here and variables which are shared
|
||||
# between buildtoolchain and RosBE-Unix and are used in conjunction with
|
||||
# these functions in the calling script with "rs_"
|
||||
###############################################################################
|
||||
|
||||
|
||||
# Print a message in a bold font
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
rs_boldmsg()
|
||||
{
|
||||
echo -e $2 "\e[1m$1\e[0m"
|
||||
}
|
||||
|
||||
# Check for several requirements, which need to be met in order to run the installation script properly
|
||||
rs_check_requirements()
|
||||
{
|
||||
# Test if the script directory is writable
|
||||
if [ ! -w "$rs_scriptdir" ]; then
|
||||
rs_redmsg "The script directory \"$rs_scriptdir\" is not writable, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test if the script directory contains spaces
|
||||
case "$rs_scriptdir" in
|
||||
*" "*)
|
||||
rs_redmsg "The script directory \"$rs_scriptdir\" contains spaces!"
|
||||
rs_redmsg "Therefore some build tools cannot be compiled properly."
|
||||
echo
|
||||
rs_redmsg "Please move \"$rs_scriptdir\" to a directory, which does not contain spaces."
|
||||
|
||||
exit 1;;
|
||||
esac
|
||||
|
||||
# Check if all necessary tools exist
|
||||
rs_boldmsg "Checking for the needed tools..."
|
||||
|
||||
local toolmissing=false
|
||||
for tool in $rs_needed_tools; do
|
||||
echo -n "Checking for $tool... "
|
||||
|
||||
if which "$tool" >& /dev/null; then
|
||||
rs_greenmsg "OK"
|
||||
else
|
||||
rs_redmsg "MISSING"
|
||||
toolmissing=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Special check for GNU Make
|
||||
# For example FreeBSD's "make" is not GNU Make, so we have to define a variable
|
||||
echo -n "Checking for GNU Make... "
|
||||
|
||||
local app
|
||||
local checkapps="make gmake"
|
||||
rs_makecmd=""
|
||||
|
||||
for app in $checkapps; do
|
||||
if $app -v 2>&1 | grep "GNU Make" >& /dev/null; then
|
||||
rs_makecmd="$app"
|
||||
rs_greenmsg "OK"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$rs_makecmd" = "" ]; then
|
||||
rs_redmsg "MISSING"
|
||||
toolmissing=true
|
||||
fi
|
||||
|
||||
|
||||
if $toolmissing; then
|
||||
echo "At least one needed tool is missing, aborted!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo
|
||||
}
|
||||
|
||||
# Check whether the previous command finished with errorlevel 0
|
||||
# If it did so, print a green "OK" and delete the debug logfile for the command.
|
||||
# If that wasn't the case, print a red "FAILED" and give information about the debug logfile.
|
||||
rs_check_run()
|
||||
{
|
||||
if [ $? -ne 0 ]; then
|
||||
rs_redmsg "FAILED"
|
||||
echo "Please take a look at the log file \"$rs_workdir/build.log\""
|
||||
echo "If you did not do something wrong, please save the log file and contact the ReactOS Team."
|
||||
|
||||
echo "Aborted!"
|
||||
exit 1
|
||||
else
|
||||
rs_greenmsg "OK"
|
||||
rm "$rs_workdir/build.log"
|
||||
fi
|
||||
}
|
||||
|
||||
# Cleans a module prepared with rs_prepare_module.
|
||||
# Parameter 1: The module name
|
||||
rs_clean_module()
|
||||
{
|
||||
echo "Cleaning up $1..."
|
||||
cd "$rs_workdir"
|
||||
rm -rf "$1-build"
|
||||
rm -rf "$1"
|
||||
}
|
||||
|
||||
# Executes a building command and checks whether it succeeded.
|
||||
# Terminates the building process in case of failure.
|
||||
# Parameters: The command to execute including parameters
|
||||
rs_do_command()
|
||||
{
|
||||
echo -n "Running \"$*\"... "
|
||||
$* >& "$rs_workdir/build.log"
|
||||
rs_check_run
|
||||
}
|
||||
|
||||
# Checks whether the given module needs to be processed and if so, extracts it.
|
||||
# Returns 0 if it needs to be processed, otherwise 1.
|
||||
# Parameter 1: The module name
|
||||
# Parameter 2: The directory to extract the module to
|
||||
rs_extract_module()
|
||||
{
|
||||
local module=$1
|
||||
local target_dir=$2
|
||||
|
||||
if ! `eval echo \\$rs_process_$module`; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
cd "$target_dir"
|
||||
|
||||
echo -n "Extracting $module... "
|
||||
tar -xjf "$rs_sourcedir/$module.tar.bz2" >& "$rs_workdir/build.log"
|
||||
rs_check_run
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Print a message in green color
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
rs_greenmsg()
|
||||
{
|
||||
echo -e $2 "\e[32m$1\e[0m"
|
||||
}
|
||||
|
||||
# Creates the given directory if it does not exist and cleans it if it does.
|
||||
# Parameter 1: The directory
|
||||
rs_mkdir_empty()
|
||||
{
|
||||
if [ -d "$1" ]; then
|
||||
rm -rf "$1"
|
||||
fi
|
||||
|
||||
mkdir -p "$1"
|
||||
}
|
||||
|
||||
# Creates a directory if it does not exist.
|
||||
# Parameter 1: The directory
|
||||
rs_mkdir_if_not_exists()
|
||||
{
|
||||
if ! [ -d "$1" ]; then
|
||||
mkdir -p "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Checks whether the given module needs to be processed and if so, extracts it into a dedicated build directory
|
||||
# Returns 0 if it needs to be built, otherwise 1.
|
||||
# Parameter 1: The module name
|
||||
rs_prepare_module()
|
||||
{
|
||||
local module=$1
|
||||
|
||||
rm -rf "$rs_workdir/$module"
|
||||
|
||||
if ! rs_extract_module "$module" "$rs_workdir"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm -rf "$module-build"
|
||||
mkdir "$module-build"
|
||||
cd "$module-build"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Print a message in red color
|
||||
# Parameter 1: The message
|
||||
# Parameter 2: Optional additional parameters for "echo"
|
||||
rs_redmsg()
|
||||
{
|
||||
echo -e $2 "\e[31m$1\e[0m"
|
||||
}
|
||||
|
||||
# Allow a choice between several options
|
||||
# If a valid choice was done, the result is stored in $choice
|
||||
# Parameter 1 - The default value
|
||||
# Parameter 2 - All possible values
|
||||
rs_showchoice()
|
||||
{
|
||||
local default_value="$1"
|
||||
local valid_choices="$2"
|
||||
|
||||
local breakloop=false
|
||||
choice=""
|
||||
|
||||
while ! $breakloop; do
|
||||
read -p "Your choice [$default_value]: " choice
|
||||
|
||||
if [ "$choice" = "" ]; then
|
||||
choice="$default_value"
|
||||
break
|
||||
fi
|
||||
|
||||
for valid_choice in $valid_choices; do
|
||||
if [ "$choice" = "$valid_choice" ]; then
|
||||
breakloop=true
|
||||
break
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
|
||||
source "$_ROSBE_ROSSCRIPTDIR/rosbelibrary.sh"
|
||||
source "$_ROSBE_ROSSCRIPTDIR/setuplibrary.sh"
|
||||
|
||||
# Display RosBE version
|
||||
echo "This is the ReactOS Build Environment for Unix-based Operating Systems"
|
||||
@ -14,10 +14,10 @@ echo "Version $_ROSBE_VERSION"
|
||||
echo
|
||||
|
||||
# Environment Information
|
||||
boldmsg "Environment Information"
|
||||
rs_boldmsg "Environment Information"
|
||||
echo "Selected Target Architecture: $_ROSBE_ARCH"
|
||||
echo
|
||||
|
||||
# Display tool versions
|
||||
boldmsg "Build Tools"
|
||||
rs_boldmsg "Build Tools"
|
||||
source "$_ROSBE_ROSSCRIPTDIR/$_ROSBE_ARCH/version.sh"
|
||||
|
@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# ReactOS Build Environment for Unix-based Operating Systems - Packaging tool for the Base package
|
||||
# Copyright 2009 Colin Finck <mail@colinfinck.de>
|
||||
# Copyright 2009 Colin Finck <colin@reactos.org>
|
||||
#
|
||||
# Released under GNU GPL v2 or any later version.
|
||||
|
||||
@ -61,7 +61,7 @@ tools=""
|
||||
|
||||
case "$package_name" in
|
||||
"Base-i386")
|
||||
sources+="make mingw-runtime nasm w32api"
|
||||
sources+="gmp make mingw_runtime_dev mpfr nasm w32api"
|
||||
tools+="cpucount scut"
|
||||
esac
|
||||
|
||||
@ -82,17 +82,15 @@ check_file "$package_name/README.pdf"
|
||||
#
|
||||
# The Process
|
||||
#
|
||||
# Copy the directory, delete some stuff and set the permissions
|
||||
# Copy the directory and delete some stuff
|
||||
echo "Copying the \"$package_name\" directory..."
|
||||
rm -rf "$full_package_name"
|
||||
cp -R "$package_name" "$full_package_name"
|
||||
|
||||
find "$full_package_name" -type d -name ".svn" | xargs rm -rf
|
||||
find "$full_package_name" -type f -name "SVN-Readme.txt" | xargs rm
|
||||
find "$full_package_name" -type d -name ".svn" -exec rm -rf {} ";" >& /dev/null
|
||||
find "$full_package_name" -type f -name "SVN-Readme.txt" -exec rm {} ";"
|
||||
rm "$full_package_name/README.odt"
|
||||
|
||||
find "$full_package_name" -type f -name "*.sh" | xargs chmod +x
|
||||
|
||||
# Copy the shared tools
|
||||
for tool in $tools; do
|
||||
echo "Copying $tool.c..."
|
||||
|
Loading…
Reference in New Issue
Block a user