Skip to content

Commit

Permalink
* initial wiki
Browse files Browse the repository at this point in the history
* reduce code in linux build script

* make steamnetworkingsockets.cpp compile (Win + Linux)
  • Loading branch information
otavepto committed Jan 26, 2024
1 parent 8e5c752 commit 1a5998d
Show file tree
Hide file tree
Showing 5 changed files with 348 additions and 219 deletions.
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ You can find the original README here: [README.md](./z_original_repo_files/READM
---

## How to use the emu
You can find instructions here: [README.release.md](./post_build/README.release.md)
You can find instructions here: [README.release.md](./post_build/README.release.md)

You can helper scripts and tools mentioned here in this wiki: https://github.com/otavepto/gbe_fork/wiki/Emu-helpers

---
---
Expand Down Expand Up @@ -159,8 +161,13 @@ Arguments you can pass to this script:

>>>>>>>>> ___
* `-tool-itf` prevent building the tool `find_interfaces`:
* `-tool-lobby`: prevent building the tool `lobby_connect`:
* `-tool-itf` prevent building the tool `find_interfaces`
* `-tool-lobby`: prevent building the tool `lobby_connect`

>>>>>>>>> ___
* `+lib-netsockets-32` *(experimental)*: build a standalone networking sockets library (32-bit)
* `+lib-netsockets-64` *(experimental)*: build a standalone networking sockets library (64-bit)

<br/>

Expand Down Expand Up @@ -200,10 +207,15 @@ Arguments you can pass to this script:

>>>>>>>>> ___
* `-tool-itf-32`: prevent building the tool 32-bit `find_interfaces`:
* `-tool-itf-64`: prevent building the tool 64-bit `find_interfaces`:
* `-tool-lobby-32`: prevent building the tool 32-bit `lobby_connect`:
* `-tool-lobby-64`: prevent building the tool 64-bit `lobby_connect`:
* `-tool-itf-32`: prevent building the tool 32-bit `find_interfaces`
* `-tool-itf-64`: prevent building the tool 64-bit `find_interfaces`
* `-tool-lobby-32`: prevent building the tool 32-bit `lobby_connect`
* `-tool-lobby-64`: prevent building the tool 64-bit `lobby_connect`

>>>>>>>>> ___
* `+lib-netsockets-32` *(experimental)*: build a standalone networking sockets library (32-bit)
* `+lib-netsockets-64` *(experimental)*: build a standalone networking sockets library (64-bit)

---

Expand Down
45 changes: 29 additions & 16 deletions build_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ BUILD_TOOL_FIND_ITFS64=1
BUILD_TOOL_LOBBY32=1
BUILD_TOOL_LOBBY64=1

BUILD_LIB_NET_SOCKETS_32=0
BUILD_LIB_NET_SOCKETS_64=0

# < 0: deduce, > 1: force
PARALLEL_THREADS_OVERRIDE=-1

Expand Down Expand Up @@ -65,6 +68,10 @@ for (( i=1; i<=$#; i++ )); do
BUILD_TOOL_LOBBY32=0
elif [[ "$var" = "-tool-lobby-64" ]]; then
BUILD_TOOL_LOBBY64=0
elif [[ "$var" = "+lib-netsockets-32" ]]; then
BUILD_LIB_NET_SOCKETS_32=1
elif [[ "$var" = "+lib-netsockets-64" ]]; then
BUILD_LIB_NET_SOCKETS_64=1
elif [[ "$var" = "-verbose" ]]; then
VERBOSE=1
elif [[ "$var" = "clean" ]]; then
Expand Down Expand Up @@ -358,6 +365,10 @@ function build_for () {
return 1;
}

local out_dir="${out_filepath%/*}"
[[ "$out_dir" = "$out_filepath" ]] && out_dir='.'
mkdir -p "$out_dir"

# https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/developer_guide/gcc-using-libraries#gcc-using-libraries_using-both-static-dynamic-library-gcc
# https://linux.die.net/man/1/ld
if [[ $VERBOSE = 1 ]]; then
Expand Down Expand Up @@ -406,8 +417,6 @@ echo; echo;

if [[ "$BUILD_LIB32" = "1" ]]; then
echo // building shared lib libsteam_api.so - 32
[[ -d "$build_root_32" ]] || mkdir -p "$build_root_32"

all_src_files=(
"${release_src[@]}"
"controller/*.c"
Expand All @@ -418,8 +427,6 @@ fi

if [[ "$BUILD_CLIENT32" = "1" ]]; then
echo // building shared lib steamclient.so - 32
[[ -d "$build_root_32" ]] || mkdir -p "$build_root_32"

all_src_files=(
"${release_src[@]}"
"controller/*.c"
Expand All @@ -430,8 +437,6 @@ fi

if [[ "$BUILD_TOOL_LOBBY32" = "1" ]]; then
echo // building executable lobby_connect_x32 - 32
[[ -d "$build_root_tools/lobby_connect" ]] || mkdir -p "$build_root_tools/lobby_connect"

all_src_files=(
"${release_src[@]}"
"$tools_dir/lobby_connect/lobby_connect.cpp"
Expand All @@ -442,15 +447,22 @@ fi

if [[ "$BUILD_TOOL_FIND_ITFS32" = "1" ]]; then
echo // building executable generate_interfaces_file_x32 - 32
[[ -d "$build_root_tools/find_interfaces" ]] || mkdir -p "$build_root_tools/find_interfaces"

all_src_files=(
"$tools_dir/generate_interfaces/generate_interfaces.cpp"
)
build_for 1 1 "$build_root_tools/find_interfaces/generate_interfaces_file_x32" '' all_src_files
last_code=$((last_code + $?))
fi

if [[ "$BUILD_LIB_NET_SOCKETS_32" = "1" ]]; then
echo // building shared lib steamnetworkingsockets.so - 32
all_src_files=(
"networking_sockets_lib/steamnetworkingsockets.cpp"
)
build_for 1 0 "$build_root_dir/networking_sockets_lib/steamnetworkingsockets.so" '' all_src_files
last_code=$((last_code + $?))
fi


### x64 build
cleanup
Expand All @@ -464,8 +476,6 @@ echo; echo;

if [[ "$BUILD_LIB64" = "1" ]]; then
echo // building shared lib libsteam_api.so - 64
[[ -d "$build_root_64" ]] || mkdir -p "$build_root_64"

all_src_files=(
"${release_src[@]}"
"controller/*.c"
Expand All @@ -476,8 +486,6 @@ fi

if [[ "$BUILD_CLIENT64" = "1" ]]; then
echo // building shared lib steamclient.so - 64
[[ -d "$build_root_64" ]] || mkdir -p "$build_root_64"

all_src_files=(
"${release_src[@]}"
"controller/*.c"
Expand All @@ -488,8 +496,6 @@ fi

if [[ "$BUILD_TOOL_LOBBY64" = "1" ]]; then
echo // building executable lobby_connect_x64 - 64
[[ -d "$build_root_tools/lobby_connect" ]] || mkdir -p "$build_root_tools/lobby_connect"

all_src_files=(
"${release_src[@]}"
"$tools_dir/lobby_connect/lobby_connect.cpp"
Expand All @@ -500,15 +506,22 @@ fi

if [[ "$BUILD_TOOL_FIND_ITFS64" = "1" ]]; then
echo // building executable generate_interfaces_file_x64 - 64
[[ -d "$build_root_tools/find_interfaces" ]] || mkdir -p "$build_root_tools/find_interfaces"

all_src_files=(
"$tools_dir/generate_interfaces/generate_interfaces.cpp"
)
build_for 0 1 "$build_root_tools/find_interfaces/generate_interfaces_file_x64" '' all_src_files
last_code=$((last_code + $?))
fi

if [[ "$BUILD_LIB_NET_SOCKETS_64" = "1" ]]; then
echo // building shared lib steamnetworkingsockets64.so - 64
all_src_files=(
"networking_sockets_lib/steamnetworkingsockets.cpp"
)
build_for 0 0 "$build_root_dir/networking_sockets_lib/steamnetworkingsockets64.so" '' all_src_files
last_code=$((last_code + $?))
fi


# cleanup
cleanup
Expand Down
47 changes: 47 additions & 0 deletions build_win.bat
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ set /a BUILD_EXPCLIENT_EXTRA_64=0
set /a BUILD_TOOL_FIND_ITFS=1
set /a BUILD_TOOL_LOBBY=1

set /a BUILD_LIB_NET_SOCKETS_32=0
set /a BUILD_LIB_NET_SOCKETS_64=0

:: < 0: deduce, > 1: force
set /a PARALLEL_THREADS_OVERRIDE=-1

Expand Down Expand Up @@ -78,6 +81,10 @@ set /a VERBOSE=0
set /a BUILD_TOOL_FIND_ITFS=0
) else if "%~1"=="-tool-lobby" (
set /a BUILD_TOOL_LOBBY=0
) else if "%~1"=="+lib-netsockets-32" (
set /a BUILD_LIB_NET_SOCKETS_32=1
) else if "%~1"=="+lib-netsockets-64" (
set /a BUILD_LIB_NET_SOCKETS_64=1
) else if "%~1"=="-j" (
call :get_parallel_threads_count %~2 || (
call :err_msg "Invalid arg after -j, expected a number"
Expand Down Expand Up @@ -371,6 +378,14 @@ if %BUILD_TOOL_LOBBY% equ 1 (
echo: & echo:
)

:: networking sockets lib (x32)
if %BUILD_LIB_NET_SOCKETS_32% equ 1 (
call :compile_networking_sockets_lib_32 || (
set /a last_code+=1
)
echo: & echo:
)

endlocal & set /a last_code=%last_code%


Expand Down Expand Up @@ -466,6 +481,14 @@ if %BUILD_EXPCLIENT_EXTRA_64% equ 1 (
echo: & echo:
)

:: networking sockets lib (x64)
if %BUILD_LIB_NET_SOCKETS_64% equ 1 (
call :compile_networking_sockets_lib_64 || (
set /a last_code+=1
)
echo: & echo:
)

endlocal & set /a last_code=%last_code%


Expand Down Expand Up @@ -609,6 +632,18 @@ endlocal & exit /b %_exit%
)
endlocal & exit /b %_exit%

:compile_networking_sockets_lib_32
setlocal
echo // building library steamnetworkingsockets.dll - 32
set src_files="networking_sockets_lib\steamnetworkingsockets.cpp"
call :build_for 1 0 "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets.dll" src_files
set /a _exit=%errorlevel%
if %_exit% equ 0 (
call :change_dos_stub 1 "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets.dll"
call "%signer_tool%" "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets.dll"
)
endlocal & exit /b %_exit%



:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: x64
Expand Down Expand Up @@ -689,6 +724,18 @@ endlocal & exit /b %_exit%
)
endlocal & exit /b %_exit%

:compile_networking_sockets_lib_64
setlocal
echo // building library steamnetworkingsockets64.dll - 64
set src_files="networking_sockets_lib\steamnetworkingsockets.cpp"
call :build_for 0 0 "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets64.dll" src_files
set /a _exit=%errorlevel%
if %_exit% equ 0 (
call :change_dos_stub 0 "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets64.dll"
call "%signer_tool%" "%build_root_dir%\networking_sockets_lib\steamnetworkingsockets64.dll"
)
endlocal & exit /b %_exit%



:err_msg
Expand Down
Loading

0 comments on commit 1a5998d

Please sign in to comment.