Skip to content

Commit a4c0306

Browse files
authored
Merge Windows support on main!!
Provision 2.2.0
2 parents c5e5f97 + b8c41d4 commit a4c0306

File tree

23 files changed

+3467
-130
lines changed

23 files changed

+3467
-130
lines changed

.github/workflows/cmake-cross-compile.yml

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,65 @@ env:
88

99
jobs:
1010
build-anisette-server-aarch64:
11-
runs-on: ubuntu-22.04
11+
runs-on: ubuntu-latest
12+
container: ubuntu:23.04
1213

1314
steps:
15+
- name: Install dependencies
16+
run: |
17+
apt-get update
18+
apt-get install -y software-properties-common
19+
add-apt-repository ppa:ubuntu-toolchain-r/ppa
20+
apt-get install -y git gdc-13-aarch64-linux-gnu dub libz-dev elfutils
21+
1422
- uses: actions/checkout@v3
1523
with:
1624
submodules: recursive
1725

18-
- name: Install dependencies
19-
run: sudo apt-get update && sudo apt-get install -y gdc-12-aarch64-linux-gnu dub libz-dev
20-
2126
- name: Build
22-
run: dub build :anisette-server -b release --compiler=aarch64-linux-gnu-gdc-12 -c "static"
27+
run: dub build :anisette-server -b release --compiler=aarch64-linux-gnu-gdc-13 -c "static"
2328

2429
- name: Rename
25-
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-aarch64"
30+
run: mv "bin/provision_anisette-server" "bin/anisette-server-aarch64"
31+
32+
- name: Put debug symbols in a separate file
33+
run: eu-strip --strip-debug -f "bin/anisette-server-aarch64.dbg" "bin/anisette-server-aarch64"
2634

2735
- uses: actions/upload-artifact@v3
2836
with:
2937
name: anisette-server-aarch64
3038
path: |
31-
${{github.workspace}}/bin/anisette-server-aarch64
32-
39+
bin/anisette-server-aarch64
40+
bin/anisette-server-aarch64.dbg
41+
3342
build-anisette-server-armv7:
34-
runs-on: ubuntu-22.04
43+
runs-on: ubuntu-latest
44+
container: ubuntu:23.04
3545

3646
steps:
47+
- name: Install dependencies
48+
run: |
49+
apt-get update
50+
apt-get install -y software-properties-common
51+
add-apt-repository ppa:ubuntu-toolchain-r/ppa
52+
apt-get install -y git gdc-13-arm-linux-gnueabihf dub libz-dev elfutils
53+
3754
- uses: actions/checkout@v3
3855
with:
3956
submodules: recursive
4057

41-
- name: Install dependencies
42-
run: sudo apt-get update && sudo apt-get install -y gdc-12-arm-linux-gnueabihf dub libz-dev
43-
4458
- name: Build
45-
run: dub build :anisette-server -b release --compiler=arm-linux-gnueabihf-gdc-12 -c "static"
59+
run: dub build :anisette-server -b release --compiler=arm-linux-gnueabihf-gdc-13 -c "static"
4660

4761
- name: Rename
48-
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-armv7"
62+
run: mv "bin/provision_anisette-server" "bin/anisette-server-armv7"
63+
64+
- name: Put debug symbols in a separate file
65+
run: eu-strip --strip-debug -f "bin/anisette-server-armv7.dbg" "bin/anisette-server-armv7"
4966

5067
- uses: actions/upload-artifact@v3
5168
with:
5269
name: anisette-server-armv7
5370
path: |
54-
${{github.workspace}}/bin/anisette-server-armv7
71+
bin/anisette-server-armv7
72+
bin/anisette-server-armv7.dbg

