Skip to content

Building from source

Marvin1099 edited this page Dec 10, 2023 · 31 revisions

I you want to build from source, you can do so on Windows and Linux.
Here is a detailed step by step guide.
Grab Python
Download the repository
Fix a later Issue
Download Dependency's
Sound Effects
Update Submodules
Run Pyinstaller
Add BEE Items
Linux Puzzlemaker Fix
Run BEE 2
Add a shortcut
Automate Building

1. Grab Python

  • On Linux
    • Download python from your your package manager (also grab python-pip and git)
    • If you want to you can try and grab the required packages from your package manager
    • Not all of them will exist in your package manager
    • So grab the rest or just all of the required packages over a python venv
      • For this you will need to run something like this
      • python -m venv %YOUR-PREFERRED-PATH-FOR-VENV% (You will need to change this to any path you like to use)
      • At this point you will need to source the venv, so on a bash terminal you will need to run
      • source %YOUR-PREFERRED-PATH-FOR-VENV%/bin/activate
  • On Windows

2. Download the repository

  • For that go copy the main github repo link (so https://github.com/BEEmod/BEE2.4)
  • Then clone the repo (you can also download the zip on the main github repo)
    • Run git clone --recurse-submodules https://github.com/BEEmod/BEE2.4.git for the main repo
    • Alternatively you can run git clone -b dev --recurse-submodules https://github.com/BEEmod/BEE2.4.git to get the dev branch

3. Fix a problem for later

  • Here you will need to rename or delete the geocable.py that is not working right now (and is not required anyway)
    • So on Linux run mv BEE2.4/hammeraddons/transforms/geocable.py BEE2.4/hammeraddons/transforms/geocable.py.disabeled
    • On Windows run ren BEE2.4\hammeraddons\transforms\geocable.py BEE2.4\hammeraddons\transforms\geocable.py.disabeled

4. Download Dependency's

  • For that fist go into the cloned BEE2.4 directory
    • So type cd Bee2.4
  • So now install the requirements from the requirements.txt file
    • So run pip install -r requirements.txt
    • You also need to run pip install -r dev-requirements.txt if you grabbed the dev branch

5. Enable sound effects

  • For that you will need a copy of FFmpeg
  • You will need to put these in the lib-32 and/or lib-64/ folders (if you are in the BEE2.4 Folder).
    • Download the 32-bit (win32-lgpl-shared)
    • Or 64-bit builds (win64-lgpl-shared)
  • Then copy the contents of the bin folder into the appropriate lib-XX folder mentioned.
  • You can try adding the files from the linux64-lgpl-shared bin folder (to the lib-64 folder)
    But on linux, as far as I have seen, sound is not working jet

6. Update the submodules

  • Here just run git submodule update --init

7. Run the pyinstaller

  • To do this run cd src from the BEE2.4 directory (your terminal should still be in there)
  • Compile the app
    • Here run pyinstaller --distpath ../dist/64bit/ --workpath ../build_tmp compiler.spec
    • Also run pyinstaller --distpath ../dist/64bit/ --workpath ../build_tmp BEE2.spec

8. Add Items to BEE

  • Change directory to ../dist/64bit/BEE2/packages/ (relative fron the src directory)
    • So on Linux run cd ../dist/64bit/BEE2/
    • On Windows you will need cd ..\dist\64bit\BEE2\
    • Keep in mind if you build for 32 bit you will need to use the 32bit folder
  • Create the packages folder
    • So run mkdir packages
  • Here you will need to grab the items from the newest release
  • Then copy over the files inside the zip into the package directory

9. Fix puzzlemaker on Linux

  • On Linux the puzzlemaker seems to be broken
  • One way that was found to fix it is here portal2/issues/403
  • Essentially what you will need to do is download a old version and copy over the working library file
  • Fist make sure steam is not running
  • Then run steam -console or steam-native -console
  • After steam has started click on console
  • Then in there run download_depot 620 661 2854055004190207766
  • Then go to the folder $HOME/.local/share/Steam/ubuntu12_32/steamapps/content/app_620/depot_661/bin/linux32
  • There copy the filesystem_stdio.so to $HOME/.local/share/Steam/steamapps/common/Portal 2/bin/linux32
    • You can also use this command for that cp "$HOME/.local/share/Steam/ubuntu12_32/steamapps/content/app_620/depot_661/bin/linux32/filesystem_stdio.so" "$HOME/.local/share/Steam/steamapps/common/Portal 2/bin/linux32/filesystem_stdio.so"

10. Run Bee2

  • Finally go back to the BEE2.4/dist/64bit/BEE2/ folder and run the BEE2 file (or 32bit if you used that)
  • At this point you can do any use BEE2 as you expect it to. For example you can set presets and export your setup to portal 2 (Or other suported games like aperture tag)

11. Add a Shortcut

  • To add a shortcut on windows rightclick the BEE2.exe and select create shortcut
  • Now you can copy or move the shorcut to your prefered location
  • In the following don't forget to replace %yourbeeroot% with the location to the BEE2.4 folder
    So on Linux create a file named BEE2.desktop with the following content
[Desktop Entry]
Exec=%yourbeeroot%/dist/64bit/BEE2/BEE2
GenericName=BEE2
Icon=%yourbeeroot%/dist/64bit/BEE/icon/BEE2.ico
Name=BEE2
Path=%yourbeeroot%/dist/64bit/BEE2
StartupNotify=true
StartupWMClass=BEE2
Terminal=false
Type=Application
  • Now copy or move the file to any folder you like to have a shortcut at

12. Automate Building on Linux

  • Since the Windows version is getting auto builds you probably only want to build Linux Here is a way to automate building on Linux
  • Preparation (Only has to be done once)
    • Add a python venv like it says in here Grab Python under Linux
    • Fix the Linux puzzlemaker Linux Puzzlemaker Fix
    • Prepare the following folders
      • A main folder where your patch files can live
        For me that is: $HOME/Documents/Coding/Git/Build-Bee2/
      • All patch files and the BEE2.4 folder will go in this folder so chose wisely
      • In this build folder create the following folders in the root
        Icon, bin, packages, music
        You might also need a syslink to $HOME/Documents/Coding/Git/Build-Bee2/BEE2.4/dist that is called dist
      • Your setup should now look like this (Ignore the folder that says "IGNORE-ME")
      • In the icon folder copy the BEE2 icon master/BEE2.ico
        Here you might also want to save a additional PNG version, by converting the ICO (This is for easy use)
        The folder should look like this

        This can be skipped if you don't need a icon on your BEE2.desktop file (aka if you don't need a shortcut)
        This might be what that a shortcut / BEE2.desktop could look like (Ignore the other files)
      • In the bin folder add the FFMPEG files from Sound Effects (optional) But here you will need to put the files from the zib inside the bin folder into the created bin folder Here a screenshot of the setup
      • Next grab Add BEE Items, but place them into the packages and the music folders in the build root instead
        So now it looks like this in the packages folder

        and the music folder looks like this
  • The Automation Script
    • Now in the script don't forget to change the line source $HOME/Apps/Games/python-env/bin/activate to your python venv
    • The setup should look like this
    • So go ahead and make a new file in the build root and name it something like build-bee.sh then add the following
