me

/

vinix-ports Public
382 commits 0 issues 0 pull requests 1 contributor Discussions Projects Snippets LOC history Platform CI

Build xclock and the release Vinix X11 input and Wine bridges

diviocity committed 5 days ago · ddf75fa86ad3ef79ba9a00acbc009a7c7002ae4f View patch
Unverified signature 3 files changed +155 -0
vinix-x11/PKGBUILD.vile new file +52 -0

@@ -0,0 +1,52 @@

1+defpkgbuild(vinix-x11,

2+ #:pkgname, "vinix-x11",

3+ #:pkgver, "0.1.0",

4+ #:pkgrel, 1,

5+ #:pkgdesc, "Vinix X11 input bridge, embedded Wine display host and release configuration",

6+ #:arch, [#:x86-64, #:aarch64],

7+ #:url, "https://github.com/vlang/vinix",

8+ #:license, "GPL-2.0-or-later",

9+ #:depends, ["libxtst", "libxdamage", "libx11", "libxext", "libxcb"],

10+ #:backup, ["etc/X11/xorg.conf", "root/.xinitrc"],

11+ #:source, [

12+ "xinputcore-core.v::https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/xinputcore/core.v",

13+ "xinputcore-native.v::https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/xinputcore/native.v",

14+ "winehost-core.v::https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/winehost/core.v",

15+ "winehost-native.v::https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/winehost/native.v",

16+ "winehost-package.v::https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/winehost/package.v",

17+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/wine-host-v-abi.h",

18+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/build-support/xorg-server/xinput_abi.h",

19+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/tools/packages/x11auth/auth.v",

20+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/scripts/build-x11-aarch64.sh",

21+ "https://raw.githubusercontent.com/vlang/vinix/c34a6707e1d8d3a23d0b1bfe6e6dbb16290e4f75/LICENSE",

22+ "build.v"

23+ ],

24+ #:sha256sums, [

25+ "17d005da80876e46069f16f7cfe5c58ccc3372bfcb58308c10a0151fab938d93",

26+ "6d72de3d40e223dfd84bc5ac90a73f9f2684a62927b4188085cb8ec2df6bec68",

27+ "377b3af2a806f7778915bf1791207653f3d41c8287720c5a845decd3302f654a",

28+ "24c67490255562ec1f0860792fc18856bd4dfe00161d6478e41644e258acf90b",

29+ "7ce47e4cacad1fc1acbcd7a91dc2bd25b5fd127407307785f5996a923bdcccb3",

30+ "4853d2daf1350ec92ba7a1fad5c24da33e3d7308df116e92d953cb1692a5d83a",

31+ "5cbe518509c7fccf8f59aeb146230ac2bd855339f4f4e174fe0f3c3c8a6fb772",

32+ "e1f0b2bdfb76c56ae6bf8cd26a1b766c4eed0a3727f9848f3e55922dc7e33ec1",

33+ "80da3c1abb11c45b0d5f60ea1fe2a4ffd511a72acea384c597463e71c22e1504",

34+ "8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643",

35+ "f39277ec431622df3791721f365abfb76ac648f6e7a2d04295f1d0115b5d13a2"

36+ ],

37+ #:build, fn() {

38+ run("v", "run", "build.v")

39+ },

40+ #:check, fn() {

41+ run("readelf", "-d", "vinix-xinput")

42+ run("readelf", "-d", "vinix-wine-host")

43+ run("grep", "-Fq", "/dev/fb0", "xorg.conf")

44+ run("grep", "-Fq", "exec xclock", "xinitrc")

45+ },

46+ #:package, fn() {

47+ run("install", "-Dm755", "vinix-xinput", string-append(pkgdir(), "/usr/bin/vinix-xinput"))

48+ run("install", "-Dm755", "vinix-wine-host", string-append(pkgdir(), "/usr/bin/vinix-wine-host"))

49+ run("install", "-Dm644", "xorg.conf", string-append(pkgdir(), "/etc/X11/xorg.conf"))

50+ run("install", "-Dm755", "xinitrc", string-append(pkgdir(), "/root/.xinitrc"))

51+ run("install", "-Dm644", "LICENSE", string-append(pkgdir(), "/usr/share/licenses/vinix-x11/LICENSE"))

52+ })

vinix-x11/build.v new file +78 -0

@@ -0,0 +1,78 @@

1+// Build the two release X11 bridges from the pinned Vinix modules.

2+module main

3+

4+import os

5+

6+fn run(command string, args []string) ! {

7+ path := os.find_abs_path_of_executable(command)!

8+ mut child := os.new_process(path)

9+ child.set_args(args)

10+ child.run()

11+ child.wait()

12+ defer { child.close() }

13+ if child.code != 0 {

14+ return error('${command} failed with exit status ${child.code}')

15+ }

16+}

