Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linux compatibility #39

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,26 @@ You can find Source 2013 CE's roadmap by going to our [Trello board](https://tre
And you can also give us suggestions for fixes and features that you'd like to see in our Discord channel (`#source-SDK-2013-ce`) found in the
Source Modding Community server, which you can join [here](https://discord.gg/BD6WpY5).

# Requirements
To be able to use Source 2013 CE you will need to download:
* Visual Studio 2019
* Multibyte MFC Library for Visual Studio 2019
* Windows SDK 10.0.22000.0
# Building Guide

## Windows
1. Install dependencies Visual Studio 2019 or higher, Multibyte MFC Library, Windows SDK 10.0.22000.0
2. Navigate to `[SDK_ROOT]/[GAME]/src` and run `./createallprojects` or `./creategameprojects`
3. Open Everything.sln or Game.sln and right click on Everything or Game, then select Build Solution

## Linux (Debian)
1. Install dependencies `sudo apt-get install build-essential gcc-multilib g++-multilib`
2. Download Valve's [Steam Runtime repo](https://github.com/ValveSoftware/steam-runtime)
3. Go into the steam-runtime directory and run:
```sh
./setup_chroot.sh --i386
```
4. Run the following commands:
```sh
cd [SDK_ROOT]/[GAME]/src
[SCRIPT]
sudo schroot --chroot steamrt_scout_i386 -- make -f [MAKEFILE].mak
```

# Contributing
We appreciate any form of help so ideally if you want to help this project out the best way would be to make a pull request.
Expand All @@ -27,5 +42,6 @@ Thank you for trying out this project we hope we will help you out with your Sou

Made with :heart: by [@Nbc66](https://github.com/Nbc66) & [@GamerDude27](https://github.com/GamerDude27)

Credits for 2019 support: momentum mod, Brae, and Anthonypython
Credits for Linux support: Momentum Mod
Credits for 2019 support: Momentum Mod, Brae, and Anthonypython
Credits for CI: TF2Vintage, Deathreus, Dio, Anthonypython
49 changes: 26 additions & 23 deletions sp/src/devtools/makefile_base_posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# Base makefile for Linux.
#
# !!!!! Note to future editors !!!!!
#
#
# before you make changes, make sure you grok:
# 1. the difference between =, :=, +=, and ?=
# 1. the difference between =, :=, +=, and ?=
# 2. how and when this base makefile gets included in the generated makefile(s)
# ( see http://www.gnu.org/software/make/manual/make.html#Flavors )
#
Expand Down Expand Up @@ -48,7 +48,7 @@ else
endif

# CPPFLAGS == "c/c++ *preprocessor* flags" - not "cee-plus-plus flags"
ARCH_FLAGS =
ARCH_FLAGS =
BUILDING_MULTI_ARCH = 0
# Preserve cflags set in environment
ENV_CFLAGS := $(CFLAGS)
Expand All @@ -62,7 +62,7 @@ ifeq ($(CLANG_BUILD),1)
CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -Wno-c++11-narrowing -Wno-dangling-else $(ENV_CXXFLAGS)
else
# !!! ABI COMPAT: -fabi-compat-version=2 is needed to generate the proper symbols for linking
CXXFLAGS = $(BASE_CFLAGS) -std=gnu++0x -fpermissive -fabi-compat-version=2 $(ENV_CXXFLAGS)
CXXFLAGS = $(BASE_CFLAGS) -std=gnu++17 -fpermissive -fabi-compat-version=2 $(ENV_CXXFLAGS)
# Diagnostics coloring
CXXFLAGS += -fdiagnostics-color=always
endif
Expand All @@ -74,16 +74,16 @@ DEFINES += -DVPROF_LEVEL=1 -DGNUC -DNO_HOOK_MALLOC -DNO_MALLOC_OVERRIDE
# DEFINES += -D_FILE_OFFSET_BITS=64

LDFLAGS = $(CFLAGS) $(GCC_ExtraLinkerFlags) $(OptimizerLevel)
GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P)
GENDEP_CXXFLAGS = -MMD -MP -MF $(@:.o=.P)
MAP_FLAGS =
Srv_GAMEOUTPUTFILE =
Srv_GAMEOUTPUTFILE =
COPY_DLL_TO_SRV = 0

# We should always specify -Wl,--build-id, as documented at:
# http://linux.die.net/man/1/ld and http://fedoraproject.org/wiki/Releases/FeatureBuildId.http://fedoraproject.org/wiki/Releases/FeatureBuildId
LDFLAGS += -Wl,--build-id

GCC_VER =
GCC_VER = -9
P4BIN = p4
CRYPTOPPDIR=ubuntu12_32

Expand Down Expand Up @@ -116,7 +116,7 @@ ifeq ($(origin AR), default)
AR = ar crs
endif
ifeq ($(origin CC), default)
CC = $(CCACHE) gcc$(GCC_VER)
CC = $(CCACHE) gcc$(GCC_VER)
endif
ifeq ($(origin CXX), default)
CXX = $(CCACHE) g++$(GCC_VER)
Expand All @@ -143,17 +143,20 @@ endif

ifeq ($(CLANG_BUILD),1)
# Clang specific flags
else ifeq ($(GCC_VER),-4.8)
else ifeq ($(GCC_VER),-9)
WARN_FLAGS += -Wno-unused-local-typedefs
WARN_FLAGS += -Wno-unused-result
WARN_FLAGS += -Wno-narrowing
WARN_FLAGS += -Wno-class-memaccess
# WARN_FLAGS += -Wno-unused-function
endif

WARN_FLAGS += -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers
WARN_FLAGS += -Wno-sign-compare -Wno-reorder -Wno-invalid-offsetof -Wno-float-equal -Werror=return-type -Wno-narrowing
WARN_FLAGS += -fdiagnostics-show-option -Wformat -Wformat-security
WARN_FLAGS += -Wno-class-memaccess -Wno-unused-local-typedefs -Wno-ignored-attributes
# WARN_FLAGS += -Wno-class-memaccess -Wno-unused-local-typedefs -Wno-ignored-attributes

WARN_FLAGS += -Werror=parentheses

ifeq ($(TARGET_PLATFORM),linux64)
# nocona = pentium4 + 64bit + MMX, SSE, SSE2, SSE3 - no SSSE3 (that's three s's - added in core2)
Expand All @@ -163,10 +166,10 @@ ifeq ($(TARGET_PLATFORM),linux64)
LIBSTDCXXPIC := $(shell $(CXX) -print-file-name=libstdc++-pic.a)
else
# pentium4 = MMX, SSE, SSE2 - no SSE3 (added in prescott) # -msse3 -mfpmath=sse
ARCH_FLAGS += -m32 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
ARCH_FLAGS += -m32 -fabi-compat-version=2 -march=$(MARCH_TARGET) -mtune=core2 $(SSE_GEN_FLAGS)
LD_SO = ld-linux.so.2
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.so)
LIBSTDCXX := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.a)
LIBSTDCXXPIC := $(shell $(CXX) $(ARCH_FLAGS) -print-file-name=libstdc++.a)
LDFLAGS += -m32
endif

