An open build overlay for reconstructing a hybrid 32-bit Linux Portal 2 runtime from the incomplete Portal 2 source archive, legally downloaded Steam depot content, replacement engine components, and selected official Linux binaries.
This branch, linux, contains the Linux reconstruction. The Windows reconstruction is on the windows branch.
Legal notice: this repository does not contain the Portal 2 source archive, game assets, Steam depot content, or Valve's proprietary binaries. You must independently have the legal right to possess and use those materials. Depot downloads use your own Steam account through SteamCMD. No Valve content is redistributed here.
The Linux reconstruction is a working research build, not a retail-equivalent port.
Verified behavior includes:
32-bit portal2_linux launcher startup.
Rebuilt engine_linux.so, client.so, server.so, replacement vphysics.so, and core runtime modules.
Localized main menu and pause menu.
Normal menu-driven single-player initialization into sp_a1_intro1.
Mouse look, keyboard movement, and portal firing in tested chambers.
Hybrid loading of Valve's native Linux puzzlemaker_dll.so.
PuzzleMaker editor UI, item palette, viewport rendering, autosave, and VMF export.
Successful in-game VBSP, VVIS, and VRAD compilation of the exported default PuzzleMaker chamber, followed by compile-to-preview map launch.
Reconstructed vbsp_linux, vvis_linux, vrad_linux, vvis_dll_linux.so, and vrad_dll_linux.so.
Known limitations include:
PuzzleMaker compile-to-preview works for the default exported chamber; richer custom chambers still need broader validation.
Console text input is not fully verified and may crash.
Some HUD, material, and gesture content is mismatched or missing.
Replacement Havok memory code still emits an unresolved memory-pool warning.
Steam stats, achievements, workshop publishing, matchmaking, and online functionality are unproven.
Linux queued material rendering remains effectively single-threaded.
The build scripts are smoke-tested but not yet proven end-to-end from a completely fresh machine.
Research binary snapshots are published on the GitHub Releases page. They are not standalone game packages. They contain only reconstruction binaries built from this project; they do not include game assets, VPKs, Steam depot content, Valve's official puzzlemaker_dll.so, Steam API libraries, localization/audio binaries, SDL, or renderer support binaries. Follow the depot and runtime assembly instructions below before using them.
The Linux snapshot can be regenerated from an assembled runtime with:
./tools/package_linux_binaries.sh /path/to/runtime portal2-linux-binaries.tar.gz Repository layout
overlay/ source-level additions and edits overlay/MANIFEST.txt authoritative overlay inventory tools/apply_overlay.sh apply the overlay to a source tree tools/install_deps_ubuntu.sh tools/build_linux.sh Linux build automation tools/download_depots.sh SteamCMD depot downloader tools/setup_runtime.sh runtime assembler tools/sync_linux_runtime.sh tools/package_linux_binaries.sh reconstruction-only release packaging docs/screenshots/ banner and verification screenshots The overlay currently contains 726 source-level additions or changes. It excludes generated objects, runtime binaries, depot content, credentials, and proprietary redistributables.
You need a Portal 2 source tree containing the expected root directories, including engine/, game/, public/, and vpc_scripts/.
A public mirror referenced for convenience is:
https://github.com/3kh0/portal-2
That mirror is unverified, unaffiliated with this project, and may change or disappear. Its observed main commit while this repository was prepared was cbd804efac775f8b8a2d64b8b4d8960a3a8712bb. If you already possess the original archive, use that instead.
Tested development environment:
32-bit libc, SDL2, OpenGL, X11, compression, UUID, and audio development packages
A Steam account that owns Portal 2
About 20 GB free disk space
Install Ubuntu build dependencies with:
sudo ./tools/install_deps_ubuntu.sh Quick start
Create a scratch workspace:
mkdir -p ~/portal2-reconstruction cd ~/portal2-reconstruction 1. Obtain the source tree
Use your existing archive:
mkdir portal2-src 7z x /path/to/portal2_src.7z -oportal2-src Or clone the public mirror linked above:
git clone https://github.com/3kh0/portal-2 portal2-src 2. Apply the overlay
Clone this repository, then run:
./tools/apply_overlay.sh ~/portal2-reconstruction/portal2-src The script copies the overlay into the source root and restores executable bits commonly lost when the archive is extracted.
mkdir -p ~/steamcmd curl -L https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz \ | tar xz -C ~/steamcmd 4. Download the required depots
Set only your username in the environment. SteamCMD prompts for the password and Steam Guard interactively.
STEAM_USERNAME='your-steam-login-name' \ ./tools/download_depots.sh ~/steamcmd Required depots:
./tools/build_linux.sh ~/portal2-reconstruction/portal2-src 2 Build logs go to /tmp/portal2-linux-build-logs.
Some legacy generated makefiles return nonzero status because optional Perforce copy commands are absent even when output generation succeeds. The build script therefore reports both the make status and whether the expected output exists.
6. Assemble the runtime
mkdir -p ~/portal2-reconstruction/runtime ./tools/setup_runtime.sh \ ~/portal2-reconstruction/portal2-src \ ~/steamcmd \ ~/portal2-reconstruction/runtime This step:
copies the large shared-content depot,
merges Authoring Tools sdk_content,
copies the selected official Linux binaries,
collects rebuilt binaries,
creates required suffixed/unsuffixed module aliases,
creates the PuzzleMaker compile-tool layout,
patches portal2/gameinfo.txt so compile tools can write to sdk_content,
hardlinks the critical libtier0 and libvstdlib singleton pairs.
cd ~/portal2-reconstruction/runtime PORTAL2_NO_LAUNCHERMGR_REQUIRED_IN_MATERIAL_SYSTEM=1 \ LD_LIBRARY_PATH=bin \ ./portal2_linux \ -game portal2 -novid -nocrashdialog -windowed -noborder -w 640 -h 480 Add -condebug for console logging. The log is written to portal2/console.log inside the runtime directory.
Proprietary files copied from the depots
These files are not committed. tools/setup_runtime.sh copies them automatically.
Depot content placement:
Depot 661 uses the current default manifest, so hashes may change if Valve updates that depot.
Important implementation details
libtier0 and libvstdlib singletons
Some modules link libtier0.so while others link libtier0_linux.so; the same is true for libvstdlib. If those names exist as independent files, the dynamic loader can create duplicate global state, including the KeyValues symbol table. That caused menu commands such as Start to decode incorrectly across module boundaries.
tools/sync_linux_runtime.sh hardlinks these pairs inside runtime/bin:
libtier0.so <-> libtier0_linux.so libvstdlib.so <-> libvstdlib_linux.so Command-line compile tools
VBSP/VVIS/VRAD need this environment variable because materialsystem otherwise requires an SDL launcher manager:
export PORTAL2_NO_LAUNCHERMGR_REQUIRED_IN_MATERIAL_SYSTEM=1 PuzzleMaker compile layout
The native editor expects compile tools under bin/linux32 and writes VMFs below sdk_content/maps. The setup script creates compatibility symlinks, a legacy nested bin/linux32/bin module directory, the portal2/maps/puzzlemaker preview destination, and this additional game path when absent:
The FGD set is required, not optional. portal2.fgd includes base.fgd, portal.fgd, and halflife2.fgd; without those files VBSP cannot remap instanced entity origins correctly and reports false leaks inside otherwise valid PuzzleMaker door/elevator instances.
The compile tools also need the filesystem_init.cpp overlay fix. Source-era filesystem logic treated bin/linux32 as a non-bin executable directory and appended another bin component, which broke content/VPK lookup when the editor launched vbsp_linux through the Linux compatibility path. The overlay maps bin/linux32 back to the parent bin directory.
Game |gameinfo_path|../sdk_content Troubleshooting
Validate the complete build end-to-end from a fresh extraction.
Validate uninterrupted PuzzleMaker compile-to-preview handoff from a clean runtime.
Continue Windows reconstruction on the windows branch.
Inventory and reverse engineer missionchooser, vjobs, engine_xlsp, p2map_publish, and SchemaCompiler behavior where relevant.
Investigate console input, Havok memory-pool warnings, HUD/material mismatches, stats persistence, and Linux queued rendering.
Replace hybrid binary dependencies with clean-room implementations where practical.
No license is granted for Valve's source code, assets, binaries, or other proprietary materials. The original overlay scripts and reconstruction-specific code in this repository are provided for research and interoperability purposes; users remain responsible for independently satisfying all legal requirements for the Portal 2 source and game content.
Overlay and build tooling for reconstructing a hybrid Portal 2 runtime. Linux branch active, Windows planned. No proprietary game files included.