.github/workflows/cmake-windows.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Windows build
2+
3+
on: push
4+
5+
env:
6+
BUILD_TYPE: Release
7+
8+
jobs:
9+
build-anisette-server-windows-x86_64:
10+
runs-on: windows-2019
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
with:
15+
submodules: recursive
16+
17+
- uses: actions/checkout@v2
18+
- uses: dlang-community/setup-dlang@v1
19+
with:
20+
compiler: ldc-latest
21+
22+
- name: Build
23+
run: dub build :anisette-server -b release-debug -c "static"
24+
25+
- name: Rename
26+
run: |
27+
mv "${{github.workspace}}/bin/provision_anisette-server.exe" "${{github.workspace}}/bin/anisette-server-x86_64.exe"
28+
mv "${{github.workspace}}/bin/provision_anisette-server.pdb" "${{github.workspace}}/bin/anisette-server-x86_64.pdb"
29+
30+
- uses: actions/upload-artifact@v3
31+
with:
32+
name: anisette-server-x86_64
33+
path: |
34+
${{github.workspace}}/bin/anisette-server-x86_64.exe
35+
${{github.workspace}}/bin/anisette-server-x86_64.pdb

.github/workflows/cmake.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: x86_64 builds
1+
name: x86 builds
22

33
on: push
44

@@ -15,40 +15,55 @@ jobs:
1515
submodules: recursive
1616

1717
- name: Install dependencies
18-
run: sudo apt-get update && sudo apt-get install -y gdc-12 dub libz-dev
18+
run: |
19+
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
20+
sudo apt-get update && sudo apt-get install -y gdc-13 dub libz-dev elfutils
1921
2022
- name: Build
21-
run: dub build :anisette-server -b release --compiler=gdc-12 -c "static"
23+
run: dub build :anisette-server -b release --compiler=gdc-13 -c "static"
2224

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

28+
- name: Put debug symbols in a separate file
29+
run: eu-strip --strip-debug -f "${{github.workspace}}/bin/anisette-server-x86_64.dbg" "${{github.workspace}}/bin/anisette-server-x86_64"
30+
2631
- uses: actions/upload-artifact@v3
2732
with:
2833
name: anisette-server-x86_64
2934
path: |
3035
${{github.workspace}}/bin/anisette-server-x86_64
36+
${{github.workspace}}/bin/anisette-server-x86_64.dbg
3137
3238
build-anisette-server-i686:
33-
runs-on: ubuntu-22.04
39+
runs-on: ubuntu-latest
40+
container: ubuntu:23.04
3441

3542
steps:
43+
- name: Install dependencies
44+
run: |
45+
apt-get update
46+
apt-get install -y software-properties-common
47+
add-apt-repository ppa:ubuntu-toolchain-r/ppa
48+
apt-get install -y git gdc-13-i686-linux-gnu dub libz-dev elfutils
49+
3650
- uses: actions/checkout@v3
3751
with:
3852
submodules: recursive
3953

40-
- name: Install dependencies
41-
run: sudo apt-get update && sudo apt-get install -y gdc-12-i686-linux-gnu dub libz-dev
42-
4354
- name: Build
44-
run: dub build :anisette-server -b release --compiler=i686-linux-gnu-gdc-12 -c "static"
55+
run: dub build :anisette-server -b release --compiler=i686-linux-gnu-gdc-13 -c "static"
4556

4657
- name: Rename
47-
run: mv "${{github.workspace}}/bin/provision_anisette-server" "${{github.workspace}}/bin/anisette-server-i686"
58+
run: mv "bin/provision_anisette-server" "bin/anisette-server-i686"
59+
60+
- name: Put debug symbols in a separate file
61+
run: eu-strip --strip-debug -f "bin/anisette-server-i686.dbg" "bin/anisette-server-i686"
4862

4963
- uses: actions/upload-artifact@v3
5064
with:
5165
name: anisette-server-i686
5266
path: |
53-
${{github.workspace}}/bin/anisette-server-i686
67+
bin/anisette-server-i686
68+
bin/anisette-server-i686.dbg
5469

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
bin/
22
.dub/
3+
dub.selections.json
4+
cmake-build-*

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ else()
6767
endif()
6868
endif()
6969

70-
target_link_libraries(provision PUBLIC plist slf4d)
70+
target_link_libraries(provision PUBLIC plist slf4d requests)
7171

