This repository has been archived by the owner on Mar 1, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
makedeb.d
46 lines (43 loc) · 1.52 KB
/
makedeb.d
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
import std.stdio : writeln;
import std.file;
import std.path;
import std.conv;
import std.process;
static import std.stdio;
import workspaced.info;
void main()
{
if (!exists("debs"))
mkdir("debs");
auto pkgVersion = Version[0].to!string ~ "." ~ Version[1].to!string ~ "-" ~ Version[2].to!string;
string pkgPath = "workspace-d_" ~ pkgVersion;
if (exists("debs/" ~ pkgPath))
{
writeln("Package already exists, returning");
return;
}
mkdir("debs/" ~ pkgPath);
mkdir("debs/" ~ pkgPath ~ "/DEBIAN");
write("debs/" ~ pkgPath ~ "/DEBIAN/control", `Package: workspace-d
Version: ` ~ pkgVersion ~ `
Section: base
Priority: optional
Architecture: amd64
Maintainer: WebFreak001 <[email protected]>
Description: Wraps dcd, dfmt and dscanner to one unified environment managed by dub
`);
mkdir("debs/" ~ pkgPath ~ "/usr");
mkdir("debs/" ~ pkgPath ~ "/usr/local");
mkdir("debs/" ~ pkgPath ~ "/usr/local/bin");
writeln("Building workspace-d");
spawnProcess(["dub", "build", "--compiler=ldc", "--build=release"]).wait;
writeln("Compressing regular linux package");
spawnProcess(["tar", "cfJ",
"workspace-d_" ~ Version[0].to!string ~ "." ~ Version[1].to!string ~ "."
~ Version[2].to!string ~ "-linux-x86_64.tar.xz", "workspace-d"]).wait;
rename("workspace-d", "debs/" ~ pkgPath ~ "/usr/local/bin/workspace-d");
writeln("Generating package in debs/ folder");
spawnProcess(["dpkg-deb", "--build", pkgPath], std.stdio.stdin,
std.stdio.stdout, std.stdio.stderr, null, Config.none, buildPath(getcwd, "debs")).wait;
writeln("Done");
}