Expand Down Expand Up @@ -197,7 +200,7 @@ PATHWRAP = $(_WRAP)fopen $(_WRAP)freopen $(_WRAP)open $(_WRAP)creat $(_WRA
$(_WRAP)mount $(_WRAP)mkfifo $(_WRAP)mkdir $(_WRAP)rmdir $(_WRAP)scandir $(_WRAP)realpath

LIB_START_EXE = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread
LIB_END_EXE = -Wl,--end-group -lm -ldl $(LIBSTDCXX) -lpthread

LIB_START_SHLIB = $(PATHWRAP) -static-libgcc -Wl,--start-group
LIB_END_SHLIB = -Wl,--end-group -lm -ldl $(LIBSTDCXXPIC) -lpthread -l:$(LD_SO) -Wl,--version-script=$(SRCROOT)/devtools/version_script.linux.txt
Expand Down Expand Up @@ -227,8 +230,8 @@ C_TO_OBJ = $(MM_TO_OBJ:.c=.o)
OBJS = $(addprefix $(OBJ_DIR)/, $(notdir $(C_TO_OBJ)))

ifeq ($(MAKE_VERBOSE),1)
QUIET_PREFIX =
QUIET_ECHO_POSTFIX =
QUIET_PREFIX =
QUIET_ECHO_POSTFIX =
else
QUIET_PREFIX = @
QUIET_ECHO_POSTFIX = > /dev/null
Expand All @@ -253,9 +256,9 @@ endif
# we generate dependencies as a side-effect of compilation now
GEN_DEP_FILE=

PRE_COMPILE_FILE =
PRE_COMPILE_FILE =

POST_COMPILE_FILE =
POST_COMPILE_FILE =

ifeq ($(BUILDING_MULTI_ARCH),1)
SINGLE_ARCH_CXXFLAGS=$(subst -arch x86_64,,$(CXXFLAGS))
Expand Down Expand Up @@ -298,8 +301,8 @@ else

P4_EDIT_START := for f in
P4_EDIT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - edit -c $(P4_EDIT_CHANGELIST); else $(P4BIN) edit -c $(P4_EDIT_CHANGELIST) $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - revert; else $(P4BIN) revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
P4_REVERT_START := for f in
P4_REVERT_END := ; do if [ -n $$f ]; then if [ -d $$f ]; then find $$f -type f -print | $(P4BIN) -x - revert; else $(P4BIN) revert $$f; fi; fi; done $(QUIET_ECHO_POSTFIX)
endif

ifeq ($(CONFTYPE),dll)
Expand Down Expand Up @@ -386,8 +389,8 @@ cleantargets:
$(QUIET_PREFIX) rm -f $(OUTPUTFILE) $(GAMEOUTPUTFILE)


$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
$(LIB_File): $(OTHER_DEPENDENCIES) $(OBJS)
$(QUIET_PREFIX) -$(P4_EDIT_START) $(LIB_File) $(P4_EDIT_END);
$(QUIET_PREFIX) $(AR) $(LIB_File) $(OBJS) $(LIBFILES);

SO_GameOutputFile = $(GAMEOUTPUTFILE)
Expand All @@ -405,7 +408,7 @@ $(SO_GameOutputFile): $(SO_File)
$(QUIET_PREFIX) rm -f $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) cp -v $(OUTPUTFILE) $(GAMEOUTPUTFILE) $(QUIET_ECHO_POSTFIX);
$(QUIET_PREFIX) -$(P4_EDIT_START) $(GAMEOUTPUTFILE)$(SYM_EXT) $(P4_EDIT_END);
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) $(GEN_SYM) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) -$(STRIP) $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) $(VSIGN) -signvalve $(GAMEOUTPUTFILE);
$(QUIET_PREFIX) if [ "$(COPY_DLL_TO_SRV)" = "1" ]; then\
Expand Down
Loading