diff --git a/.gitignore b/.gitignore index a307ee7..f2a34b3 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ backend/.gocache backend/.gocache-build backend/.gocache-linux backend/.deb-build +backend/dist +backend/nsfwapp.exe +backend/nsfwapp-linux-amd64 diff --git a/backend/build.bat b/backend/build.bat index 2a4dfa6..d486ac0 100644 --- a/backend/build.bat +++ b/backend/build.bat @@ -7,21 +7,25 @@ set "LOCAL_GOCACHE=%CD%\.gocache-build" if exist "%LOCAL_GOCACHE%" rmdir /s /q "%LOCAL_GOCACHE%" >nul 2>nul set "GOCACHE=%LOCAL_GOCACHE%" +if not exist dist mkdir dist +if exist nsfwapp.exe del /q nsfwapp.exe >nul 2>nul +if exist nsfwapp-linux-amd64 del /q nsfwapp-linux-amd64 >nul 2>nul + echo Baue Windows x64... -if exist nsfwapp.exe del /q nsfwapp.exe >nul 2>nul +if exist dist\nsfwapp.exe del /q dist\nsfwapp.exe >nul 2>nul set GOOS=windows set GOARCH=amd64 set CGO_ENABLED=1 -go build -ldflags="-H=windowsgui" -o nsfwapp.exe +go build -ldflags="-H=windowsgui" -o dist\nsfwapp.exe if errorlevel 1 goto error echo. echo Baue Debian/Linux x64 via WSL... -if exist nsfwapp-linux-amd64 del /q nsfwapp-linux-amd64 >nul 2>nul +if exist dist\nsfwapp-linux-amd64 del /q dist\nsfwapp-linux-amd64 >nul 2>nul where wsl >nul 2>nul if errorlevel 1 goto wsl_missing @@ -37,15 +41,9 @@ if errorlevel 1 goto wsl_go_missing wsl bash -lc "command -v gcc >/dev/null 2>&1 && command -v pkg-config >/dev/null 2>&1" if errorlevel 1 goto wsl_build_deps_missing -wsl bash -lc "cd ""%WSL_CWD%"" && mkdir -p .gocache-linux && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GOCACHE=""$PWD/.gocache-linux"" go build -o nsfwapp-linux-amd64" +wsl bash -lc "cd ""%WSL_CWD%"" && mkdir -p dist .gocache-linux && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GOCACHE=""$PWD/.gocache-linux"" go build -o dist/nsfwapp-linux-amd64" if errorlevel 1 goto error -if not exist nsfwapp-linux-amd64 goto linux_output_missing - -if not exist dist mkdir dist -copy /y nsfwapp.exe dist\nsfwapp.exe >nul -if errorlevel 1 goto dist_copy_error -copy /y nsfwapp-linux-amd64 dist\nsfwapp-linux-amd64 >nul -if errorlevel 1 goto dist_copy_error +if not exist dist\nsfwapp-linux-amd64 goto linux_output_missing echo. echo Baue Debian Application Package via WSL... @@ -55,10 +53,8 @@ if errorlevel 1 goto deb_package_error echo. echo Build erfolgreich. -echo Windows: nsfwapp.exe -echo Debian: nsfwapp-linux-amd64 -echo Dist: dist\nsfwapp.exe -echo Dist: dist\nsfwapp-linux-amd64 +echo Windows: dist\nsfwapp.exe +echo Debian: dist\nsfwapp-linux-amd64 echo Debian-Paket: dist\nsfwapp_*.deb goto end @@ -119,18 +115,12 @@ exit /b 1 :linux_output_missing echo. echo Debian/Linux-Build wurde nicht erzeugt: -echo nsfwapp-linux-amd64 +echo dist\nsfwapp-linux-amd64 echo. echo Pruefe, ob in WSL eine Debian/Ubuntu-Distribution mit Go und den Build-Abhaengigkeiten installiert ist. call :cleanup_cache exit /b 1 -:dist_copy_error -echo. -echo Build-Artefakte konnten nicht nach dist kopiert werden. -call :cleanup_cache -exit /b 1 - :deb_package_error echo. echo Debian-Paket-Build fehlgeschlagen. diff --git a/backend/build_deb.sh b/backend/build_deb.sh index 500a2e8..0fb0a64 100644 --- a/backend/build_deb.sh +++ b/backend/build_deb.sh @@ -7,8 +7,8 @@ VERSION="${DEB_VERSION:-0.1.0}" ARCH="${DEB_ARCH:-amd64}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -BIN_PATH="$SCRIPT_DIR/nsfwapp-linux-amd64" OUT_DIR="$SCRIPT_DIR/dist" +BIN_PATH="$OUT_DIR/nsfwapp-linux-amd64" OUT_FILE="$OUT_DIR/${PACKAGE_NAME}_${VERSION}_${ARCH}.deb" CLEAN_BUILD_DIR=0 @@ -37,6 +37,8 @@ fail() { command -v dpkg-deb >/dev/null 2>&1 || fail "dpkg-deb fehlt. Installiere es mit: sudo apt install -y dpkg-dev" +mkdir -p "$OUT_DIR" + if [ ! -f "$BIN_PATH" ] || [ "${DEB_SKIP_REBUILD:-0}" != "1" ]; then command -v go >/dev/null 2>&1 || fail "go fehlt. Installiere Go oder baue zuerst mit build.bat." command -v gcc >/dev/null 2>&1 || fail "gcc fehlt. Installiere: sudo apt install -y build-essential" @@ -52,14 +54,8 @@ fi [ -f "$BIN_PATH" ] || fail "Linux-Binary nicht gefunden: $BIN_PATH" -mkdir -p "$OUT_DIR" -cp -f "$BIN_PATH" "$OUT_DIR/nsfwapp-linux-amd64" chmod 0755 "$OUT_DIR/nsfwapp-linux-amd64" 2>/dev/null || true -if [ -f "$SCRIPT_DIR/nsfwapp.exe" ]; then - cp -f "$SCRIPT_DIR/nsfwapp.exe" "$OUT_DIR/nsfwapp.exe" -fi - mkdir -p \ "$PKG_ROOT/DEBIAN" \ "$PKG_ROOT/opt/nsfwapp" \ diff --git a/backend/dist/nsfwapp.exe b/backend/dist/nsfwapp.exe index dcb5405..cd929eb 100644 Binary files a/backend/dist/nsfwapp.exe and b/backend/dist/nsfwapp.exe differ diff --git a/backend/dist/nsfwapp_0.1.0_amd64.deb b/backend/dist/nsfwapp_0.1.0_amd64.deb index 7924cb7..c65e797 100644 Binary files a/backend/dist/nsfwapp_0.1.0_amd64.deb and b/backend/dist/nsfwapp_0.1.0_amd64.deb differ diff --git a/backend/nsfwapp-linux-amd64 b/backend/nsfwapp-linux-amd64 deleted file mode 100644 index a82ff87..0000000 Binary files a/backend/nsfwapp-linux-amd64 and /dev/null differ diff --git a/backend/nsfwapp.exe b/backend/nsfwapp.exe deleted file mode 100644 index dcb5405..0000000 Binary files a/backend/nsfwapp.exe and /dev/null differ