#!/bin/bash
source $HOME/Apps/Games/python-env/bin/activate
cd "$(dirname "$0")"
rm -r ./BEE2.4 #Delete if you don't want to build from scratch
git clone -b dev --recurse-submodules https://github.com/BEEmod/BEE2.4.git #Only Run once if you don't want to always update 
cp $HOME/.local/share/Steam/ubuntu12_32/steamapps/content/app_620/depot_661/bin/linux32/filesystem_stdio.so" "$HOME/.local/share/Steam/steamapps/common/Portal 2/bin/linux32/filesystem_stdio.so" #This fixes the puzzlemaker
mv BEE2.4/hammeraddons/transforms/geocable.py BEE2.4/hammeraddons/transforms/geocable.py.disabeled #Disable geocable.py, as it is not working
mkdir -p BEE2.4/lib-64/ #Make a directory for ffmepg files
cp bin/* BEE2.4/lib-64/ #Copy ffmepg files to lib-64 dir
cd BEE2.4/
pip install -r requirements.txt #This only needs to be run once but if a update changes this it is going to grab the stuff for it
pip install -r dev-requirements.txt #Same situation as line above
git submodule update --init #Update submodules
cd src/
pyinstaller --distpath ../dist/64bit/ --workpath ../build_tmp compiler.spec #Compile Bee2 with pyinstaller
pyinstaller --distpath ../dist/64bit/ --workpath ../build_tmp BEE2.spec #Same as line above
cd ..
mkdir -p dist/64bit/BEE2/packages #Make directory for packages
cp ../packages/* dist/64bit/BEE2/packages/ #Copy the packages to the package folder 
cp ../music/* dist/64bit/BEE2/packages/ #Copy the music to the package folder
cd dist/64bit/BEE2/
./BEE2 & #Disable this if you don't want bee2 to run on finished compile
  • Your Done
    • At this point you can run bee from the BEE2.4/dist/64bit/BEE2/ folder (there run the file BEE2)
  • Adding a Shortcut
    • That is also easy, add a file named BEE2.desktop to your preferred location
      Than add the following in that file (also change $HOME/Documents/Coding/Git/Build-Bee2 to your build folder)
[Desktop Entry]
Exec=$HOME/Documents/Coding/Git/Build-Bee2/BEE2.4/dist/64bit/BEE2/BEE2
GenericName=BEE2
Icon=$HOME/Documents/Coding/Git/Build-Bee2/icon/BEE2.png
Name=BEE2
Path=$HOME/Documents/Coding/Git/Build-Bee2/BEE2.4/dist/64bit/BEE2
StartupNotify=true
StartupWMClass=BEE2
Terminal=false
Type=Application
  • At this point there is nothing to to but to use BEE2 to create some chambers
Clone this wiki locally