Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RosBE-Unix 2.3 #15

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions RosBE-Unix/Base-i386/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ReactOS Build Environment
Version 2.2.1 for Unix-based operating systems
Base package and i386 build tools
Version 2.3 for Unix-based operating systems
Base package with i386 and amd64 compilers

Introduction
-------------
Expand Down Expand Up @@ -51,8 +51,8 @@ system. They are needed to build the ReactOS Build Environment. The
example for Debian-based Linux distributions is "zlib1g-dev".


Installation
-------------
Installation of the Base package and i386 compiler
---------------------------------------------------
The Installation of RosBE is very simple as there are scripts that do most of
the work for you. Follow these steps to compile and install RosBE for your
operating system:
Expand All @@ -75,6 +75,15 @@ operating system:
the shortcut.


Installation of the amd64 compiler
-----------------------------------
The amd64 compiler can only be installed after you have installed the Base
package and i386 compiler.
When this is done, just run "sudo ./RosBE-Builder-amd64.sh" and follow the
instructions. The same options and variables can be used as for the base
installation script.


Uninstallation
---------------
If you want to uninstall RosBE, just delete the entire installation directory
Expand All @@ -86,8 +95,10 @@ Version Information
This version of RosBE for Unix-based operating systems uses the following
components:

* GNU Binutils v2.34
* GNU Binutils v2.36.1
compiled for i686-w64-mingw32
patched with:
- https://raw.githubusercontent.com/reactos/RosBE/f9e43c3b01dcbd507e5b1454f654f4493955b131/Patches/binutils-2.36.1-jerome-gardou-optional-code-argument.patch