7272
set(RETRIEVE_HEADERS_SOURCE_DIR "retrieve_headers/")
7373
file(GLOB_RECURSE RETRIEVE_HEADERS_D_SOURCES "${RETRIEVE_HEADERS_SOURCE_DIR}*.d")

anisette_server/app.d

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import std.getopt;
99
import std.math;
1010
import std.net.curl;
1111
import std.parallelism;
12+
import process = std.process;
1213
import std.path;
1314
import std.zip;
1415

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

5152
bool rememberMachine = true;
52-
string configurationPath = expandTilde("~/.config/Provision");
5353
bool onlyInit = false;
5454
bool apkDownloadAllowed = true;
55+
version (Windows) {
56+
string configurationPath = process.environment["LocalAppData"].buildPath("Provision");
57+
} else {
58+
string configurationPath;
59+
string xdgConfigPath = process.environment.get("XDG_CONFIG_HOME");
60+
if (xdgConfigPath) {
61+
configurationPath = xdgConfigPath.buildPath("Provision");
62+
} else {
63+
configurationPath = expandTilde("~/.config/Provision/");
64+
}
65+
}
66+
5567
auto helpInformation = getopt(
5668
args,
5769
"n|host", format!"The hostname to bind to (default: %s)"(serverConfig.hostname), &serverConfig.hostname,
@@ -72,7 +84,7 @@ void main(string[] args) {
7284
file.mkdirRecurse(configurationPath);
7385
}
7486

75-
string libraryPath = configurationPath.buildPath("lib/");
87+
string libraryPath = configurationPath.buildPath("lib/").buildPath(architectureIdentifier ~ "/");
7688

7789
auto coreADIPath = libraryPath.buildPath("libCoreADI.so");
7890
auto SSCPath = libraryPath.buildPath("libstoreservicescore.so");
@@ -164,7 +176,12 @@ void main(string[] args) {
164176
import std.datetime.systime;
165177
import std.datetime.timezone;
166178
import core.time;
167-
auto time = Clock.currTime();
179+
version (Windows) {
180+
import std.datetime.timezone;
181+
auto time = Clock.currTime(UTC());
182+
} else {
183+
auto time = Clock.currTime();
184+
}
168185

169186
auto otp = adi.requestOTP(dsId);
170187

cmake/dependencies.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
include(UseDub)
55

6+
DubProject_Add(requests ~2.0.9)
67
DubProject_Add(slf4d ~2.1.1)
78

89
if(build_anisetteserver)

dub.sdl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ targetPath "bin"
99
sourcePaths "lib"
1010
importPaths "lib"
1111

12-
dependency "slf4d" version="~>2.1.1"
12+
dependency "requests" version="~>2"
13+
dependency "slf4d" version="~>2"
1314

1415
configuration "plist-d" {
1516
dependency "plist" version="~master"
@@ -30,6 +31,7 @@ subPackage {
3031
sourcePaths "retrieve_headers"
3132

3233
dependency "provision" version="*"
34+
// 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"
3335
}
3436

3537
subPackage {
@@ -62,7 +64,7 @@ subPackage {
6264

6365
configuration "static" {
6466
targetType "executable"
65-
lflags "-lz" platform="ldc"
67+
lflags "-lz" platform="linux-ldc"
6668
dflags "--link-defaultlib-shared=false" platform="ldc"
6769
dflags "-defaultlib=:libgphobos.a" platform="gdc"
6870
}

dub.selections.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
{
22
"fileVersion": 1,
33
"versions": {
4+
"automem": "0.6.9",
5+
"cachetools": "0.4.1",
46
"dxml": "0.4.3",
57
"handy-httpd": "5.2.1",
68
"httparsed": "1.2.1",
79
"plist": "~master",
8-
"slf4d": "2.1.1"
10+
"plist-d": {"version":"d494cf3fe79a2bb20583173c0c8cf85ef33b719e","repository":"git+https://github.com/Dadoum/libplist-d.git"},
11+
"requests": "2.0.9",
12+
"slf4d": "2.1.1",
13+
"test_allocator": "0.3.4",
14+
"unit-threaded": "0.10.8"
915
}
1016
}

0 commit comments

Comments
 (0)