Skip to content

Commit

Permalink
Merge Windows support on main!!
Browse files Browse the repository at this point in the history
Provision 2.2.0
  • Loading branch information
Dadoum authored Jul 30, 2023
2 parents c5e5f97 + b8c41d4 commit a4c0306
Show file tree
Hide file tree
Showing 23 changed files with 3,467 additions and 130 deletions.
48 changes: 33 additions & 15 deletions .github/workflows/cmake-cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,47 +8,65 @@ env:

jobs:
build-anisette-server-aarch64:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container: ubuntu:23.04

steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/ppa
apt-get install -y git gdc-13-aarch64-linux-gnu dub libz-dev elfutils
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gdc-12-aarch64-linux-gnu dub libz-dev

- name: Build
run: dub build :anisette-server -b release --compiler=aarch64-linux-gnu-gdc-12 -c "static"
run: dub build :anisette-server -b release --compiler=aarch64-linux-gnu-gdc-13 -c "static"

- name: Rename
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-aarch64"
run: mv "bin/provision_anisette-server" "bin/anisette-server-aarch64"

- name: Put debug symbols in a separate file
run: eu-strip --strip-debug -f "bin/anisette-server-aarch64.dbg" "bin/anisette-server-aarch64"

- uses: actions/upload-artifact@v3
with:
name: anisette-server-aarch64
path: |
${{github.workspace}}/bin/anisette-server-aarch64
bin/anisette-server-aarch64
bin/anisette-server-aarch64.dbg
build-anisette-server-armv7:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container: ubuntu:23.04

steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/ppa
apt-get install -y git gdc-13-arm-linux-gnueabihf dub libz-dev elfutils
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gdc-12-arm-linux-gnueabihf dub libz-dev

- name: Build
run: dub build :anisette-server -b release --compiler=arm-linux-gnueabihf-gdc-12 -c "static"
run: dub build :anisette-server -b release --compiler=arm-linux-gnueabihf-gdc-13 -c "static"

- name: Rename
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-armv7"
run: mv "bin/provision_anisette-server" "bin/anisette-server-armv7"

- name: Put debug symbols in a separate file
run: eu-strip --strip-debug -f "bin/anisette-server-armv7.dbg" "bin/anisette-server-armv7"

- uses: actions/upload-artifact@v3
with:
name: anisette-server-armv7
path: |
${{github.workspace}}/bin/anisette-server-armv7
bin/anisette-server-armv7
bin/anisette-server-armv7.dbg
35 changes: 35 additions & 0 deletions .github/workflows/cmake-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Windows build

on: push

env:
BUILD_TYPE: Release

jobs:
build-anisette-server-windows-x86_64:
runs-on: windows-2019

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: actions/checkout@v2
- uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-latest

- name: Build
run: dub build :anisette-server -b release-debug -c "static"

- name: Rename
run: |
mv "${{github.workspace}}/bin/provision_anisette-server.exe" "${{github.workspace}}/bin/anisette-server-x86_64.exe"
mv "${{github.workspace}}/bin/provision_anisette-server.pdb" "${{github.workspace}}/bin/anisette-server-x86_64.pdb"
- uses: actions/upload-artifact@v3
with:
name: anisette-server-x86_64
path: |
${{github.workspace}}/bin/anisette-server-x86_64.exe
${{github.workspace}}/bin/anisette-server-x86_64.pdb
35 changes: 25 additions & 10 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: x86_64 builds
name: x86 builds

on: push

Expand All @@ -15,40 +15,55 @@ jobs:
submodules: recursive

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gdc-12 dub libz-dev
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
sudo apt-get update && sudo apt-get install -y gdc-13 dub libz-dev elfutils
- name: Build
run: dub build :anisette-server -b release --compiler=gdc-12 -c "static"
run: dub build :anisette-server -b release --compiler=gdc-13 -c "static"

- name: Rename
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-x86_64"

- name: Put debug symbols in a separate file
run: eu-strip --strip-debug -f "${{github.workspace}}/bin/anisette-server-x86_64.dbg" "${{github.workspace}}/bin/anisette-server-x86_64"

- uses: actions/upload-artifact@v3
with:
name: anisette-server-x86_64
path: |
${{github.workspace}}/bin/anisette-server-x86_64
${{github.workspace}}/bin/anisette-server-x86_64.dbg
build-anisette-server-i686:
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
container: ubuntu:23.04

steps:
- name: Install dependencies
run: |
apt-get update
apt-get install -y software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/ppa
apt-get install -y git gdc-13-i686-linux-gnu dub libz-dev elfutils
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y gdc-12-i686-linux-gnu dub libz-dev

- name: Build
run: dub build :anisette-server -b release --compiler=i686-linux-gnu-gdc-12 -c "static"
run: dub build :anisette-server -b release --compiler=i686-linux-gnu-gdc-13 -c "static"