17+

18+fn compile_bridge(name string, binary string, arch string, root string) ! {

19+ os.mkdir_all('${name}-build/${name}')!

20+ os.write_file('${name}-build/v.mod', "Module { name: 'x11_bridge' }\n")!

21+ os.write_file('${name}-build/entry.v', 'module main\nimport ${name} as _\n')!

22+ for file in ['core', 'native'] {

23+ os.cp('${name}-${file}.v', '${name}-build/${name}/${file}.v')!

24+ }

25+ mut flags := ['-shared', '-no-builtin', '-no-closures', '-os', 'vinix', '-arch', arch,

26+ '-target-libc-headers', '-gc', 'none', '-manualfree']

27+ mut libs := ['-lXtst', '-lX11', '-lXext', '-lxcb']

28+ if name == 'winehost' {

29+ os.cp('winehost-package.v', 'winehost-build/winehost/package.v')!

30+ os.mkdir_all('winehost-build/x11auth')!

31+ os.cp('auth.v', 'winehost-build/x11auth/auth.v')!

32+ flags << ['-d', 'x11_host_libc']

33+ libs << '-lXdamage'

34+ }

35+ flags << ['-o', '${binary}.c', '${name}-build']

36+ run('v', flags)!

37+ mut cc := ['-std=gnu11', '-O2', '-D__vinix__', '-DVINIX_XINPUT_V_RUNTIME=1', '-I.',

38+ '-ffreestanding', '-fno-builtin', '-fwrapv', '-fno-strict-aliasing', '-static-libgcc',

39+ '-Wl,-rpath-link,${root}/usr/lib', '-Wl,-rpath-link,${root}/lib', '${binary}.c']

40+ cc << libs

41+ cc << ['-o', binary]

42+ run('vinix-cc', cc)!

43+}

44+

45+fn release_config(script string, marker string, name string) ! {

46+ start := "<< '${marker}'\n"

47+ end := '\n${marker}\n'

48+ if script.count(start) != 1 {

49+ return error('expected a single ${marker} configuration in the Vinix release script')

50+ }

51+ body := script.all_after(start)

52+ if !body.contains(end) {

53+ return error('unterminated ${marker} configuration')

54+ }

55+ os.write_file(name, body.all_before(end) + '\n')!

56+}

57+

58+fn build() ! {

59+ target := os.getenv_opt('VPAC_TARGET_ARCH') or { os.uname().machine }

60+ arch := match target {

61+ 'x86_64' { 'amd64' }

62+ 'aarch64' { 'arm64' }

63+ else { return error('unsupported X11 bridge target ${target}') }

64+ }

65+ root := os.getenv('VPAC_MAKEPKG_ROOT')

66+ compile_bridge('xinputcore', 'vinix-xinput', arch, root)!

67+ compile_bridge('winehost', 'vinix-wine-host', arch, root)!

68+ script := os.read_file('build-x11-aarch64.sh')!

69+ release_config(script, 'XORGEOF', 'xorg.conf')!

70+ release_config(script, 'XINITEOF', 'xinitrc')!

71+}

72+

73+fn main() {

74+ build() or {

75+ eprintln(err)

76+ exit(1)

77+ }

78+}

xclock/PKGBUILD.vile new file +25 -0

@@ -0,0 +1,25 @@

1+defpkgbuild(xclock,

2+ #:pkgname, "xclock",

3+ #:pkgver, "1.1.1",

4+ #:pkgrel, 1,

5+ #:pkgdesc, "Clock for the X Window System",

6+ #:arch, [#:x86-64, #:aarch64],

7+ #:license, "MIT",

8+ #:url, "https://www.x.org/",

9+ #:depends, ["libxaw", "libxmu", "libxft", "libxrender", "libxkbfile", "libxt", "libx11"],

10+ #:makedepends, ["xorgproto"],

11+ #:source, ["https://xorg.freedesktop.org/archive/individual/app/xclock-1.1.1.tar.xz"],

12+ #:sha256sums, ["df7ceabf8f07044a2fde4924d794554996811640a45de40cb12c2cf1f90f742c"],

13+

14+ #:build, fn() {

15+ run("vinix-configure", "xclock-1.1.1/configure", "--with-xft", "--with-xkb", "--with-appdefaultdir=/usr/share/X11/app-defaults")

16+ run("make")

17+ },

18+ #:check, fn() {

19+ run("readelf", "-l", "xclock")

20+ },

21+ #:package, fn() {

22+ run("make", "install", string-append("DESTDIR=", pkgdir()))

23+ run("install", "-Dm644", "xclock-1.1.1/COPYING",

24+ string-append(pkgdir(), "/usr/share/licenses/xclock/COPYING"))

25+ })