-
Notifications
You must be signed in to change notification settings - Fork 15
/
Makefile
150 lines (125 loc) · 5.24 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
.if !defined(OSVERSION)
OSVERSION != awk '/^\#define[[:blank:]]__FreeBSD_version/ {print $$3}' < /usr/include/sys/param.h # from bsd.port.mk
.endif
PROJECT = steam-utils
BUILD_DIR ?= .
PREFIX ?= /opt
CFLAGS = --sysroot=/compat/linux -std=c99 -Wall -Wextra -Wno-unused-parameter -D__FreeBSD_version=${OSVERSION}
LIBS = lib32/steamfix/steamfix.so \
lib32/fakenm/libnm.so.0 \
lib32/fakenm/libnm-glib.so.4 \
lib32/fakepulse/libpulse.so.0 \
lib64/fakepulse/libpulse.so.0 \
lib32/fakeudev/libudev.so.0 \
lib64/fakeudev/libudev.so.0 \
lib32/fakeudev/libudev.so.1 \
lib64/fakeudev/libudev.so.1 \
lib32/noepollexcl/noepollexcl.so \
lib64/noepollexcl/noepollexcl.so \
lib32/pathfix/pathfix.so \
lib64/pathfix/pathfix.so \
lib32/protonfix/protonfix.so \
lib64/protonfix/protonfix.so \
lib32/shmfix/shmfix.so \
lib64/shmfix/shmfix.so \
lib64/webfix/webfix.so \
lib32/steamclient/dt_init-fix.so
LIBS := ${LIBS:C|(.*)|$(BUILD_DIR)/\1|}
build: $(LIBS)
.for b in 32 64
$(BUILD_DIR)/lib$(b)/steamfix/steamfix.so: src/steamfix.c src/pathfix.c
mkdir -p $(BUILD_DIR)/lib$(b)/steamfix
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/steamfix.c src/pathfix.c -pthread -ldl -lm
$(BUILD_DIR)/lib$(b)/fakenm/libnm.so.0: src/fakenm.c
mkdir -p $(BUILD_DIR)/lib$(b)/fakenm
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/fakenm.c
$(BUILD_DIR)/lib$(b)/fakenm/libnm-glib.so.4: $(BUILD_DIR)/lib$(b)/fakenm/libnm.so.0
ln -s libnm.so.0 $(.TARGET)
$(BUILD_DIR)/lib$(b)/fakepulse/libpulse.so.0: src/fakepulse.c
mkdir -p $(BUILD_DIR)/lib$(b)/fakepulse
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/fakepulse.c
$(BUILD_DIR)/lib$(b)/fakeudev/libudev.so.0: src/fakeudev.c
mkdir -p $(BUILD_DIR)/lib$(b)/fakeudev
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/fakeudev.c
$(BUILD_DIR)/lib$(b)/fakeudev/libudev.so.1: $(BUILD_DIR)/lib$(b)/fakeudev/libudev.so.0
ln -s libudev.so.0 $(.TARGET)
$(BUILD_DIR)/lib$(b)/pathfix/pathfix.so: src/pathfix.c
mkdir -p $(BUILD_DIR)/lib$(b)/pathfix
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/pathfix.c -ldl
$(BUILD_DIR)/lib$(b)/protonfix/protonfix.so: src/protonfix.c
mkdir -p $(BUILD_DIR)/lib$(b)/protonfix
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/protonfix.c -pthread -ldl
$(BUILD_DIR)/lib$(b)/webfix/webfix.so: src/webfix.c
mkdir -p $(BUILD_DIR)/lib$(b)/webfix
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/webfix.c -pthread -ldl -lm
$(BUILD_DIR)/lib$(b)/noepollexcl/noepollexcl.so: src/noepollexcl.c
mkdir -p $(BUILD_DIR)/lib$(b)/noepollexcl
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/noepollexcl.c -ldl
$(BUILD_DIR)/lib$(b)/shmfix/shmfix.so: src/shmfix.c
mkdir -p $(BUILD_DIR)/lib$(b)/shmfix
/compat/linux/bin/cc -m$(b) $(CFLAGS) -fPIC -shared -o $(.TARGET) src/shmfix.c -ldl -lrt
.endfor
$(BUILD_DIR)/lib32/steamclient/dt_init-fix.so: src/dt_init-fix.c
mkdir -p $(BUILD_DIR)/lib32/steamclient
cc -m32 -mstack-alignment=16 -mstackrealign -std=c99 -Wall -Wextra -fPIC -shared -o $(.TARGET) src/dt_init-fix.c
clean:
.for f in $(LIBS)
. if exists($f)
rm $f
. endif
.endfor
install:
install -d $(PREFIX)/$(PROJECT)
install -d $(PREFIX)/$(PROJECT)/bin
install -d $(PREFIX)/$(PROJECT)/lib32
install -d $(PREFIX)/$(PROJECT)/lib64
install -d $(PREFIX)/$(PROJECT)/lxbin
.for f in $(LIBS)
install -d `dirname $(PREFIX)/$(PROJECT)/${f:C|$(BUILD_DIR)/(.*)|\1|}`
install $(f) $(PREFIX)/$(PROJECT)/${f:C|$(BUILD_DIR)/(.*)|\1|}
.endfor
install bin/.dpkgs.rb bin/.utils.rb bin/lsu-* bin/steam $(PREFIX)/$(PROJECT)/bin
install \
lxbin/curl-config \
lxbin/dbus-launch \
lxbin/file* \
lxbin/lsof \
lxbin/lspci \
lxbin/lsu-* \
lxbin/tar \
lxbin/xdg-user-dir \
lxbin/xrandr \
lxbin/zenity \
$(PREFIX)/$(PROJECT)/lxbin
.for t in LSU_FreeBSD_Wine LSU_Proton_8_chroot LSU_Scout_chroot LSU_Sniper_chroot
install -d $(PREFIX)/$(PROJECT)/tools/$(t)
install -m 0644 tools/$(t)/compatibilitytool.vdf $(PREFIX)/$(PROJECT)/tools/$(t)
install -m 0644 tools/$(t)/toolmanifest.vdf $(PREFIX)/$(PROJECT)/tools/$(t)
install tools/$(t)/run.sh tools/$(t)/*.rb $(PREFIX)/$(PROJECT)/tools/$(t)
.endfor
deinstall:
.if exists($(PREFIX)/$(PROJECT))
rm -r -I $(PREFIX)/$(PROJECT)
.endif
NVIDIA_DEPS != \
case `sysctl -q hw.nvidia.version | sed -n "s/hw.nvidia.version: NVIDIA UNIX x86_64 Kernel Module \([0-9]*\).*/\1/p"` in \
'') echo '' ;; \
340) echo linux-nvidia-libs-340;; \
390) echo linux-nvidia-libs-390;; \
470) echo linux-nvidia-libs-470;; \
*) echo linux-nvidia-libs;; \
esac
DEPS = ruby \
ca_root_nss \
gtar \
liberation-fonts-ttf \
linux_libusb-c7 \
linux-c7-alsa-plugins-oss \
linux-c7-dbus-libs \
linux-c7-devtools \
linux-c7-dri \
linux-c7-gtk2 \
linux-c7-nss \
zenity
dependencies:
pkg install -r FreeBSD ${DEPS} ${NVIDIA_DEPS}