- name: Rename
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-i686"
run: mv "bin/provision_anisette-server" "bin/anisette-server-i686"

- name: Put debug symbols in a separate file
run: eu-strip --strip-debug -f "bin/anisette-server-i686.dbg" "bin/anisette-server-i686"

- uses: actions/upload-artifact@v3
with:
name: anisette-server-i686
path: |
${{github.workspace}}/bin/anisette-server-i686
bin/anisette-server-i686
bin/anisette-server-i686.dbg
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
bin/
.dub/
dub.selections.json
cmake-build-*
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ else()
endif()
endif()

target_link_libraries(provision PUBLIC plist slf4d)
target_link_libraries(provision PUBLIC plist slf4d requests)

set(RETRIEVE_HEADERS_SOURCE_DIR "retrieve_headers/")
file(GLOB_RECURSE RETRIEVE_HEADERS_D_SOURCES "${RETRIEVE_HEADERS_SOURCE_DIR}*.d")
Expand Down
23 changes: 20 additions & 3 deletions anisette_server/app.d
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import std.getopt;
import std.math;
import std.net.curl;
import std.parallelism;
import process = std.process;
import std.path;
import std.zip;

Expand Down Expand Up @@ -49,9 +50,20 @@ void main(string[] args) {
serverConfig.port = 6969;

bool rememberMachine = true;
string configurationPath = expandTilde("~/.config/Provision");
bool onlyInit = false;
bool apkDownloadAllowed = true;
version (Windows) {
string configurationPath = process.environment["LocalAppData"].buildPath("Provision");
} else {
string configurationPath;
string xdgConfigPath = process.environment.get("XDG_CONFIG_HOME");
if (xdgConfigPath) {
configurationPath = xdgConfigPath.buildPath("Provision");
} else {
configurationPath = expandTilde("~/.config/Provision/");
}
}

auto helpInformation = getopt(
args,
"n|host", format!"The hostname to bind to (default: %s)"(serverConfig.hostname), &serverConfig.hostname,
Expand All @@ -72,7 +84,7 @@ void main(string[] args) {
file.mkdirRecurse(configurationPath);
}

string libraryPath = configurationPath.buildPath("lib/");
string libraryPath = configurationPath.buildPath("lib/").buildPath(architectureIdentifier ~ "/");

auto coreADIPath = libraryPath.buildPath("libCoreADI.so");
auto SSCPath = libraryPath.buildPath("libstoreservicescore.so");
Expand Down Expand Up @@ -164,7 +176,12 @@ void main(string[] args) {
import std.datetime.systime;
import std.datetime.timezone;
import core.time;
auto time = Clock.currTime();
version (Windows) {
import std.datetime.timezone;
auto time = Clock.currTime(UTC());
} else {
auto time = Clock.currTime();
}

auto otp = adi.requestOTP(dsId);

Expand Down
1 change: 1 addition & 0 deletions cmake/dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

include(UseDub)

DubProject_Add(requests ~2.0.9)
DubProject_Add(slf4d ~2.1.1)

if(build_anisetteserver)
Expand Down
6 changes: 4 additions & 2 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ targetPath "bin"
sourcePaths "lib"
importPaths "lib"

dependency "slf4d" version="~>2.1.1"
dependency "requests" version="~>2"
dependency "slf4d" version="~>2"

configuration "plist-d" {
dependency "plist" version="~master"
Expand All @@ -30,6 +31,7 @@ subPackage {
sourcePaths "retrieve_headers"

dependency "provision" version="*"
// lflags "/usr/x86_64-w64-mingw32ucrt/sys-root/mingw/lib/libws2_32.a" "/usr/x86_64-w64-mingw32ucrt/sys-root/mingw/lib/libmincore.a" "/usr/x86_64-w64-mingw32ucrt/sys-root/mingw/lib/libwsock32.a" platform="gdc"
}

subPackage {
Expand Down Expand Up @@ -62,7 +64,7 @@ subPackage {

configuration "static" {
targetType "executable"
lflags "-lz" platform="ldc"
lflags "-lz" platform="linux-ldc"
dflags "--link-defaultlib-shared=false" platform="ldc"
dflags "-defaultlib=:libgphobos.a" platform="gdc"
}
Expand Down
8 changes: 7 additions & 1 deletion dub.selections.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"fileVersion": 1,
"versions": {
"automem": "0.6.9",
"cachetools": "0.4.1",
"dxml": "0.4.3",
"handy-httpd": "5.2.1",
"httparsed": "1.2.1",
"plist": "~master",
"slf4d": "2.1.1"
"plist-d": {"version":"d494cf3fe79a2bb20583173c0c8cf85ef33b719e","repository":"git+https://github.com/Dadoum/libplist-d.git"},
"requests": "2.0.9",
"slf4d": "2.1.1",
"test_allocator": "0.3.4",
"unit-threaded": "0.10.8"
}
}
Loading

0 comments on commit a4c0306

Please sign in to comment.