Import FBE build scripts.
This commit is contained in:
commit
251f48ec88
|
@ -0,0 +1,344 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Working Directories
|
||||||
|
SRCDIR="$(pwd)/sources"
|
||||||
|
BINDIR="$(pwd)/binaries"
|
||||||
|
WRKDIR="$(pwd)"
|
||||||
|
|
||||||
|
# Binutils Settings
|
||||||
|
BINUTILSDIR="${SRCDIR}/binutils"
|
||||||
|
BINUTILSTAG="binutils-2_35"
|
||||||
|
BINUTILSVCS="git://sourceware.org/git/binutils-gdb.git"
|
||||||
|
|
||||||
|
# CMake Settings
|
||||||
|
CMAKEDIR="${SRCDIR}/cmake"
|
||||||
|
CMAKETAG="v3.18.1"
|
||||||
|
CMAKEVCS="https://gitlab.kitware.com/cmake/cmake.git"
|
||||||
|
|
||||||
|
# GCC Settings
|
||||||
|
GCCDIR="${SRCDIR}/gcc"
|
||||||
|
GCCTAG="releases/gcc-9.3.0"
|
||||||
|
GCCVCS="git://gcc.gnu.org/git/gcc.git"
|
||||||
|
|
||||||
|
# Mingw-w64 Settings
|
||||||
|
MINGWDIR="${SRCDIR}/mingw-w64"
|
||||||
|
MINGWTAG="v6.0.0"
|
||||||
|
MINGWVCS="https://github.com/mirror/mingw-w64.git"
|
||||||
|
|
||||||
|
# Ninja Settings
|
||||||
|
NINJADIR="${SRCDIR}/ninja"
|
||||||
|
NINJATAG="v1.10.0"
|
||||||
|
NINJAVCS="https://github.com/ninja-build/ninja.git"
|
||||||
|
|
||||||
|
# Architecture Settings
|
||||||
|
ARCHS="i686 x86_64"
|
||||||
|
GENERIC="generic-w64-mingw32"
|
||||||
|
|
||||||
|
|
||||||
|
binutils_build()
|
||||||
|
{
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${BINUTILSDIR}/build-${ARCH}
|
||||||
|
mkdir -p ${BINUTILSDIR}/build-${ARCH}
|
||||||
|
cd ${BINUTILSDIR}/build-${ARCH}
|
||||||
|
../configure \
|
||||||
|
--target=${ARCH}-w64-mingw32 \
|
||||||
|
--prefix=${BINDIR} \
|
||||||
|
--with-sysroot=${BINDIR} \
|
||||||
|
--with-zlib=yes \
|
||||||
|
--disable-multilib \
|
||||||
|
--disable-nls \
|
||||||
|
--disable-werror \
|
||||||
|
--enable-lto \
|
||||||
|
--enable-plugins
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
binutils_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${BINUTILSDIR} ]; then
|
||||||
|
git clone ${BINUTILSVCS} ${BINUTILSDIR}
|
||||||
|
cd ${BINUTILSDIR}
|
||||||
|
git checkout tags/${BINUTILSTAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cmake_build()
|
||||||
|
{
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${CMAKEDIR}/build-${GENERIC}
|
||||||
|
mkdir -p ${CMAKEDIR}/build-${GENERIC}
|
||||||
|
cd ${CMAKEDIR}/build-${GENERIC}
|
||||||
|
../bootstrap \
|
||||||
|
--prefix=${BINDIR} \
|
||||||
|
--parallel=${CORES} \
|
||||||
|
-- -DCMAKE_USE_OPENSSL=OFF
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
cmake_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${CMAKEDIR} ]; then
|
||||||
|
git clone ${CMAKEVCS} ${CMAKEDIR}
|
||||||
|
cd ${CMAKEDIR}
|
||||||
|
git checkout tags/${CMAKETAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
gcc_build_phase1()
|
||||||
|
{
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${GCCDIR}/build-${ARCH}
|
||||||
|
mkdir -p ${GCCDIR}/build-${ARCH}
|
||||||
|
cd ${GCCDIR}/build-${ARCH}
|
||||||
|
../configure \
|
||||||
|
--target=${ARCH}-w64-mingw32 \
|
||||||
|
--prefix=${BINDIR} \
|
||||||
|
--with-sysroot=${BINDIR} \
|
||||||
|
--with-pkgversion="FerretOS Build Environment" \
|
||||||
|
--without-zstd \
|
||||||
|
--disable-libstdcxx-verbose \
|
||||||
|
--disable-multilib \
|
||||||
|
--disable-nls \
|
||||||
|
--disable-shared \
|
||||||
|
--disable-werror \
|
||||||
|
--disable-win32-registry \
|
||||||
|
--enable-fully-dynamic-string \
|
||||||
|
--enable-languages=c,c++ \
|
||||||
|
--enable-lto \
|
||||||
|
--enable-sjlj-exceptions \
|
||||||
|
--enable-version-specific-runtime-libs
|
||||||
|
make -j${CORES} all-gcc
|
||||||
|
make install-gcc
|
||||||
|
make install-lto-plugin
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
gcc_build_phase2()
|
||||||
|
{
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
cd ${GCCDIR}/build-${ARCH}
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
gcc_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${GCCDIR} ]; then
|
||||||
|
git clone ${GCCVCS} ${GCCDIR}
|
||||||
|
cd ${GCCDIR}
|
||||||
|
git checkout tags/${GCCTAG}
|
||||||
|
./contrib/download_prerequisites
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
mingw_build_crt()
|
||||||
|
{
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
||||||
|
mkdir -p ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
||||||
|
cd ${MINGWDIR}/mingw-w64-crt/build-${ARCH}
|
||||||
|
case ${ARCH} in
|
||||||
|
i686)
|
||||||
|
FLAGS="--enable-lib32 --disable-lib64"
|
||||||
|
;;
|
||||||
|
x86_64)
|
||||||
|
FLAGS="--disable-lib32 --enable-lib64"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
ORIGPATH="${PATH}"
|
||||||
|
PATH="${BINDIR}/bin:${PATH}"
|
||||||
|
../configure \
|
||||||
|
--host=${ARCH}-w64-mingw32 \
|
||||||
|
--prefix=${BINDIR}/${ARCH}-w64-mingw32 \
|
||||||
|
--with-sysroot=${BINDIR} \
|
||||||
|
--with-default-msvcrt=msvcrt \
|
||||||
|
${FLAGS}
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
PATH="${ORIGPATH}"
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
mingw_build_headers()
|
||||||
|
{
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
||||||
|
mkdir -p ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
||||||
|
cd ${MINGWDIR}/mingw-w64-headers/build-${GENERIC}
|
||||||
|
../configure \
|
||||||
|
--prefix=${BINDIR}/${GENERIC} \
|
||||||
|
--enable-idl \
|
||||||
|
--with-default-msvcrt=msvcrt \
|
||||||
|
--with-default-win32-winnt=0x502
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
mkdir -p ${BINDIR}/mingw
|
||||||
|
if [ ! -e ${BINDIR}/mingw/include ]; then
|
||||||
|
ln -sfn ../${GENERIC}/include ${BINDIR}/mingw/include
|
||||||
|
fi
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
mkdir -p ${BINDIR}/${ARCH}-w64-mingw32
|
||||||
|
if [ ! -e ${BINDIR}/${ARCH}-w64-mingw32/include ]; then
|
||||||
|
ln -sfn ../${GENERIC}/include ${BINDIR}/${ARCH}-w64-mingw32/include
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
mingw_build_libs()
|
||||||
|
{
|
||||||
|
for LIB in libmangle winstorecompat; do
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
||||||
|
mkdir -p ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
||||||
|
cd ${MINGWDIR}/mingw-w64-libraries/${LIB}/build-${ARCH}
|
||||||
|
ORIGPATH="${PATH}"
|
||||||
|
PATH="${BINDIR}/bin:${PATH}"
|
||||||
|
../configure \
|
||||||
|
--host=${ARCH}-w64-mingw32 \
|
||||||
|
--prefix=${BINDIR}/${ARCH}-w64-mingw32 \
|
||||||
|
--libdir=${BINDIR}/${ARCH}-w64-mingw32/lib
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
PATH="${ORIGPATH}"
|
||||||
|
done
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
mingw_build_tools()
|
||||||
|
{
|
||||||
|
for TOOL in gendef genidl genlib genpeimg widl; do
|
||||||
|
for ARCH in ${ARCHS}; do
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
||||||
|
mkdir -p ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
||||||
|
cd ${MINGWDIR}/mingw-w64-tools/${TOOL}/build-${ARCH}
|
||||||
|
../configure \
|
||||||
|
--target=${ARCH}-w64-mingw32 \
|
||||||
|
--prefix=${BINDIR}
|
||||||
|
make -j${CORES}
|
||||||
|
make install
|
||||||
|
if [ -e ${BINDIR}/bin/${TOOL} ]; then
|
||||||
|
mv ${BINDIR}/bin/${TOOL} ${BINDIR}/bin/${ARCH}-w64-mingw32-${TOOL}
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
mingw_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${MINGWDIR} ]; then
|
||||||
|
git clone ${MINGWVCS} ${MINGWDIR}
|
||||||
|
cd ${MINGWDIR}
|
||||||
|
git checkout tags/${MINGWTAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
ninja_build()
|
||||||
|
{
|
||||||
|
[ -z ${CLEAN} ] || rm -rf ${NINJADIR}/build-${GENERIC}
|
||||||
|
mkdir -p ${NINJADIR}/build-${GENERIC}
|
||||||
|
cd ${NINJADIR}/build-${GENERIC}
|
||||||
|
../configure.py --bootstrap
|
||||||
|
install ninja ${BINDIR}/bin/
|
||||||
|
cd ${WRKDIR}
|
||||||
|
}
|
||||||
|
|
||||||
|
ninja_fetch()
|
||||||
|
{
|
||||||
|
if [ ! -d ${NINJADIR} ]; then
|
||||||
|
git clone ${NINJAVCS} ${NINJADIR}
|
||||||
|
cd ${NINJADIR}
|
||||||
|
git checkout tags/${NINJATAG}
|
||||||
|
cd ${WRKDIR}
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if script launched as root
|
||||||
|
if [ "$(whoami)" = "root" ]; then
|
||||||
|
echo "This script cannot be run as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check number of CPU cores available
|
||||||
|
: ${CORES:=$(sysctl -n hw.ncpu 2>/dev/null)}
|
||||||
|
: ${CORES:=$(nproc 2>/dev/null)}
|
||||||
|
: ${CORES:=1}
|
||||||
|
|
||||||
|
# Create working directories
|
||||||
|
mkdir -p ${BINDIR}
|
||||||
|
mkdir -p ${SRCDIR}
|
||||||
|
|
||||||
|
# Download Mingw-W64
|
||||||
|
mingw_fetch
|
||||||
|
|
||||||
|
# Build and install Mingw-W64 headers
|
||||||
|
mingw_build_headers
|
||||||
|
|
||||||
|
# Download Binutils
|
||||||
|
binutils_fetch
|
||||||
|
|
||||||
|
# Build and install Binutils
|
||||||
|
binutils_build
|
||||||
|
|
||||||
|
# Download GCC
|
||||||
|
gcc_fetch
|
||||||
|
|
||||||
|
# Build and install minimal GCC
|
||||||
|
gcc_build_phase1
|
||||||
|
|
||||||
|
# Build and install MSVCRT
|
||||||
|
mingw_build_crt
|
||||||
|
|
||||||
|
# Build and install GCC
|
||||||
|
gcc_build_phase2
|
||||||
|
|
||||||
|
# Build and install Mingw-W64 libraries
|
||||||
|
mingw_build_libs
|
||||||
|
|
||||||
|
# Build and install Mingw-W64 tools
|
||||||
|
mingw_build_tools
|
||||||
|
|
||||||
|
# Download CMake
|
||||||
|
cmake_fetch
|
||||||
|
|
||||||
|
# Build and install CMake
|
||||||
|
cmake_build
|
||||||
|
|
||||||
|
# Download Ninja
|
||||||
|
ninja_fetch
|
||||||
|
|
||||||
|
# Build and install Ninja
|
||||||
|
ninja_build
|
||||||
|
|
||||||
|
# Remove unneeded files to save disk space
|
||||||
|
echo "Removing unneeded files to save disk space..."
|
||||||
|
rm -rf ${BINDIR}/{doc,include,mingw,share/{bash-completion,emacs,gcc*,info,man,vim}}
|
||||||
|
|
||||||
|
# Copy all scripts
|
||||||
|
echo "Copying scripts..."
|
||||||
|
cp -apf ${WRKDIR}/scripts/* ${BINDIR}/
|
||||||
|
|
||||||
|
# Save FBE version
|
||||||
|
cd ${WRKDIR}
|
||||||
|
: ${FBEVER:=$(git describe --exact-match --tags 2>/dev/null)}
|
||||||
|
: ${FBEVER:=DEV}
|
||||||
|
echo "${FBEVER}" > ${BINDIR}/Version
|
||||||
|
|
||||||
|
# Prepare archive
|
||||||
|
echo "Creating toolchain archive..."
|
||||||
|
tar --zstd -cf fbe-${FBEVER}-linux.tar.zst -C ${BINDIR} .
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,364 @@
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/header.c b/mingw-w64-tools/widl/src/header.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/header.c 2020-08-01 22:51:29.248778551 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/header.c 2020-08-01 21:41:41.998028252 +0200
|
||||||
|
@@ -1221,7 +1221,7 @@ static void write_inline_wrappers(FILE *
|
||||||
|
if (!is_callas(func->attrs)) {
|
||||||
|
const var_t *arg;
|
||||||
|
|
||||||
|
- fprintf(header, "static FORCEINLINE ");
|
||||||
|
+ fprintf(header, "FORCEINLINE ");
|
||||||
|
write_type_decl_left(header, type_function_get_ret(func->declspec.type));
|
||||||
|
fprintf(header, " %s_%s(", name, get_name(func));
|
||||||
|
write_args(header, type_function_get_args(func->declspec.type), name, 1, FALSE);
|
||||||
|
@@ -1256,7 +1256,16 @@ static void do_write_c_method_def(FILE *
|
||||||
|
|
||||||
|
if (type_iface_get_inherit(iface))
|
||||||
|
do_write_c_method_def(header, type_iface_get_inherit(iface), name);
|
||||||
|
-
|
||||||
|
+ else if (type_iface_get_stmts(iface) == NULL)
|
||||||
|
+ {
|
||||||
|
+ fprintf(header, "#ifndef __cplusplus\n");
|
||||||
|
+ indent(header, 0);
|
||||||
|
+ fprintf(header, "char dummy;\n");
|
||||||
|
+ fprintf(header, "#endif\n");
|
||||||
|
+ fprintf(header, "\n");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
STATEMENTS_FOR_EACH_FUNC(stmt, type_iface_get_stmts(iface))
|
||||||
|
{
|
||||||
|
const var_t *func = stmt->u.var;
|
||||||
|
@@ -1804,6 +1813,11 @@ void write_header(const statement_list_t
|
||||||
|
fprintf(header, "#ifndef __REQUIRED_RPCNDR_H_VERSION__\n");
|
||||||
|
fprintf(header, "#define __REQUIRED_RPCNDR_H_VERSION__ 475\n");
|
||||||
|
fprintf(header, "#endif\n");
|
||||||
|
+
|
||||||
|
+ fprintf(header, "#ifdef __REACTOS__\n");
|
||||||
|
+ fprintf(header, "#define WIN32_LEAN_AND_MEAN\n");
|
||||||
|
+ fprintf(header, "#endif\n\n");
|
||||||
|
+
|
||||||
|
fprintf(header, "#include <rpc.h>\n" );
|
||||||
|
fprintf(header, "#include <rpcndr.h>\n" );
|
||||||
|
if (!for_each_serializable(stmts, NULL, serializable_exists))
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/parser.tab.c b/mingw-w64-tools/widl/src/parser.tab.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/parser.tab.c 2020-08-01 22:51:29.249778547 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/parser.tab.c 2020-08-01 22:55:45.839676740 +0200
|
||||||
|
@@ -196,8 +196,6 @@ static struct namespace global_namespace
|
||||||
|
|
||||||
|
static struct namespace *current_namespace = &global_namespace;
|
||||||
|
|
||||||
|
-static typelib_t *current_typelib;
|
||||||
|
-
|
||||||
|
|
||||||
|
#line 203 "parser.tab.c" /* yacc.c:339 */
|
||||||
|
|
||||||
|
@@ -2612,7 +2610,6 @@ yyreduce:
|
||||||
|
write_client((yyvsp[-1].stmt_list));
|
||||||
|
write_server((yyvsp[-1].stmt_list));
|
||||||
|
write_regscript((yyvsp[-1].stmt_list));
|
||||||
|
- write_typelib_regscript((yyvsp[-1].stmt_list));
|
||||||
|
write_dlldata((yyvsp[-1].stmt_list));
|
||||||
|
write_local_stubs((yyvsp[-1].stmt_list));
|
||||||
|
}
|
||||||
|
@@ -2893,7 +2890,7 @@ yyreduce:
|
||||||
|
|
||||||
|
case 52:
|
||||||
|
#line 424 "parser.y" /* yacc.c:1651 */
|
||||||
|
- { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str), current_typelib); }
|
||||||
|
+ { (yyval.str) = (yyvsp[-2].str); if(!parse_only) add_importlib((yyvsp[-2].str)); }
|
||||||
|
#line 2898 "parser.tab.c" /* yacc.c:1651 */
|
||||||
|
break;
|
||||||
|
|
||||||
|
@@ -2912,7 +2909,7 @@ yyreduce:
|
||||||
|
case 55:
|
||||||
|
#line 430 "parser.y" /* yacc.c:1651 */
|
||||||
|
{ (yyval.typelib) = make_library((yyvsp[-1].str), check_library_attrs((yyvsp[-1].str), (yyvsp[-2].attr_list)));
|
||||||
|
- if (!parse_only && do_typelib) current_typelib = (yyval.typelib);
|
||||||
|
+ if (!parse_only) start_typelib(yyval.typelib);
|
||||||
|
}
|
||||||
|
#line 2918 "parser.tab.c" /* yacc.c:1651 */
|
||||||
|
break;
|
||||||
|
@@ -6019,6 +6016,12 @@ static type_t *reg_typedefs(decl_spec_t
|
||||||
|
type->attrs = attrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it */
|
||||||
|
+ if (type_get_type_detect_alias(type) == TYPE_UNION &&
|
||||||
|
+ is_attr(attrs, ATTR_SWITCHTYPE) &&
|
||||||
|
+ !is_attr(type->attrs, ATTR_SWITCHTYPE))
|
||||||
|
+ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
|
||||||
|
+
|
||||||
|
LIST_FOR_EACH_ENTRY( decl, decls, declarator_t, entry )
|
||||||
|
{
|
||||||
|
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/parser.y b/mingw-w64-tools/widl/src/parser.y
|
||||||
|
--- a/mingw-w64-tools/widl/src/parser.y 2020-08-01 22:51:29.250778543 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/parser.y 2020-08-01 21:48:30.318245917 +0200
|
||||||
|
@@ -123,8 +123,6 @@ static struct namespace global_namespace
|
||||||
|
|
||||||
|
static struct namespace *current_namespace = &global_namespace;
|
||||||
|
|
||||||
|
-static typelib_t *current_typelib;
|
||||||
|
-
|
||||||
|
%}
|
||||||
|
%union {
|
||||||
|
attr_t *attr;
|
||||||
|
@@ -320,7 +318,6 @@ input: gbl_statements m_acf { check_st
|
||||||
|
write_client($1);
|
||||||
|
write_server($1);
|
||||||
|
write_regscript($1);
|
||||||
|
- write_typelib_regscript($1);
|
||||||
|
write_dlldata($1);
|
||||||
|
write_local_stubs($1);
|
||||||
|
}
|
||||||
|
@@ -421,18 +418,18 @@ import: import_start imp_statements aEOF
|
||||||
|
;
|
||||||
|
|
||||||
|
importlib: tIMPORTLIB '(' aSTRING ')'
|
||||||
|
- semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3, current_typelib); }
|
||||||
|
+ semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3); }
|
||||||
|
;
|
||||||
|
|
||||||
|
libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; }
|
||||||
|
| tLIBRARY aKNOWNTYPE { $$ = $2; }
|
||||||
|
;
|
||||||
|
library_start: attributes libraryhdr '{' { $$ = make_library($2, check_library_attrs($2, $1));
|
||||||
|
- if (!parse_only && do_typelib) current_typelib = $$;
|
||||||
|
+ if (!parse_only) start_typelib($$);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
librarydef: library_start imp_statements '}'
|
||||||
|
- semicolon_opt { $$ = $1; $$->stmts = $2; }
|
||||||
|
+ semicolon_opt { $$ = $1; $$->stmts = $2; if (!parse_only) end_typelib(); }
|
||||||
|
;
|
||||||
|
|
||||||
|
m_args: { $$ = NULL; }
|
||||||
|
@@ -1906,6 +1903,12 @@ static type_t *reg_typedefs(decl_spec_t
|
||||||
|
type->attrs = attrs;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */
|
||||||
|
+ if (type_get_type_detect_alias(type) == TYPE_UNION &&
|
||||||
|
+ is_attr(attrs, ATTR_SWITCHTYPE) &&
|
||||||
|
+ !is_attr(type->attrs, ATTR_SWITCHTYPE))
|
||||||
|
+ type->attrs = append_attr(type->attrs, make_attrp(ATTR_SWITCHTYPE, get_attrp(attrs, ATTR_SWITCHTYPE)));
|
||||||
|
+
|
||||||
|
LIST_FOR_EACH_ENTRY( decl, decls, declarator_t, entry )
|
||||||
|
{
|
||||||
|
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/proxy.c b/mingw-w64-tools/widl/src/proxy.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/proxy.c 2020-08-01 22:51:29.079779285 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/proxy.c 2020-08-01 22:56:14.230555312 +0200
|
||||||
|
@@ -88,6 +88,12 @@ static void init_proxy(const statement_l
|
||||||
|
print_proxy( "/*** Autogenerated by WIDL %s from %s - Do not edit ***/\n", PACKAGE_VERSION, input_name);
|
||||||
|
print_proxy( "\n");
|
||||||
|
print_proxy( "#define __midl_proxy\n");
|
||||||
|
+
|
||||||
|
+ print_proxy( "#ifdef __REACTOS__\n");
|
||||||
|
+ print_proxy( "#define WIN32_NO_STATUS\n");
|
||||||
|
+ print_proxy( "#define WIN32_LEAN_AND_MEAN\n");
|
||||||
|
+ print_proxy( "#endif\n\n");
|
||||||
|
+
|
||||||
|
print_proxy( "#include \"objbase.h\"\n");
|
||||||
|
print_proxy( "\n");
|
||||||
|
print_proxy( "#ifndef DECLSPEC_HIDDEN\n");
|
||||||
|
@@ -482,14 +488,15 @@ static const statement_t * get_callas_so
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static void write_proxy_procformatstring_offsets( const type_t *iface, int skip )
|
||||||
|
+static int write_proxy_procformatstring_offsets( const type_t *iface, int skip )
|
||||||
|
{
|
||||||
|
const statement_t *stmt;
|
||||||
|
+ int i;
|
||||||
|
|
||||||
|
if (type_iface_get_inherit(iface))
|
||||||
|
- write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
|
||||||
|
+ i = write_proxy_procformatstring_offsets( type_iface_get_inherit(iface), need_delegation(iface));
|
||||||
|
else
|
||||||
|
- return;
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
|
||||||
|
{
|
||||||
|
@@ -509,7 +516,9 @@ static void write_proxy_procformatstring
|
||||||
|
print_proxy( "(unsigned short)-1, /* %s::%s */\n", iface->name, get_name(func));
|
||||||
|
else
|
||||||
|
print_proxy( "%u, /* %s::%s */\n", func->procstring_offset, iface->name, get_name(func));
|
||||||
|
+ i++;
|
||||||
|
}
|
||||||
|
+ return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int write_proxy_methods(type_t *iface, int skip)
|
||||||
|
@@ -643,7 +652,10 @@ static void write_proxy(type_t *iface, u
|
||||||
|
print_proxy( "static const unsigned short %s_FormatStringOffsetTable[] =\n", iface->name );
|
||||||
|
print_proxy( "{\n" );
|
||||||
|
indent++;
|
||||||
|
- write_proxy_procformatstring_offsets( iface, 0 );
|
||||||
|
+ if (write_proxy_procformatstring_offsets( iface, 0 ) == 0)
|
||||||
|
+ {
|
||||||
|
+ print_proxy( "0\n" );
|
||||||
|
+ }
|
||||||
|
indent--;
|
||||||
|
print_proxy( "};\n\n" );
|
||||||
|
|
||||||
|
@@ -718,7 +730,10 @@ static void write_proxy(type_t *iface, u
|
||||||
|
print_proxy( "static const PRPC_STUB_FUNCTION %s_table[] =\n", iface->name);
|
||||||
|
print_proxy( "{\n");
|
||||||
|
indent++;
|
||||||
|
- write_stub_methods(iface, FALSE);
|
||||||
|
+ if (write_stub_methods(iface, FALSE) == 0)
|
||||||
|
+ {
|
||||||
|
+ fprintf(proxy, 0);
|
||||||
|
+ }
|
||||||
|
fprintf(proxy, "\n");
|
||||||
|
indent--;
|
||||||
|
fprintf(proxy, "};\n\n");
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/register.c b/mingw-w64-tools/widl/src/register.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/register.c 2020-08-01 22:52:08.525607975 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/register.c 2020-08-01 22:56:25.382507605 +0200
|
||||||
|
@@ -324,6 +324,9 @@ void output_typelib_regscript( const typ
|
||||||
|
put_str( indent++, "{\n" );
|
||||||
|
expr = get_attrp( typelib->attrs, ATTR_ID );
|
||||||
|
if (expr)
|
||||||
|
+ sprintf(id_part, "\\%d", expr->cval);
|
||||||
|
+
|
||||||
|
+ if (expr)
|
||||||
|
{
|
||||||
|
sprintf(id_part, "\\%d", expr->cval);
|
||||||
|
resname = xmalloc( strlen(typelib_name) + 20 );
|
||||||
|
@@ -349,5 +352,5 @@ void output_typelib_regscript( const typ
|
||||||
|
write_progids( typelib->stmts );
|
||||||
|
put_str( --indent, "}\n" );
|
||||||
|
|
||||||
|
- add_output_to_resources( "WINE_REGISTRY", resname );
|
||||||
|
+ add_output_to_resources( "WINE_REGISTRY", typelib_name );
|
||||||
|
}
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/typegen.c b/mingw-w64-tools/widl/src/typegen.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/typegen.c 2020-08-01 22:51:29.250778543 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/typegen.c 2020-08-01 22:56:33.110474542 +0200
|
||||||
|
@@ -4816,7 +4816,7 @@ void write_func_param_struct( FILE *file
|
||||||
|
if (align >= pointer_size)
|
||||||
|
fprintf( file, "%s;\n", arg->name );
|
||||||
|
else
|
||||||
|
- fprintf( file, "%s DECLSPEC_ALIGN(%u);\n", arg->name, pointer_size );
|
||||||
|
+ fprintf( file, "DECLSPEC_ALIGN(%u) %s;\n", pointer_size, arg->name );
|
||||||
|
}
|
||||||
|
if (add_retval && !is_void( retval->declspec.type ))
|
||||||
|
{
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/typelib.c b/mingw-w64-tools/widl/src/typelib.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/typelib.c 2020-08-01 22:51:29.080779281 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/typelib.c 2020-08-01 22:56:40.014445003 +0200
|
||||||
|
@@ -44,6 +44,7 @@
|
||||||
|
#include "typelib_struct.h"
|
||||||
|
#include "typetree.h"
|
||||||
|
|
||||||
|
+static typelib_t *typelib;
|
||||||
|
|
||||||
|
/* List of oleauto types that should be recognized by name.
|
||||||
|
* (most of) these seem to be intrinsic types in mktyplib.
|
||||||
|
@@ -239,6 +240,18 @@ unsigned short get_type_vt(type_t *t)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+void start_typelib(typelib_t *typelib_type)
|
||||||
|
+{
|
||||||
|
+ if (!do_typelib) return;
|
||||||
|
+ typelib = typelib_type;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void end_typelib(void)
|
||||||
|
+{
|
||||||
|
+ if (!typelib) return;
|
||||||
|
+ create_msft_typelib(typelib);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void tlb_read(int fd, void *buf, int count)
|
||||||
|
{
|
||||||
|
if(read(fd, buf, count) < count)
|
||||||
|
@@ -363,7 +376,7 @@ static void read_importlib(importlib_t *
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
-void add_importlib(const char *name, typelib_t *typelib)
|
||||||
|
+void add_importlib(const char *name)
|
||||||
|
{
|
||||||
|
importlib_t *importlib;
|
||||||
|
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/typelib.h b/mingw-w64-tools/widl/src/typelib.h
|
||||||
|
--- a/mingw-w64-tools/widl/src/typelib.h 2020-08-01 22:52:08.525607975 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/typelib.h 2020-08-01 22:56:45.782420322 +0200
|
||||||
|
@@ -21,7 +21,9 @@
|
||||||
|
#ifndef __WIDL_TYPELIB_H
|
||||||
|
#define __WIDL_TYPELIB_H
|
||||||
|
|
||||||
|
-extern void add_importlib(const char *name, typelib_t *typelib);
|
||||||
|
+extern void start_typelib(typelib_t *typelib_type);
|
||||||
|
+extern void end_typelib(void);
|
||||||
|
+extern void add_importlib(const char *name);
|
||||||
|
|
||||||
|
/* Copied from wtypes.h. Not included directly because that would create a
|
||||||
|
* circular dependency (after all, wtypes.h is generated by widl...) */
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/widl.c 2020-08-01 22:52:08.526607970 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/widl.c 2020-08-01 21:36:56.893265451 +0200
|
||||||
|
@@ -388,6 +388,12 @@ static void write_dlldata_list(struct li
|
||||||
|
fprintf(dlldata, "- Do not edit ***/\n\n");
|
||||||
|
if (define_proxy_delegation)
|
||||||
|
fprintf(dlldata, "#define PROXY_DELEGATION\n");
|
||||||
|
+
|
||||||
|
+ fprintf(dlldata, "#ifdef __REACTOS__\n");
|
||||||
|
+ fprintf(dlldata, "#define WIN32_NO_STATUS\n");
|
||||||
|
+ fprintf(dlldata, "#define WIN32_LEAN_AND_MEAN\n");
|
||||||
|
+ fprintf(dlldata, "#endif\n\n");
|
||||||
|
+
|
||||||
|
fprintf(dlldata, "#include <objbase.h>\n");
|
||||||
|
fprintf(dlldata, "#include <rpcproxy.h>\n\n");
|
||||||
|
start_cplusplus_guard(dlldata);
|
||||||
|
@@ -533,6 +539,12 @@ void write_id_data(const statement_list_
|
||||||
|
|
||||||
|
fprintf(idfile, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION);
|
||||||
|
fprintf(idfile, "from %s - Do not edit ***/\n\n", input_idl_name);
|
||||||
|
+
|
||||||
|
+ fprintf(idfile, "#ifdef __REACTOS__\n");
|
||||||
|
+ fprintf(idfile, "#define WIN32_NO_STATUS\n");
|
||||||
|
+ fprintf(idfile, "#define WIN32_LEAN_AND_MEAN\n");
|
||||||
|
+ fprintf(idfile, "#endif\n\n");
|
||||||
|
+
|
||||||
|
fprintf(idfile, "#include <rpc.h>\n");
|
||||||
|
fprintf(idfile, "#include <rpcndr.h>\n\n");
|
||||||
|
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/widl.h b/mingw-w64-tools/widl/src/widl.h
|
||||||
|
--- a/mingw-w64-tools/widl/src/widl.h 2020-08-01 22:52:08.526607970 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/widl.h 2020-08-01 22:56:54.478383110 +0200
|
||||||
|
@@ -96,7 +96,6 @@ extern void write_proxies(const statemen
|
||||||
|
extern void write_client(const statement_list_t *stmts);
|
||||||
|
extern void write_server(const statement_list_t *stmts);
|
||||||
|
extern void write_regscript(const statement_list_t *stmts);
|
||||||
|
-extern void write_typelib_regscript(const statement_list_t *stmts);
|
||||||
|
extern void output_typelib_regscript( const typelib_t *typelib );
|
||||||
|
extern void write_local_stubs(const statement_list_t *stmts);
|
||||||
|
extern void write_dlldata(const statement_list_t *stmts);
|
||||||
|
diff -apurN a/mingw-w64-tools/widl/src/write_msft.c b/mingw-w64-tools/widl/src/write_msft.c
|
||||||
|
--- a/mingw-w64-tools/widl/src/write_msft.c 2020-08-01 22:51:29.252778534 +0200
|
||||||
|
+++ b/mingw-w64-tools/widl/src/write_msft.c 2020-08-01 21:39:46.785529130 +0200
|
||||||
|
@@ -54,6 +54,10 @@
|
||||||
|
#include "parser.h"
|
||||||
|
#include "typegen.h"
|
||||||
|
|
||||||
|
+#define S_OK 0
|
||||||
|
+#define S_FALSE 1
|
||||||
|
+#define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
|
||||||
|
+
|
||||||
|
enum MSFT_segment_index {
|
||||||
|
MSFT_SEG_TYPEINFO = 0, /* type information */
|
||||||
|
MSFT_SEG_IMPORTINFO, /* import information */
|
||||||
|
@@ -2663,6 +2667,7 @@ static void save_all_changes(msft_typeli
|
||||||
|
sprintf( typelib_id, "#%d", expr->cval );
|
||||||
|
add_output_to_resources( "TYPELIB", typelib_id );
|
||||||
|
output_typelib_regscript( typelib->typelib );
|
||||||
|
+ flush_output_resources( typelib_name );
|
||||||
|
}
|
||||||
|
else flush_output_buffer( typelib_name );
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Check if script launched as root
|
||||||
|
if [ "$(whoami)" = "root" ]; then
|
||||||
|
echo "This script cannot be run as root!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the absolute path to the FBE
|
||||||
|
export FBEDIR="$(realpath $(dirname ${0}))"
|
||||||
|
|
||||||
|
# Read the FBE version
|
||||||
|
export FBEVER="$(cat ${FBEDIR}/Version)"
|
||||||
|
|
||||||
|
# Load the library
|
||||||
|
source ${FBEDIR}/fbelib.sh
|
||||||
|
|
||||||
|
# Set the target architecture
|
||||||
|
: ${TARGET:=${1}}
|
||||||
|
: ${TARGET:=i386}
|
||||||
|
|
||||||
|
# Save the source directory
|
||||||
|
export SRCDIR="${2:-${PWD}}"
|
||||||
|
|
||||||
|
# Make sure the compiler flags are clean
|
||||||
|
export HOST=
|
||||||
|
export CFLAGS=
|
||||||
|
export CXXFLAGS=
|
||||||
|
export LDFLAGS=
|
||||||
|
|
||||||
|
# Update PATH
|
||||||
|
export PATH="${FBEDIR}/bin:${PATH}"
|
||||||
|
|
||||||
|
# Display banner
|
||||||
|
version
|
||||||
|
|
||||||
|
# Invoke shell
|
||||||
|
bash --rcfile <(echo 'cd ${SRCDIR}')
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Sets the target architecture
|
||||||
|
charch()
|
||||||
|
{
|
||||||
|
if [ "x${1}" == "x" ]; then
|
||||||
|
echo "Syntax: charch [architecture]"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
case ${1} in
|
||||||
|
"i386"|"i486"|"i586"|"i686"|"x86")
|
||||||
|
export TARGET="i386"
|
||||||
|
;;
|
||||||
|
"amd64"|"x64"|"x86_64")
|
||||||
|
export TARGET="amd64"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
export TARGET="UNKNOWN"
|
||||||
|
esac
|
||||||
|
echo "Target Architecture: ${TARGET}"
|
||||||
|
}
|
||||||
|
export -f charch
|
||||||
|
|
||||||
|
# Displays version banner
|
||||||
|
version()
|
||||||
|
{
|
||||||
|
echo "###############################################################################"
|
||||||
|
echo "# FerretOS Build Environment v${FBEVER} for Linux #"
|
||||||
|
echo "# by Rafal Kupiec <belliash@codingworkshop.eu.org> #"
|
||||||
|
echo "###############################################################################"
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "Binutils Version: $(${FBEDIR}/bin/i686-w64-mingw32-ld -v | cut -d' ' -f5)"
|
||||||
|
echo "GCC Version: $(${FBEDIR}/bin/i686-w64-mingw32-gcc -v 2>&1| grep 'gcc version' | cut -d' ' -f3)"
|
||||||
|
echo "IDL Compiler Version: $(${FBEDIR}/bin/i686-w64-mingw32-widl -V | grep 'version' | cut -d' ' -f5)"
|
||||||
|
charch ${TARGET}
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
export -f version
|
Loading…
Reference in New Issue