* GCC, The GNU Compiler Collection v8.4.0
compiled for i686-w64-mingw32
Expand All @@ -109,15 +120,16 @@ components:
* Mingw-w64 6.0.0
* MPC 1.1.0
* MPFR 4.0.2
* Ninja 1.10.0
* Ninja 1.10.2-ReactOS
(revision b661be7af3f98bd9a29caa7b35702bd5248f8ed8 from https://github.com/reactos/ninja/tree/ninja-1.10.2-reactos)


Tested Operating Systems
-------------------------
The Build Environment has been designed to work on all Unix-based operating
systems. Nevertheless, it is impossible to test it on all possible systems out
there.
The current primary development and test system is Ubuntu 18.04. But users
The current primary development and test system is Ubuntu 20.04. But users
also reported that it works well under other Linux systems such as Fedora or
openSUSE and Unix derivates like FreeBSD or macOS.
You should be able to compile the build tools on both i386 (32-bit) and
Expand Down
Binary file modified RosBE-Unix/Base-i386/README.odt
Binary file not shown.
264 changes: 264 additions & 0 deletions RosBE-Unix/Base-i386/RosBE-Builder-amd64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
#!/usr/bin/env bash
#
# ReactOS Build Environment for Unix-based Operating Systems - Builder Tool for the amd64 compiler add-on
# Copyright 2021 Colin Finck <[email protected]>
#
# Released under GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)

if [ -z "$BASH_VERSION" ]; then
exec bash "$0"
fi

# RosBE Setup Variables
rs_host_cc="${CC:-gcc}"
rs_host_cflags="${CFLAGS:--pipe -O2 -g0 -march=native}"
rs_host_cxx="${CXX:-g++}"
rs_host_cxxflags="${CXXFLAGS:-$rs_host_cflags}"
rs_needed_tools="as bzip2 find $CC $CXX grep m4 makeinfo python tar" # GNU Make has a special check
rs_needed_libs="zlib"
rs_target="x86_64-w64-mingw32"
rs_target_cflags="-pipe -O2 -Wl,-S -g0"
rs_target_cxxflags="$rs_target_cflags"

# This is a cross-compiler with prefix.
rs_target_tool_prefix="${rs_target}-"

export CC="$rs_host_cc"
export CFLAGS="$rs_host_cflags"
export CXX="$rs_host_cxx"
export CXXFLAGS="$rs_host_cxxflags"

# Get the absolute path to the script directory
cd `dirname $0`
rs_scriptdir="$PWD"
rs_workdir="$rs_scriptdir/sources"
rs_sourcedir="$rs_scriptdir/sources"

# RosBE-Unix Constants
DEFAULT_INSTALL_DIR="/usr/local/RosBE"
ROSBE_VERSION="2.3"
TARGET_ARCH="amd64"

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 amd64 compiler add-on *"
echo "* by Colin Finck <[email protected]> *"
echo "* *"
printf "* Version %-8s *\n" $ROSBE_VERSION
echo "*******************************************************************************"

echo
echo "This script compiles and installs the optional compiler add-on for building"
echo "ReactOS for amd64 (x86_64) processors."
echo

if [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "--help" ]; then
echo "Syntax: ./RosBE-Builder-amd64.sh [installdir]"
echo
echo " installdir - Optional parameter to specify the installation directory and"
echo " perform an unattended installation."
echo " This directory must contain a ReactOS Build Environment"
echo " installation of the same version (created by"
echo " ./RosBE-Builder.sh)"
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

# Only check for root on an interactive installation.
if [ "$1" = "" ]; then
check_root
fi

rs_check_requirements

# Select the installation directory
rs_boldmsg "Installation Directory"

if [ "$1" = "" ]; then
installdir=""

echo "Where is your ReactOS Build Environment installation?"
echo "Enter the path to the directory here or simply press ENTER to accept the default directory."

while [ "$installdir" = "" ]; do
read -p "[$DEFAULT_INSTALL_DIR] " installdir
echo

if [ "$installdir" = "" ]; then
installdir=$DEFAULT_INSTALL_DIR
fi

# Make sure we have the absolute path to the installation directory
installdir=`eval echo $installdir`

# Check if the installation directory is valid and points to the same RosBE version
installed_rosbe_version=`cat $installdir/RosBE-Version 2>/dev/null`
if [ "$installed_rosbe_version" = "" ]; then
echo "The directory \"$installdir\" does not contain a ReactOS Build Environment installation."
echo "Please enter another directory."
echo
installdir=""
elif [ "$installed_rosbe_version" != "$ROSBE_VERSION" ]; then
echo "The installed ReactOS Build Environment version ($installed_rosbe_version) does not match"
echo "the version of this add-on ($ROSBE_VERSION)."
echo "Please install the proper base package first or enter another directory."
echo
installdir=""
fi
done

# Ready to start
rs_boldmsg "Ready to start"

echo "Ready to build and install this ReactOS Build Environment add-on."
echo "Press Return to continue or Ctrl+C to exit."
read
else
installdir=`eval echo $1`
installed_rosbe_version=`cat $installdir/RosBE-Version 2>/dev/null`

if [ "$installed_rosbe_version" != "$ROSBE_VERSION" ]; then
rs_redmsg "Installation directory \"$installdir\" contains ReactOS Build Environment version $installed_rosbe_version,"
rs_redmsg "which doesn't match the version of this add-on ($ROSBE_VERSION). Aborted."
exit 1
fi

echo "Using \"$installdir\""
echo
fi

rs_process_binutils=true
rs_process_gcc=true
rs_process_mingw_w64=true

rs_prefixdir="$installdir"
rs_archprefixdir="$installdir/$TARGET_ARCH"

##### BEGIN almost shared buildtoolchain/RosBE-Unix building part #############
rs_boldmsg "Building..."

mkdir -p "$rs_archprefixdir/$rs_target"

echo "Using CFLAGS=\"$CFLAGS\""
echo "Using CXXFLAGS=\"$CXXFLAGS\""
echo

rs_cpucount=`$rs_prefixdir/bin/cpucount -x1`

if rs_prepare_module "binutils"; then
rs_do_command ../binutils/configure --prefix="$rs_archprefixdir" --target="$rs_target" --with-sysroot="$rs_archprefixdir" --disable-multilib --disable-werror --enable-lto --enable-plugins --with-zlib=yes --disable-nls
rs_do_command $rs_makecmd -j $rs_cpucount
rs_do_command $rs_makecmd install
rs_clean_module "binutils"
fi

if rs_prepare_module "mingw_w64"; then
rs_do_command ../mingw_w64/mingw-w64-headers/configure --prefix="$rs_archprefixdir/$rs_target" --host="$rs_target"
rs_do_command $rs_makecmd -j $rs_cpucount
rs_do_command $rs_makecmd install
rs_do_command ln -s -f $rs_archprefixdir/$rs_target $rs_archprefixdir/mingw
rs_clean_module "mingw_w64"
fi

if rs_prepare_module "gcc"; then
rs_extract_module gmp $PWD/../gcc
rs_extract_module mpc $PWD/../gcc
rs_extract_module mpfr $PWD/../gcc

cd ../gcc-build

export CFLAGS_FOR_TARGET="$rs_target_cflags"
export CXXFLAGS_FOR_TARGET="$rs_target_cxxflags"

rs_do_command ../gcc/configure --prefix="$rs_archprefixdir" --target="$rs_target" --with-sysroot="$rs_archprefixdir" --with-pkgversion="RosBE-Unix" --enable-languages=c,c++ --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-shared --disable-multilib --disable-nls --disable-werror --disable-win32-registry --enable-sjlj-exceptions --disable-libstdcxx-verbose
rs_do_command $rs_makecmd -j $rs_cpucount all-gcc
rs_do_command $rs_makecmd install-gcc
rs_do_command $rs_makecmd install-lto-plugin

if rs_prepare_module "mingw_w64"; then
export AR="$rs_archprefixdir/bin/${rs_target_tool_prefix}ar"
export AS="$rs_archprefixdir/bin/${rs_target_tool_prefix}as"
export CC="$rs_archprefixdir/bin/${rs_target_tool_prefix}gcc"
export CFLAGS="$rs_target_cflags"
export CXX="$rs_archprefixdir/bin/${rs_target_tool_prefix}g++"
export CXXFLAGS="$rs_target_cxxflags"
export DLLTOOL="$rs_archprefixdir/bin/${rs_target_tool_prefix}dlltool"
export RANLIB="$rs_archprefixdir/bin/${rs_target_tool_prefix}ranlib"
export STRIP="$rs_archprefixdir/bin/${rs_target_tool_prefix}strip"

rs_do_command ../mingw_w64/mingw-w64-crt/configure --prefix="$rs_archprefixdir/$rs_target" --host="$rs_target" --with-sysroot="$rs_archprefixdir"
rs_do_command $rs_makecmd -j $rs_cpucount
rs_do_command $rs_makecmd install
rs_clean_module "mingw_w64"

unset AR
unset AS
export CC="$rs_host_cc"
export CFLAGS="$rs_host_cflags"
export CXX="$rs_host_cxx"
export CXXFLAGS="$rs_host_cxxflags"
unset DLLTOOL
unset RANLIB
unset STRIP
fi

cd "$rs_workdir/gcc-build"
rs_do_command $rs_makecmd -j $rs_cpucount
rs_do_command $rs_makecmd install
rs_clean_module "gcc"

unset CFLAGS_FOR_TARGET
unset CXXFLAGS_FOR_TARGET
fi

# Final actions
echo
rs_boldmsg "Final actions"

echo "Removing unneeded files..."
cd "$rs_archprefixdir"
rm -rf $rs_target/doc $rs_target/share include info man mingw share
rm -f lib/* >& /dev/null
##### END almost shared buildtoolchain/RosBE-Unix building part ###############

# See: https://jira.reactos.org/browse/ROSBE-35
osname=`uname`
if [ "$osname" != "Darwin" ]; then
echo "Removing debugging symbols..."
cd "$rs_archprefixdir"
for exe in `find -executable -type f -print`; do
objcopy --only-keep-debug $exe $exe.dbg 2>/dev/null
objcopy --strip-debug $exe 2>/dev/null
objcopy --add-gnu-debuglink=$exe.dbg $exe 2>/dev/null
done

# Executables are created for the host system while most libraries are linked to target components
for exe in `find -name "*.a" -type f -print`; do
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --only-keep-debug $exe $exe.dbg 2>/dev/null
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --strip-debug $exe 2>/dev/null
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --add-gnu-debuglink=$exe.dbg $exe 2>/dev/null
done

for exe in `find -name "*.o" -type f -print`; do
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --only-keep-debug $exe $exe.dbg 2>/dev/null
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --strip-debug $exe 2>/dev/null
$rs_archprefixdir/bin/${rs_target_tool_prefix}objcopy --add-gnu-debuglink=$exe.dbg $exe 2>/dev/null
done
fi

echo "Copying scripts..."
cp "$rs_scriptdir/scripts/amd64/"* "$installdir/amd64"
echo

# Finish
rs_boldmsg "Finished successfully!"
echo "You can switch to the amd64 compiler within the Build Environment by typing:"
echo
echo " charch amd64"
echo
20 changes: 9 additions & 11 deletions RosBE-Unix/Base-i386/RosBE-Builder.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env bash
#
# ReactOS Build Environment for Unix-based Operating Systems - Builder Tool for the Base package
# Copyright 2007-2020 Colin Finck <[email protected]>
# ReactOS Build Environment for Unix-based Operating Systems - Builder Tool for the base package and i386 compiler
# Copyright 2007-2021 Colin Finck <[email protected]>
# partially based on the BuildMingwCross script (http://www.mingw.org/MinGWiki/index.php/BuildMingwCross)
#
# Released under GNU GPL v2 or any later version.
# Released under GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)

if [ -z "$BASH_VERSION" ]; then
exec bash "$0"
Expand Down Expand Up @@ -37,7 +37,7 @@ rs_sourcedir="$rs_scriptdir/sources"

# RosBE-Unix Constants
DEFAULT_INSTALL_DIR="/usr/local/RosBE"
ROSBE_VERSION="2.2.1"
ROSBE_VERSION="2.3"
TARGET_ARCH="i386"

source "$rs_scriptdir/scripts/rosbelibrary.sh"
Expand All @@ -46,15 +46,15 @@ source "$rs_scriptdir/scripts/setuplibrary.sh"

echo "*******************************************************************************"
echo "* ReactOS Build Environment for Unix-based Operating Systems *"
echo "* Builder Tool for the Base package *"
echo "* Builder Tool for the Base package and i386 compiler *"
echo "* by Colin Finck <[email protected]> *"
echo "* *"
echo "* Version $ROSBE_VERSION *"
printf "* Version %-8s *\n" $ROSBE_VERSION
echo "*******************************************************************************"

echo
echo "This script compiles and installs a complete Build Environment for building"
echo "ReactOS."
echo "ReactOS for i386 (x86) processors."
echo

if [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "--help" ]; then
Expand All @@ -77,9 +77,6 @@ fi

rs_check_requirements

reinstall=false
update=false

# Select the installation directory
rs_boldmsg "Installation Directory"

Expand Down Expand Up @@ -316,7 +313,8 @@ if [ "$osname" != "Darwin" ]; then
fi

echo "Copying scripts..."
cp -R "$rs_scriptdir/scripts/"* "$installdir"
cp "$rs_scriptdir/scripts/"* "$installdir" 2>/dev/null
cp "$rs_scriptdir/scripts/i386/"* "$installdir/i386"

echo "Writing version..."
echo "$ROSBE_VERSION" > "$installdir/RosBE-Version"
Expand Down
Loading