Cross-compilation attempts (not successful yet)
This commit is contained in:
@@ -2,13 +2,27 @@
|
||||
|
||||
SRC = src
|
||||
DIST = out
|
||||
CROSSPREFIX=x86_64-w64-mingw32
|
||||
CROSSCC = $(CROSSPREFIX)-gcc
|
||||
CROSSCXX = $(CROSSPREFIX)-g++
|
||||
|
||||
.PHONY: all test clean
|
||||
|
||||
all:
|
||||
$(MAKE) -C $(SRC)
|
||||
$(MAKE) -C $(SRC) unix
|
||||
$(MAKE) dist
|
||||
|
||||
win64:
|
||||
$(MAKE) -C $(SRC) win64
|
||||
$(MAKE) dist
|
||||
|
||||
win64-cross:
|
||||
$(MAKE) -C $(SRC) CGO_ENABLED=1 CC=$(CROSSCC) CXX=$(CROSSCXX) win64
|
||||
$(MAKE) dist
|
||||
|
||||
dist:
|
||||
mkdir -p $(DIST)
|
||||
mv $(SRC)/streamgoose $(DIST)/
|
||||
mv $(SRC)/streamgoose* $(DIST)/
|
||||
cp -r webroot $(DIST)/
|
||||
cp -r auth $(DIST)/
|
||||
cp -r external $(DIST)/
|
||||
|
||||
@@ -92,9 +92,28 @@ Just run `make` and get all the resulting files in the `out` directory.
|
||||
|
||||
TBD
|
||||
|
||||
### Windows
|
||||
### Windows x64 (native)
|
||||
|
||||
TBD
|
||||
You need to have Go 1.23.1 and above and a POSIX-compatible "make" in your %PATH%.
|
||||
|
||||
Just run `make win64` and get all the resulting files in the `out` directory.
|
||||
|
||||
### Windows x64 (cross-compiling from Linux)
|
||||
|
||||
This process is still unstable and can fail at any time.
|
||||
|
||||
1. Install the `mingw-w64` compiler package.
|
||||
2. Run `make win64-cross`
|
||||
|
||||
If the compiler complains about the `EventToken.h` file when building `webview_go` dependency, locate the include files and symlink it to the real `eventtoken.h` like this (as root):
|
||||
|
||||
```
|
||||
# ln -s /usr/x86_64-w64-mingw32/include/eventtoken.h /usr/x86_64-w64-mingw32/include/EventToken.h
|
||||
```
|
||||
|
||||
Then rerun the command from step 2.
|
||||
|
||||
**Note**: When testing the cross-compiled build under Wine, you must have Microsoft Edge WebView2 Runtime installed in order for the GUI to work at all. You can [download](https://developer.microsoft.com/en-us/microsoft-edge/webview2) this engine directly from the Microsoft website (select "Evergreen Standalone Installer") and install it into your Wine profile. Be sure to enable at least Windows 7 emulation in winecfg.
|
||||
|
||||
## Usage
|
||||
|
||||
|
||||
+6
-1
@@ -1,11 +1,16 @@
|
||||
LDFLAGS = -s -w
|
||||
LDFLAGS_WIN = -H windowsgui -s -w
|
||||
GOFLAGS = -trimpath
|
||||
SOURCES = server.go twitch.go youtube.go
|
||||
BIN = streamgoose
|
||||
|
||||
all: $(SOURCES)
|
||||
unix:
|
||||
go mod tidy
|
||||
go build -o $(BIN) $(GOFLAGS) -ldflags "$(LDFLAGS)" $(SOURCES)
|
||||
|
||||
win64:
|
||||
go mod tidy
|
||||
GOOS=windows GOARCH=amd64 go build -o $(BIN).exe $(GOFLAGS) -ldflags "$(LDFLAGS_WIN)" $(SOURCES)
|
||||
|
||||
clean:
|
||||
rm $(BIN)
|
||||
|
||||
+4
-2
@@ -51,8 +51,10 @@ func appendChatMessages() {
|
||||
msg.Id = global_msg_id
|
||||
|
||||
/* directly call the append function on the JS side */
|
||||
fmt_str := "gooseAppendMessage('%d', '%s', '%s', '%s', '%s', '%s')"
|
||||
bro.Eval(fmt.Sprintf(fmt_str, msg.Id, esc(msg.Type), esc(msg.Timestamp), esc(msg.Username), esc(msg.Text), esc(msg.Icon)))
|
||||
fmt_str := "gooseAppendMessage('%d', '%s', '%s', '%s', '%s', '%s');"
|
||||
js := fmt.Sprintf(fmt_str, msg.Id, esc(msg.Type), esc(msg.Timestamp), esc(msg.Username), esc(msg.Text), esc(msg.Icon))
|
||||
log.Printf("Evaluating JS: %s", js)
|
||||
bro.Eval(js)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ html, body {
|
||||
#msglist {
|
||||
width: 100%;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
#msglist > div { /* individual message block */
|
||||
|
||||
Reference in New Issue
Block a user