Milestone 5: deliver embedded RDP sessions and lifecycle hardening

This commit is contained in:
Keith Smith
2026-03-03 18:59:26 -07:00
parent 230a401386
commit 36006bd4aa
2941 changed files with 724359 additions and 77 deletions

2685
third_party/FreeRDP/docs/Doxyfile vendored Normal file

File diff suppressed because it is too large Load Diff

5
third_party/FreeRDP/docs/FreeRDP.css vendored Normal file
View File

@@ -0,0 +1,5 @@
#projectlogo img {
border: 0px none;
height: 48px;
padding: 5px;
}

BIN
third_party/FreeRDP/docs/FreeRDP.vsd vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,131 @@
# Print Format Specifiers
## Lookup Table
We use the following format specifiers for all \*printf\* and WLog_* functions:
| Type | signed | unsigned | octal | hex | HEX |
| ------------------ | --------- | --------- | --------- | --------- | --------- |
| signed char | %hhd | | | | |
| unsigned char | | %hhu | %hho | %hhx | %hhX |
| short | %hd | | | | |
| unsigned short | | %hu | %ho | %hx | %hX |
| int | %d | | | | |
| unsigned int | | %u | %o | %x | %X |
| long | %ld | | | | |
| unsigned long | | %lu | %lo | %lx | %lX |
| long long | %lld | | | | |
| unsigned long long | | %llu | %llo | %llx | %llX |
| size_t | | %"PRIuz" | %"PRIoz" | %"PRIxz" | %"PRIXz" |
| INT8 | %"PRId8" | | | | |
| UINT8 | | %"PRIu8" | %"PRIo8" | %"PRIx8" | %"PRIX8" |
| BOOLEAN | | %"PRIu8" | %"PRIo8" | %"PRIx8" | %"PRIX8" |
| BYTE | | %"PRIu8" | %"PRIo8" | %"PRIx8" | %"PRIX8" |
| CHAR | %"PRId8" | | | | |
| UCHAR | | %"PRIu8" | %"PRIo8" | %"PRIx8" | %"PRIX8" |
| INT16 | %"PRId16" | | | | |
| UINT16 | | %"PRIu16" | %"PRIo16" | %"PRIx16" | %"PRIX16" |
| WORD | | %"PRIu16" | %"PRIo16" | %"PRIx16" | %"PRIX16" |
| WCHAR | | %"PRIu16" | %"PRIo16" | %"PRIx16" | %"PRIX16" |
| SHORT | %"PRId16" | | | | |
| USHORT | | %"PRIu16" | %"PRIo16" | %"PRIx16" | %"PRIX16" |
| INT32 | %"PRId32" | | | | |
| UINT32 | | %"PRIu32" | %"PRIo32" | %"PRIx32" | %"PRIX32" |
| INT | %"PRId32" | | | | |
| UINT | | %"PRIu32" | %"PRIo32" | %"PRIx32" | %"PRIX32" |
| LONG | %"PRId32" | | | | |
| HRESULT | %"PRId32" | | | %"PRIx32" | %"PRIX32" |
| NTSTATUS | %"PRId32" | | | %"PRIx32" | %"PRIX32" |
| ULONG | | %"PRIu32" | %"PRIo32" | %"PRIx32" | %"PRIX32" |
| DWORD | | %"PRIu32" | %"PRIo32" | %"PRIx32" | %"PRIX32" |
| DWORD32 | | %"PRIu32" | %"PRIo32" | %"PRIx32" | %"PRIX32" |
| BOOL | %"PRId32" | | | | |
| INT64 | %"PRId64" | | | | |
| LONG64 | %"PRId64" | | | | |
| LONGLONG | %"PRId64" | | | | |
| UINT64 | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
| ULONG64 | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
| ULONGLONG | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
| DWORDLONG | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
| QWORD | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
| ULONG64 | | %"PRIu64" | %"PRIo64" | %"PRIx64" | %"PRIX64" |
## Pointers
When printing pointers you should cast the argument to ``(void*)``:
```c
rdpContext *pContext;
fprintf(stderr, "rdp context is %p\n", (void*) pContext);
```
If you need more formatting options cast the pointer argument to `size_t` and use
any %"PRI*z" format specifier:
```c
rdpContext *pContext;
fprintf(stderr, "rdp context is %" PRIuz " (0x%" PRIXz ")\n", (size_t) pContext, (size_t) pContext);
```
## Integer Promotion
Remember that integer types smaller than int are promoted when an operation is
performed on them.
Wrong:
```c
UINT8 a, b;
fprintf(stderr, "a - b is %" PRIu8 "\n", a - b);
// depending on the system's PRIu8 definition you might get:
// warning: format specifies type 'unsigned char' but the argument has type 'int'
```
Correct:
```c
UINT8 a, b;
fprintf(stderr, "a - b is %d\n", a - b);
// or ...
fprintf(stderr, "a - b is %" PRIu8 "\n", (UINT8) (a - b));
```
## TCHAR
When using `_tprintf` or similar TCHAR formatting functions or macros you
need to enclose the PRI format defines:
```c
LPCTSTR lpFileName1;
UINT64 fileSize1;
_tprintf(_T("The size of %s is %") _T(PRIu64) _T("\n"), lpFileName1, fileSize1);
```
Since this makes the strings a lot harder to read try to avoid _tprintf if the
arguments don't contain TCHAR types.
Note: If all compilers were C99 compliant we could simply write ...
```c
_tprintf(_T("The size of %s is %") PRIu64 "\n"), lpFileName1, fileSize1);
```
... since the standard says that only one of the character sequences must be
prefixed by an encoding prefix and the rest of them are treated to have the
same. However, Microsoft Visual Studio versions older than VS 2015 are not C99
compliant in this regard.
See [How to use stdint types with _tprintf in Visual Studio 2013](http://stackoverflow.com/questions/41126081/how-to-use-stdint-types-with-tprintf-in-visual-studio-2013)
for more information.
## Links
- [[MS-DTYP] 2.2 Common Data Types](https://msdn.microsoft.com/en-us/library/cc230309.aspx)
- [Understand integer conversion rules](https://www.securecoding.cert.org/confluence/display/c/INT02-C.+Understand+integer+conversion+rules)
- [Printf format strings](https://en.wikipedia.org/wiki/Printf_format_string)
- [C data types - Basic Types](https://en.wikipedia.org/wiki/C_data_types#Basic_types)

86
third_party/FreeRDP/docs/README.android vendored Normal file
View File

@@ -0,0 +1,86 @@
Overview
========
The FreeRDP Android port consists of three parts:
* Android Java GUI (client/Android/Studio)
* FreeRDP library and its dependencies
* JNI bindings (client/Android/android_freerdp.c
and client/Android/Studio/freeRDPCore/src/main/java/com/freerdp/freerdpcore/services/LibFreeRDP.java)
* More documentation might be found at https://github.com/FreeRDP/FreeRDP/wiki/Compilation
Build requirements
=================
For the Android port some additional dependencies need to be fulfilled:
* for JNI
- CMake >= 3.13 (install CMake from Android SDK. It is part of the SDK Tools)
- Android NDK (>= r15c)
* for the Java GUI
- Android SDK
* FreeRDP requires openssl libraries for building but they are not part of the
Android NDK and therefore they need to be prebuild manually.
* [optional] cJSON is required for logging in to Azure accounts
* [optional] Kerberos authentication is supported by MIT or Heimdal kerberos libraries
* [optional] For jpeg support https://github.com/akallabeth/jpeg8d has been tested and used.
However, any other static builds should work as well.
Build native libraries:
======================
From the project root run the build script
./scripts/android-build-freerdp.sh --ndk <ANDROID_NDK> --sdk <ANDROID_SDK>
Set ANDROID_NDK and ANDROID_SDK to the absolute paths on your machine.
This will fetch sources from git and build OpenSSL, OpenH264, libJPEG.
The native FreeRDP libraries will also be build.
Currently the default script builds for:
* armeabi-v7a
* x86
* arm64-v8a
* x86_64
When the script is finished the libraries are ready for android studio to
be picked up in client/Android/Studio/freeRDPCore/src/main/jniLibs
The default configuration build configuration can be found in
./scripts/android-build.conf and is configured to provide debug builds.
They are limited to API level 21 and above.
If release binaries (and old android API support) are required, build 32 bit architectures with
./scripts/android-build-freerdp.sh --ndk <ANDROID_NDK> --sdk <ANDROID_SDK> --conf ./scripts/android-build-32.conf
and 64 bit architectures with
./scripts/android-build-freerdp.sh --ndk <ANDROID_NDK> --sdk <ANDROID_SDK> --conf ./scripts/android-build-64.conf
Building the APK (Android Studio)
================
* Import the folder client/Android/Studio in Android Studio
* You are ready to go
Building the APK (gradle)
================
* change to directory client/Android/Studio
* run ./gradlew build to build
* run ./gradlew tasks for other gradle options
Development
===========
Updating JNI
------------
Whenever the FreeRDP API changes or you need some extra functionality in your Java
GUI the JNI needs to be updated.
The JNI functions are defined in client/Android/android_freerdp.c
Add the new functions to the methods struct.
* edit client/Android/src/com/freerdp/afreerdp/services/LibFreeRDP.Java to
reflect your changes
* edit client/Android/android_freerdp.c and adjust the methods struct to reflect
the changes made.

154
third_party/FreeRDP/docs/README.building vendored Normal file
View File

@@ -0,0 +1,154 @@
More documentation might be found at https://github.com/FreeRDP/FreeRDP/wiki/Compilation
FreeRDP has a few dependencies that are required for proper operation:
1. SSL (required)
RDP requires a secure tunnel and utilizes TLS for this. We do not implement this
ourselves but reuse existing libraries:
We support
* OpenSSL our main development SSL library (-DWITH_OPENSSL=ON, default)
* LibreSSL (supported by community, -DWITH_OPENSSL=ON, drop in replacement)
* MBedTLS (supported by community, -DWITH_OPENSSL=OFF -DWITH_MBEDTLS=ON)
optionally there are some algorithms that can be shipped with FreeRDP itself if the SSL library deprecated them:
* -DWITH_INTERNAL_MD4=ON
* -DWITH_INTERNAL_MD5=ON
* -DWITH_INTERNAL_RC4=ON
2. Kerberos (optional, disable with -DWITH_KRB5=OFF)
Authentication to many services requires kerberos (especially if smartcards are in use)
We support:
* MIT
* Heimdal
3. JSON (optional, disable with -DWITH_JSON_DISABLED=ON)
Azure logon requires HTTP/JSON messages to be parsed.
We support:
* cJSON
* json-c
4. H264
RDP GFX modes (anything newer Windows 8.1 / Server 2012) supports a graphics mode based
on the H264 codec
We support
* OpenH264 (enable with -DWITH_OPENH264=ON)
* FFMPEG (x264 or OpenH264, enable with -DWITH_FFMPEG=ON)
There are some platform specific implementations too (e.g. mediacodec on android) but these
two are the options that are always required.
5. Graphics scaling support (optional, required for HighDPI support)
High DPI support and smart-sizing option require bitmaps to be scaled by the client.
We support
* Swscale (enable with -DWITH_SWSCALE=ON)
* Cairo (enable with -DWITH_CAIRO=ON)
6. Audio encoders/decoders (optional, hightly recommended though)
Sound and Microphone options allow transmission of data in compressed formats.
The most widely supported formats are uncompressed PCM (all systems support that)
and compressed AAC (windows 8 or newer). Some other codecs are supported as well (GSM)
but do not provide the same quality as the afore mentioned ones.
We support
* FAAC / FAAD2 / soxr (encoder/decoder/resampling)
* GSM (older low bandwidth codec, -DWITH_GSM=ON)
* FFMPEG (-DWITH_DSP_FFMPEG)
* SOXR (optional, resampling library, enable with -DWITH_SOX!=ON)
to enable some experimental codecs (mainly AAC encoding) add -DWITH_DSP_EXPERIMENTAL=ON
7. Smartcard (optional)
To utilize smartcards for authentication/redirection
We support
* PCSC (disable with -DWITH_PCSC=OFF)
* pkcs11 (disable with -DWITH_PKCS11=OFF)
PCSC is required for smartcard redirection, pkcs11 for NLA smartcard logon support
8. Unicode (required, use -DWITH_UNICODE_BUILTIN=ON to utilize custom char16 <--> utf8 conversion routines)
Most of the protocol preferably uses UCS-2/UTF16 for strings. To convert to/from UTF-8 a
unicode support library is required:
* Windows natively supports these (well, it is a microsoft protocol after all ;))
* ICU on linux/unix and android
* On Apple (iOS/Mac) we use native NSString unicode conversion routines
9. USB redirection (optional, disable with -DCHANNEL_URBDRC=OFF)
The protocol has an extension (channel) to allow low level USB redirection
We support
* libusb 1
10. Platform support (mainly linux, for others the platform SDK is usually enough)
* SDL2 for the SDL client (all platforms, disable with -DWITH_CLIENT_SDL=OFF)
* CUPS (linux/apple) for printing support (disable with -DWITH_CUPS=OFF)
* libsystemd (linux) for journald logging support (disable with -DWITH_LIBSYSTEMD=OFF)
* PAM headers/libraries (server side authentication)
* FUSE for file clipboard support (linux/mac os, disable with -DWITH_FUSE=OFF)
* Wayland for wlfreerdp (disable with -DWITH_WAYLAND=OFF)
* X11 development headers for X11 client (disable with -DWITH_X11=OFF)
* ALSA development headers/libraries (disable with -DWITH_ALSA=OFF)
* PULSE development headers/libraries (disable with -DWITH_PULSE=OFF)
* OSS development headers/libraries (disable with -DWITH_OSS=OFF)
11. Server support
FreeRDP does provide server side RDP protocol implementation as well.
These are used by the RDP proxy (disable with -DWITH_PROXY=OFF) as well as shadow server (disable with -DWITH_SHADOW=OFF)
there are some (incomplete) platform implementations (enable with -DWITH_PLATFORM_SERVER=ON) which compile but do not provide anything useful yet.
12. Samples
There are a client and server sample provided. (disable with -DWITH_SAMPLE=OFF)
13. Tools (optional)
a couple of helper utilities are build alongside the client and server executables and libraries. These are mostly for handling certificates and NTLM hashes.
disable with -DWITH_WINPR_TOOLS=OFF
14. Building recommendations
* Use Ninja to speed up your builds
* For release builds add -DCMAKE_BUILD_TYPE=Release (or RelWithDebInfo for less optimized but with debug symbols)
* -DWITH_VERBOSE_WINPR_ASSERT=OFF reduces the size of the build considerably but removes lots
of sanity checks in code. Recommended for stable builds, for builds not from stable releases
it is recommended to keep -DWITH_VERBOSE_WINPR_ASSERT=ON to have useful information on crashes.
15. Example build instructions:
Assume we have the source checked out to /tmp/freerdp/src and we want to install to /tmp/freerdp/install:
(on windows this needs to be called from a visual studio command prompt or a cmd that has run vcvarsall.bat, paths obviously need to be adjusted)
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DWITH_VERBOSE_WINPR_ASSERT=OFF -DCMAKE_PREFIX_PATH=/tmp/freerdp/install -B /tmp/freerdp/build -S /tmp/freerdp/src
cmake --build /tmp/freerdp/build --target install
16. Useful tips:
* there is ccmake (linux/mac os) that is a curses ui to show a current CMakeCache.txt build configuration. There it is easy to check/change variables
* CMake supports preload files (see ci/ subfolder in repo) that allows creating a (custom) build configuration that can then be applied with cmake -C<preload file>

106
third_party/FreeRDP/docs/README.ios vendored Normal file
View File

@@ -0,0 +1,106 @@
Overview
========
The FreeRDP iOS port allows users to enjoy FreeRDP features on Apple iOS devices.
The application was written to be compatible with devices running iOS 4.3 or higher.
More documentation might be found at https://github.com/FreeRDP/FreeRDP/wiki/Compilation
Build requirements
==================
The following prerequisites are required in order to build the iOS port:
- cmake version >= 3.13
- latest Xcode installed (>= 4.6)
- installed Provisioning Profile and iOS Developer Certificate for code signing
(not required for simulator builds)
- pre-build static OpenSSL libraries (see below)
FreeRDP requires OpenSSL libraries for building but they are not part of the iOS SDK and therefore they need to be pre-build manually.
There are various versions and builds of static OpenSSL libraries floating around like iOSPorts.
At the time of writing we have tested and used a small script (OpenSSL-DownloadAndBuild.command) that downloads and builds armv7, armv7s and i386 versions of the OpenSSL 1.0.0e libraries.
If you don't care about modifying the OpenSSL build you can run the following command in the FreeRDP root directory:
./scripts/OpenSSL-DownloadAndBuild.command
The output of the script will be found in external/openssl/. In case you want a
different install/build directory you specify it as first parameter:
./scripts/OpenSSL-DownloadAndBuild.command /tmp/
In the example above the output can then be found in /tmp/openssl.
The script uses oldest iOS/iPhoneSimulator SDK found on the build machine per default. If it is required to build against a specific SDK version
the variable SDK_VERSION can be used to specify it. The minimum SDK version that should be used can be set with MIN_SDK_VERSION within the script.
When the script is finished you will find libcrypto.a and libssl.at, both universal libraries containing all openssl/lib
subfolder in the specified
install directory (external per default)
When the script finishes you will find libcrypto.a and libssl.a, both universal
binary libraries containing arm and i386 targets in order to compile FreeRDP for
iOS devices and the simulator, in the lib subfolder of your installation
directory.
If you build OpenSSL yourself or with an install directory specified you need to set FREERDP_IOS_EXTERNAL_SSL_PATH when running cmake.
Additional (optional) libraries that are required:
* cJSON for Azure logon support
* MIT or Heimdal kerberos for kerberos support
Building
========
Run the following commands in the top level FreeRDP directory:
cmake -DCMAKE_TOOLCHAIN_FILE=cmake/ios.toolchain.cmake -GXcode
This command will create a XCode project in the FreeRDP root folder called FreeRDP.xcodeproj.
Open the project in XCode and modify, build or run the app.
Alternatively you can also build the project from the command line using xcodebuild:
xcodebuild -project FreeRDP.xcodeproj -configuration Debug -sdk iphoneos6.1
or with cmake --build . in your build directory.
Notes:
* XCode, by default will build the application into its derived data location (usually in ~/Library/Developer/...).
If you want to specify an output directory add CONFIGURATION_BUILD_DIR=<output-path-here> to the end of above command line.
* If using XCode choose "Open Other" from the welcome screen, browse to the FreeRDP root directory and select FreeRDP.xcodeproj. Alternatively you can
also start it with "open FreeRDP.xcodeproj".
* If you switch between platforms (OS and SIMULATOR) please remove CMakeCache.txt and CMakeFiles/ before calling cmake again.
Otherwise build errors might occur (this seems to be a bug with cmake or the cmake scripts). To switch between platforms do:
rm CMakeCache.txt
rm -rf CMakeFiles/
before you run a new cmake command with the desired platform.
cmake variables
===============
CMAKE_TOOLCHAIN_FILE
* the toolchain file to use must be cmake/ios.toolchain.cmake
IOS_PLATFORM (OS (default), SIMULATOR)
* the platform for which to build iFreeRDP. OS compiles for iOS devices (using armv7 and armv7s ABIs) and SIMULATOR compiles for the iOS Simulator (i386)
CMAKE_IOS_DEVELOPER_ROOT (used by toolchain file)
* absolute path to the iOS developer platform (i.e. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer) the toolchain file will usually auto-detect the correct Developer platform depending on IOS_PLATFORM
CMAKE_IOS_SDK_ROOT (used by toolchain file)
* absolute path to the iOS SDK (i.e. /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk) the toolchain file will usually auto-detect the correct SDK, depending on IOS_PLATFORM
FREERDP_IOS_EXTERNAL_SSL_PATH (used by FindOpenSSL)
* absolute root path to the pre-built static OpenSSL libraries
CODE_SIGN_IDENTITY
* specify the identity to sign the code with

10
third_party/FreeRDP/docs/README.macOS vendored Normal file
View File

@@ -0,0 +1,10 @@
More documentation might be found at https://github.com/FreeRDP/FreeRDP/wiki/Compilation
Starting with "El Capitan" Apple removed the openssl headers. Therefore it's
required to build openssl manually upfront. For example by using MacPorts or Homebrew.
To build FreeRDP against this library it's required to set the PKG_CONFIG_PATH
pointing to the openssl root directory before building.
For example with brew it would look like this:
export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig

15
third_party/FreeRDP/docs/README.mingw vendored Normal file
View File

@@ -0,0 +1,15 @@
Overview
========
More documentation might be found at https://github.com/FreeRDP/FreeRDP/wiki/Compilation
A sample build script is part of the repository at scripts/mingw.sh
It is periodically run as part of the https://github.com/FreeRDP/FreeRDP/actions/workflows/mingw.yml workflow.
If you want to do your own build, check the script and the dependency versions checked out (we only use it for the ci builder,
so updates are not always done in a timely fashion)
FreeRDP can be built for Windows using llvm-mingw (https://github.com/mstorsjo/llvm-mingw) with both msvcrt and ucrt.
MinGW builds are not actively maintained at the moment and every once in a while the build process may stop working. Pull requests to maintain MinGW support are always welcome.
An example build system for LLVM-MinGW can be found here: https://github.com/FreeRDP/FreeRDP/tree/master/docs/mingw-example

View File

@@ -0,0 +1,43 @@
## Timezone related options
* WITH_TIMEZONE_COMPILED Use compiled in mapping extracted with tzextract (default ON)
* WITH_TIMEZONE_FROM_FILE Use JSON file mapping generated with tzextract (default OFF)
* WITH_TIMEZONE_ICU Use ICU to map IANA to windows timezones (default OFF)
* WITH_TIMEZONE_UPDATER Build the tzextract utility (default OFF)
### Suggested usage
* WITH_TIMEZONE_COMPILED is suggested for single binary builds (aka fully static) binaries that
can not rely on external files to exist.
* WITH_TIMEZONE_FROM_FILE is suggested for distribution packages as this allows updating timezone
mappings without a necessary recompile of the FreeRDP binaries. Set WITH_TIMEZONE_COMPILED=OFF
in such cases as both options can be used in combination. (entries from file taking preference
over compiled in versions)
* WITH_TIMEZONE_ICU is suggested if the target is already linked against ICU. This eliminates a
required mapping table generated from WindowsZones.xml. This option is only a fallback if the
compiled in or loaded from file mappings do not match any.
## Keeping timezone mappings up to date
On an up to date windows machine run the following binary after a build with -DWITH_TIMEZONE_UPDATER=ON (from build directory):
tzextract <path to source>\winpr\libwinpr\timezone
After running the scripts check
* git clang-format -f to eliminate formatting changes
* winpr/libwinpr/timezone/WindowsZones.c
for changes.
on any machine run the following script from checkout root:
./scripts/update-windows-zones.py
After running the scripts check
* git clang-format -f to eliminate formatting changes
* winpr/libwinpr/timezone/WindowsZones.c
for changes.
Commit if the definitions changed:
1. run `git clang-format -f` on these changed files
2. commit these changes
3. create a pull request at https://github.com/FreeRDP/FreeRDP

View File

@@ -0,0 +1,160 @@
FROM ubuntu:22.04 as builder
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq
RUN apt-get install -y xz-utils wget make nasm git ninja-build autoconf automake libtool texinfo help2man yasm gcc pkg-config
# SETUP WORKSPACE
WORKDIR /tmp
# RUN wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz -O llvm.tar.xz && \
RUN wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-msvcrt-ubuntu-18.04-x86_64.tar.xz -O llvm.tar.xz && \
tar -xf llvm.tar.xz && \
cp -a /tmp/llvm-mingw-20230320-msvcrt-ubuntu-18.04-x86_64/* /usr/ && \
rm -rf /tmp/*
RUN mkdir /src
WORKDIR /src
# SETUP TOOLCHAIN
RUN mkdir /src/patch
ARG ARCH
ENV TOOLCHAIN_ARCH=$ARCH
FROM builder as cmake-builder
RUN apt-get install -y cmake
COPY toolchain/cmake /src/toolchain/cmake
ENV TOOLCHAIN_NAME=$TOOLCHAIN_ARCH-w64-mingw32
ENV TOOLCHAIN_CMAKE=/src/toolchain/cmake/$TOOLCHAIN_NAME-toolchain.cmake
FROM builder as meson-builder
RUN apt-get install -y meson
COPY toolchain/meson /src/toolchain/meson
ENV TOOLCHAIN_MESON=/src/toolchain/meson/$TOOLCHAIN_ARCH.txt
# BUILD ZLIB
FROM cmake-builder AS zlib-build
RUN git clone https://github.com/madler/zlib.git /src/zlib
WORKDIR /src/zlib
RUN git fetch; git checkout 04f42ceca40f73e2978b50e93806c2a18c1281fc
RUN mkdir /src/zlib/build
WORKDIR /src/zlib/build
RUN cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_CMAKE -G Ninja -Wno-dev -DCMAKE_INSTALL_PREFIX=/build -DCMAKE_BUILD_TYPE=Release
RUN cmake --build . -j `nproc`
RUN cmake --install .
# BUILD OPENSSL
FROM cmake-builder AS openssl-build
RUN git clone https://github.com/janbar/openssl-cmake.git /src/openssl
WORKDIR /src/openssl
RUN mkdir /src/openssl/build
WORKDIR /src/openssl/build
RUN cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_CMAKE -G Ninja -Wno-dev -DCMAKE_INSTALL_PREFIX=/build \
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
RUN cmake --build . -j `nproc`
RUN cmake --install .
# BUILD OPENH264
FROM meson-builder AS openh264-build
RUN git clone https://github.com/cisco/openh264 /src/openh264
WORKDIR /src/openh264
RUN git fetch; git checkout 0a48f4d2e9be2abb4fb01b4c3be83cf44ce91a6e
RUN mkdir /src/openh264/out
WORKDIR /src/openh264/out
RUN meson .. . --cross-file $TOOLCHAIN_MESON --prefix=/build
RUN ninja -j `nproc`
RUN ninja install
# # BUILD LIBUSB
FROM cmake-builder AS libusb-build
RUN git clone https://github.com/libusb/libusb.git /src/libusb
WORKDIR /src/libusb
RUN git fetch; git checkout 4239bc3a50014b8e6a5a2a59df1fff3b7469543b
RUN mkdir m4; autoreconf -ivf
RUN sed -i.bak "s/-mwin32//g" ./configure
RUN sed -i.bak "s/--add-stdcall-alias//g" ./configure
RUN ./configure --host=$TOOLCHAIN_NAME --prefix=/build
RUN make -j `nproc` && make install
# BUILD FAAC
FROM cmake-builder AS faac-build
RUN git clone https://github.com/knik0/faac.git /src/faac
WORKDIR /src/faac
RUN git fetch; git checkout 78d8e0141600ac006a94ac6fd5601f599fa5b65b
RUN sed -i.bak "s/-Wl,--add-stdcall-alias//g" ./libfaac/Makefile.am
RUN mkdir m4; autoreconf -ivf
RUN sed -i.bak "s/-mwin32//g" ./configure
RUN ./configure --host=$TOOLCHAIN_NAME --prefix=/build
RUN make -j `nproc` && make install
# BUILD FAAD2
FROM cmake-builder AS faad2-build
RUN git clone https://github.com/knik0/faad2.git /src/faad2
WORKDIR /src/faad2
RUN git fetch; git checkout 3918dee56063500d0aa23d6c3c94b211ac471a8c
RUN sed -i.bak "s/-Wl,--add-stdcall-alias//g" ./libfaad/Makefile.am
RUN mkdir m4; autoreconf -ivf
RUN sed -i.bak "s/-mwin32//g" ./configure
RUN ./configure --host=$TOOLCHAIN_NAME --prefix=/build
RUN make -j `nproc` && make install
# BUILD OPENCL-HEADERS
FROM cmake-builder AS opencl-headers
RUN git clone https://github.com/KhronosGroup/OpenCL-Headers.git /src/opencl-headers
WORKDIR /src/opencl-headers
RUN git fetch; git checkout 4fdcfb0ae675f2f63a9add9552e0af62c2b4ed30
RUN mkdir /src/opencl-headers/build
WORKDIR /src/opencl-headers/build
RUN cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_CMAKE -G Ninja -Wno-dev -DCMAKE_INSTALL_PREFIX=/build \
-DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF
RUN cmake --build . -j `nproc`
RUN cmake --install .
# BUILD OPENCL
FROM cmake-builder AS opencl-build
COPY --from=opencl-headers /build /build
RUN git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git /src/opencl
WORKDIR /src/opencl
RUN git fetch; git checkout b1bce7c3c580a8345205cf65fc1a5f55ba9cdb01
RUN echo 'set_target_properties (OpenCL PROPERTIES PREFIX "")' >> CMakeLists.txt
RUN mkdir /src/opencl/build
WORKDIR /src/opencl/build
RUN cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_CMAKE -G Ninja -Wno-dev -DCMAKE_INSTALL_PREFIX=/build \
-DBUILD_SHARED_LIBS=OFF -DOPENCL_ICD_LOADER_DISABLE_OPENCLON12=ON \
-DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF \
-DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -I/build/include/" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -I/build/include/"
RUN cmake --build . -j `nproc`
RUN cmake --install .
# BUILD FREERDP
FROM cmake-builder AS freerdp-build
COPY --from=zlib-build /build /build
COPY --from=openssl-build /build /build
COPY --from=openh264-build /build /build
COPY --from=libusb-build /build /build
COPY --from=faac-build /build /build
COPY --from=faad2-build /build /build
COPY --from=opencl-build /build /build
RUN git clone https://github.com/FreeRDP/FreeRDP.git /src/FreeRDP
RUN mkdir /src/FreeRDP/build
WORKDIR /src/FreeRDP/build
ARG ARCH
RUN /bin/bash -c "( [[ $ARCH == aarch64 ]] && printf 'arm64' || printf $ARCH ) > arch.txt"
RUN bash -c "cmake .. -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAIN_CMAKE -G Ninja -Wno-dev -DCMAKE_INSTALL_PREFIX=/build \
-DWITH_X11=OFF -DWITH_MEDIA_FOUNDATION=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release \
-DUSE_UNWIND=OFF \
-DWITH_ZLIB=ON -DZLIB_INCLUDE_DIR=/build \
-DWITH_OPENH264=ON -DOPENH264_INCLUDE_DIR=/build/include -DOPENH264_LIBRARY=/build/lib/libopenh264.dll.a \
-DOPENSSL_INCLUDE_DIR=/build/include \
-DWITH_OPENCL=ON -DOpenCL_INCLUDE_DIR=/build/include -DOpenCL_LIBRARIES=/build/lib/OpenCL.a \
-DLIBUSB_1_INCLUDE_DIRS=/build/include/libusb-1.0 -DLIBUSB_1_LIBRARIES=/build/lib/libusb-1.0.a \
-DWITH_WINPR_TOOLS=OFF -DWITH_WIN_CONSOLE=ON -DWITH_PROGRESS_BAR=OFF \
-DWITH_FAAD2=ON -DFAAD2_INCLUDE_DIR=/build/include -DFAAD2_LIBRARY=/build/lib/libfaad.a \
-DWITH_FAAC=ON -DFAAC_INCLUDE_DIR=/build/include -DFAAC_LIBRARY=/build/lib/libfaac.a \
-DCMAKE_SYSTEM_PROCESSOR=$( cat arch.txt ) \
-DCMAKE_C_FLAGS=\"${CMAKE_C_FLAGS} -static -Wno-error=incompatible-function-pointer-types -DERROR_OPERATION_IN_PROGRESS=0x00000149\" \
"
RUN cmake --build . -j `nproc`
RUN cmake --install .
RUN cp -a /usr/$ARCH-w64-mingw32/bin/* /build/bin;

View File

@@ -0,0 +1,6 @@
#!/bin/sh
rm -rf $(pwd)/build/$TARGET_ARCH
mkdir -p $(pwd)/build/$TARGET_ARCH
docker build -t win32-builder --build-arg ARCH .
docker compose up dist-builder

View File

@@ -0,0 +1,4 @@
#!/bin/sh
export ARCH=aarch64
. ./_build.sh

View File

@@ -0,0 +1,4 @@
#!/bin/sh
export ARCH=i686
. ./_build.sh

View File

@@ -0,0 +1,4 @@
#!/bin/sh
export ARCH=x86_64
. ./_build.sh

View File

@@ -0,0 +1,8 @@
version: '3'
services:
dist-builder:
image: win32-builder
volumes:
- ./build:/out
command: bash -c "rm -rf /out/*; cp -a /build/bin/. /out/;"

View File

@@ -0,0 +1,15 @@
set(CMAKE_C_COMPILER aarch64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER aarch64-w64-mingw32-g++)
set(CMAKE_FIND_ROOT_PATH /usr/aarch64-w64-mingw32)
execute_process(COMMAND which aarch64-w64-mingw32-windres OUTPUT_VARIABLE TOOLCHAIN_RC_COMPILER)
execute_process(COMMAND which aarch64-w64-mingw32-dlltool OUTPUT_VARIABLE TOOLCHAIN_DLLTOOL)
string(STRIP ${TOOLCHAIN_RC_COMPILER} TOOLCHAIN_RC_COMPILER)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_RC_COMPILER})
string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL)
set(DLLTOOL ${TOOLCHAIN_DLLTOOL})
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_SYSTEM_NAME Windows)

View File

@@ -0,0 +1,15 @@
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
execute_process(COMMAND which i686-w64-mingw32-windres OUTPUT_VARIABLE TOOLCHAIN_RC_COMPILER)
execute_process(COMMAND which i686-w64-mingw32-dlltool OUTPUT_VARIABLE TOOLCHAIN_DLLTOOL)
string(STRIP ${TOOLCHAIN_RC_COMPILER} TOOLCHAIN_RC_COMPILER)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_RC_COMPILER})
string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL)
set(DLLTOOL ${TOOLCHAIN_DLLTOOL})
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_SYSTEM_NAME Windows)

View File

@@ -0,0 +1,15 @@
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
execute_process(COMMAND which x86_64-w64-mingw32-windres OUTPUT_VARIABLE TOOLCHAIN_RC_COMPILER)
execute_process(COMMAND which x86_64-w64-mingw32-dlltool OUTPUT_VARIABLE TOOLCHAIN_DLLTOOL)
string(STRIP ${TOOLCHAIN_RC_COMPILER} TOOLCHAIN_RC_COMPILER)
set(CMAKE_RC_COMPILER ${TOOLCHAIN_RC_COMPILER})
string(STRIP ${TOOLCHAIN_DLLTOOL} TOOLCHAIN_DLLTOOL)
set(DLLTOOL ${TOOLCHAIN_DLLTOOL})
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_SYSTEM_NAME Windows)

View File

@@ -0,0 +1,15 @@
[binaries]
c = 'aarch64-w64-mingw32-gcc'
cpp = 'aarch64-w64-mingw32-g++'
ar = 'aarch64-w64-mingw32-ar'
ld = 'aarch64-w64-mingw32-ld'
strip = 'aarch64-w64-mingw32-strip'
[host_machine]
system = 'windows'
cpu_family = 'aarch64'
cpu = 'native'
endian = 'little'
[properties]
platform = 'generic_aarch64'

View File

@@ -0,0 +1,16 @@
[binaries]
c = 'i686-w64-mingw32-gcc'
cpp = 'i686-w64-mingw32-g++'
ar = 'i686-w64-mingw32-ar'
ld = 'i686-w64-mingw32-ld'
strip = 'i686-w64-mingw32-strip'
[host_machine]
system = 'windows'
cpu_family = 'x86'
cpu = 'native'
endian = 'little'
[properties]
c_args = '-mno-avx512f'
cpp_args = '-mno-avx512f'

View File

@@ -0,0 +1,16 @@
[binaries]
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-ar'
ld = 'x86_64-w64-mingw32-ld'
strip = 'x86_64-w64-mingw32-strip'
[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'native'
endian = 'little'
[properties]
c_args = '-mno-avx512f'
cpp_args = '-mno-avx512f'

132
third_party/FreeRDP/docs/valgrind.supp vendored Normal file
View File

@@ -0,0 +1,132 @@
{
ignore glibc getaddrinfo
Memcheck:Param
sendmsg(mmsg[0].msg_hdr)
fun:sendmmsg
fun:__libc_res_nsend
fun:__libc_res_nquery
fun:__libc_res_nsearch
fun:_nss_dns_gethostbyname4_r
fun:gaih_inet
fun:getaddrinfo
}
{
ignore pcsc-lite SCardConnect
Memcheck:Param
socketcall.sendto(msg)
fun:send
fun:MessageSend
fun:MessageSendWithHeader
fun:SCardConnect
}
{
ignore openssl malloc
Memcheck:Leak
fun:malloc
fun:CRYPTO_malloc
...
obj:*libcrypto*
}
{
ignore openssl realloc
Memcheck:Leak
fun:realloc
fun:CRYPTO_realloc
...
obj:*libcrypto*
}
{
ignore libssl cond
Memcheck:Cond
obj:*libssl*
}
{
ignore libssl value
Memcheck:Value4
obj:*libssl*
}
{
ignore ssl3_read_bytes tls1_enc
Memcheck:Cond
fun:tls1_enc
fun:ssl3_read_bytes
obj:*libssl*
}
{
ignore ssl3_read_bytes memcpy
Memcheck:Cond
fun:memcpy@@GLIBC_2.14
fun:ssl3_read_bytes
obj:*libssl*
}
{
ignore ssl3_read_bytes value8
Memcheck:Value8
fun:memcpy@@GLIBC_2.14
fun:ssl3_read_bytes
obj:*libssl*
}
{
ignore write buf BIO_write
Memcheck:Param
write(buf)
obj:*libpthread*
obj:*libcrypto*
fun:BIO_write
fun:ssl3_write_pending
fun:ssl3_write_bytes
}
{
g_type_init
Memcheck:Leak
...
fun:g_type_init_with_debug_flags
}
{
gobject_init_ctor
Memcheck:Leak
...
fun:gobject_init_ctor
}
{
g_type_register_static
Memcheck:Leak
...
fun:g_type_register_static
}
{
g_type_register_fundamental
Memcheck:Leak
...
fun:g_type_register_fundamental
}
{
g_type_add_interface_static
Memcheck:Leak
...
fun:g_type_add_interface_static
}
{
g_type_class_ref
Memcheck:Leak
...
fun:g_type_class_ref
}
{
XGetDefault
Memcheck:Leak
...
fun:XGetDefault
}

View File

@@ -0,0 +1,37 @@
As FreeRDPs is build on different OS with different build tools and methods the
"version detection" has grown historically.
This document quickly describes how it's currently used.
When doing a `xfreerdp /version` for example the following is shown
`This is FreeRDP version 3.0.0-dev (c99c4cecddee4e5b914b122bc1531d47a668bb8e)`
The first part is the Version as defined in `RAW_VERSION_STRING` and the second part, in braces,
the `GIT_REVISON` of this version.
`RAW_VERSION_STRING` is very vital as it determines the version used for libraries as well also for
all sub-projects as WinPR.
As default both variables are equal.
The whole detection has been encapsulated in cmake/GetProjectVersion.cmake
For nightly or development builds it is often of advantage to have the actual version from git
instead of having the hard coded value set in CMakeLists.txt. For this the cmake variable `USE_VERSION_FROM_GIT_TAG`
can be set. In order for this to work you need a) source checkout and b) git command line utility.
If enabled the information from the last git tag (in the format major.minor.patch-extra like
2.6.0-android12) will be used.
If you are building FreeRDP and can't use git because it's not available or the source is not in an
git repository - for example when building packages - the files `.source_tag` and `.source_version`
in the top-level source directory can be used. `.source_tag` is equal to `RAW_VERSION_STRING` and
need to contain the version in the same format as the git tag. `.source_version` is used to pre-fill
`GIT_REVISON`. Although mostly used for that it must not contain a git commit or tag - it can be
used to set additional arbitrary information. Our recommendation for packagers is to create
`.source_version` when importing and set it to the upstream commit or tag to simplify issue
tracking.
As summary the different mechanisms are applied in that order:
* `.source_tag` and `.source_version` if found
* version set from the last git tag if `RAW_VERSION_STRING` is set
* hard coded version in CMakeLists.txt

151
third_party/FreeRDP/docs/wlog.md vendored Normal file
View File

@@ -0,0 +1,151 @@
# Overview
WLog is a configurable and flexible logging system used throughout winpr and
FreeRDP.
The primary concept is to have a hierarchy of loggers that can be be configured
independently.
TODO add more details and configuration examples.
# Environment variables
* WLOG_APPENDER - the appender to use possible values below also see the Appender section.
* CONSOLE
* FILE
* BINARY
* SYSLOG
* JOURNALD
* UDP
* WLOG_PREFIX - configure the prefix used for outputting the message (see
Format for more details and examples)
* WLOG_LEVEL - the level to output messages for
* WLOG_FILTER - sets a filter for WLog messages. Only the filtered messages are
printed
* WLOG_FILEAPPENDER_OUTPUT_FILE_PATH - set the output file path for the file
file appender
* WLOG_FILEAPPENDER_OUTPUT_FILE_NAME - set the output file name for the output
appender
* WLOG_JOURNALD_ID - identifier used by the journal appender
* WLOG_UDP_TARGET - target to use for the UDP appender in the format host:port
# Levels
The WLog are complementary the higher level always includes the lower ones.
The level list below is top down. Top the highest level.
* WLOG_TRACE - print everything including package dumps
* WLOG_DEBUG - debug messages
* WLOG_INFO - general information
* WLOG_WARN - warnings
* WLOG_ERROR - errors
* WLOG_FATAL - fatal problems
* WLOG_OFF - completely disable the wlog output
# Format
The format a logger prints in has the following possible options:
* "lv" - log level
* "mn" - module name
* "fl" - file name
* "fn" - function
* "ln" - line number
* "pid" - process id
* "tid" - thread id
* "yr" - year
* "mo" - month
* "dw" - day of week
* "hr" - hour
* "mi" - minute
* "se" - second
* "ml" - millisecond
A maximum of 16 options can be used per format string.
An example that generally sets the WLOG_PREFIX for xfreerdp would look like:
```
WLOG_PREFIX="pid=%pid:tid=%tid:fn=%fn -" xfreerdp /v:xxx
```
# Appenders
WLog uses different appenders that define where the log output should be written
to. If the application doesn't explicitly configure the appenders the above
described variable WLOG_APPENDER can be used to choose one appender.
The following represents an overview about all appenders and their possible
configuration values.
### Binary
Write the log data into a binary format file.
Options:
* "outputfilename", value const char* - file to write the data to
* "outputfilepath", value const char* - location of the output file
### Callback
The callback appender can be used from an application to get all log messages
back the application. For example if an application wants to handle the log
output itself.
Options:
* "callbacks", value struct wLogCallbacks*, callbacks to use
### Console
The console appender writes to the console. Depending of the operating system
the application runs on the output might be handled differently. For example
on android log print would be used.
Options:
* "outputstream", value const char * - output stream to write to
* "stdout" - write everything to stdout
* "stderr" - write everything to stderr
* "default" - use the default settings - in this case errors and fatal would
go to stderr everything else to stdout
* debug - use the debug output. Only used on windows on all operating systems
this behaves as as if default was set.
### File
The file appender writes the textual output to a file.
Options:
* "outputfilename", value const char*, filename to use
* "outputfilepath", value const char*, location of the file
### Udp
This appender sends the logging messages to a pre-defined remote host via UDP.
Options:
* "target", value const char*, target to send the data too in the format
host:port
If no target is set the default one 127.0.0.1:20000 is used. To receive the
log messages one can use netcat. To receive the default target the following
command could be used.
```
nc -u 127.0.0.1 -p 20000 -l
```
### Syslog (optional)
Use syslog for outputting the debug messages. No options available.
### Journald (optional)
For outputting the log messages to journald this appender can be used.
The available options are:
* "identifier", value const char*, the identifier to use for journald (default
is winpr)