forked from semios/semios-packages
Compare commits
1
Commits
zipsupport
..
mesa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c017fdef60 |
+10
-42
@@ -4,7 +4,6 @@ import sys
|
||||
import tarfile
|
||||
import urllib.parse
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
|
||||
def filename(url):
|
||||
@@ -129,25 +128,6 @@ def tar_common_root(tar: tarfile.TarFile) -> str | None:
|
||||
return root
|
||||
|
||||
|
||||
def zip_common_root(zip_file: zipfile.ZipFile) -> str | None:
|
||||
members = zip_file.infolist()
|
||||
if not members:
|
||||
return None
|
||||
root = None
|
||||
for member in members:
|
||||
path = member.filename.replace('\\', '/').lstrip('./').lstrip('/')
|
||||
if not path:
|
||||
continue
|
||||
this_root = path.split('/')[0]
|
||||
if this_root in ('', '.', '..'):
|
||||
continue
|
||||
if root is None:
|
||||
root = this_root
|
||||
elif this_root != root:
|
||||
return None
|
||||
return root
|
||||
|
||||
|
||||
def sources_dir_name() -> str:
|
||||
with open("./target/sources.tag") as file:
|
||||
return file.read()
|
||||
@@ -159,28 +139,16 @@ def source_url(url: str):
|
||||
download_path = f"./target/{filename(url)}"
|
||||
download(url, download_path)
|
||||
|
||||
if download_path.endswith(".zip"):
|
||||
with zipfile.ZipFile(download_path, "r") as zip:
|
||||
common_root = zip_common_root(zip)
|
||||
else:
|
||||
with tarfile.open(download_path, "r") as tar:
|
||||
common_root = tar_common_root(tar)
|
||||
|
||||
extract_dir = "./target"
|
||||
sources_dir = f"./target/{common_root}"
|
||||
if common_root in ["", ".", None]:
|
||||
extract_dir = "./target/sources"
|
||||
sources_dir = "./target/sources"
|
||||
|
||||
if download_path.endswith(".zip"):
|
||||
with zipfile.ZipFile(download_path, "r") as zip:
|
||||
zip.extractall(extract_dir)
|
||||
else:
|
||||
with tarfile.open(download_path, "r") as tar:
|
||||
tar.extractall(extract_dir)
|
||||
|
||||
with open("./target/sources.tag", "wt+") as file:
|
||||
file.write(sources_dir)
|
||||
with tarfile.open(download_path, "r") as tar:
|
||||
common_root = tar_common_root(tar)
|
||||
extract_dir = "./target"
|
||||
sources_dir = f"./target/{common_root}"
|
||||
if common_root in ["", ".", "None"]:
|
||||
extract_dir = "./target/sources"
|
||||
sources_dir = "./target/sources"
|
||||
tar.extractall(extract_dir)
|
||||
with open("./target/sources.tag", "wt+") as file:
|
||||
file.write(sources_dir)
|
||||
|
||||
|
||||
def _git_repo_name(url: str) -> str:
|
||||
|
||||
@@ -0,0 +1,258 @@
|
||||
import glob
|
||||
import os
|
||||
|
||||
from lib.make import *
|
||||
from lib import cpp, arch
|
||||
|
||||
|
||||
version("26.2.0")
|
||||
description("Open source implementations of OpenGL, OpenGL ES, Vulkan, OpenCL, and more")
|
||||
maintainer("sisungo <[email protected]>")
|
||||
source_url("https://archive.mesa3d.org/mesa-26.2.0.tar.xz")
|
||||
|
||||
builddep("shortcut/meson")
|
||||
builddep("shortcut/c++")
|
||||
builddep(f"libwayland-dev @{arch.get_target()}")
|
||||
builddep(f"libffi-dev @{arch.get_target()}")
|
||||
builddep(f"libexpat-dev @{arch.get_target()}")
|
||||
builddep(f"pkgconf @{arch.get_target()}")
|
||||
builddep(f"libllvm-dev @{arch.get_target()}")
|
||||
builddep(f"libclang-dev @{arch.get_target()}")
|
||||
builddep(f"libunwind-dev @{arch.get_target()}")
|
||||
builddep(f"libz-ng-dev @{arch.get_target()}")
|
||||
builddep(f"libzstd-dev @{arch.get_target()}")
|
||||
builddep(f"libgldispatch-dev @{arch.get_target()}")
|
||||
builddep(f"libegl-dev @{arch.get_target()}")
|
||||
builddep(f"libopengl-dev @{arch.get_target()}")
|
||||
builddep(f"libglesv2-dev @{arch.get_target()}")
|
||||
builddep(f"libva-dev @{arch.get_target()}")
|
||||
builddep(f"libdrm-dev @{arch.get_target()}")
|
||||
builddep(f"libllvmspirv-dev @{arch.get_target()}")
|
||||
builddep(f"spirv-tools-dev @{arch.get_target()}")
|
||||
builddep(f"libpng-dev @{arch.get_target()}")
|
||||
builddep(f"libarchive-dev @{arch.get_target()}")
|
||||
builddep(f"aws-lc-dev @{arch.get_target()}")
|
||||
builddep(f"libxml2-dev @{arch.get_target()}")
|
||||
builddep(f"linux-dev @{arch.get_target()}")
|
||||
builddep("bison")
|
||||
builddep("flex")
|
||||
builddep("PyYAML.py")
|
||||
builddep("Mako.py")
|
||||
builddep("packaging.py")
|
||||
builddep("pycparser.py")
|
||||
builddep("glslang")
|
||||
|
||||
archspec = {
|
||||
"aarch64-semios-linux": {
|
||||
"vulkan_drivers": [
|
||||
"mesa-vulkan-asahi",
|
||||
"mesa-vulkan-freedreno",
|
||||
"mesa-vulkan-intel",
|
||||
"mesa-vulkan-lvp",
|
||||
"mesa-vulkan-panfrost",
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def build():
|
||||
cpp.meson_setup([
|
||||
# Generic directories
|
||||
f"--libdir=/lib/{arch.get_target()}",
|
||||
f"--includedir=/lib/{arch.get_target()}/include",
|
||||
f"--datadir=/share",
|
||||
|
||||
# Platform selection
|
||||
"-Dplatforms=wayland",
|
||||
|
||||
# User Features
|
||||
"-Dshader-cache=enabled",
|
||||
"-Dxmlconfig=enabled",
|
||||
|
||||
# Gallium
|
||||
"-Dgallium-drivers=auto",
|
||||
"-Dgallium-va=enabled",
|
||||
f"-Dva-libs-path=/lib/{arch.get_target()}/dri",
|
||||
|
||||
# Vulkan
|
||||
"-Dvulkan-drivers=auto",
|
||||
"-Dvulkan-layers=device-select,overlay,screenshot,anti-lag,vram-report-limit",
|
||||
f"-Dvulkan-icd-dir=/lib/{arch.get_target()}/vulkan/icd.d",
|
||||
"-Dvulkan-manifest-per-architecture=false",
|
||||
f"-Dvulkan-loader-rpath=/lib/{arch.get_target()}",
|
||||
|
||||
# GLES
|
||||
"-Dgles1=disabled",
|
||||
"-Dgles2=enabled",
|
||||
|
||||
# GBM
|
||||
"-Dgbm=enabled",
|
||||
f"-Dgbm-backends-path=/lib/{arch.get_target()}/gbm",
|
||||
f"-Ddri-drivers-path=/lib/{arch.get_target()}/dri",
|
||||
|
||||
# EGL
|
||||
"-Degl=enabled",
|
||||
"-Degl-native-platform=surfaceless",
|
||||
|
||||
# GLVND
|
||||
"-Dglvnd=enabled",
|
||||
|
||||
# Hardware Video Decoding
|
||||
"-Dvideo-codecs=all_free",
|
||||
|
||||
# Intel
|
||||
"-Dintel-rt=enabled",
|
||||
|
||||
# LLVM Configuration
|
||||
"-Dllvm=enabled",
|
||||
"-Dshared-llvm=enabled",
|
||||
"-Dllvm-orcjit=true",
|
||||
|
||||
# Libraries to use
|
||||
"-Dexpat=enabled",
|
||||
"-Dzstd=enabled",
|
||||
"-Dzlib=enabled",
|
||||
|
||||
# X11-related stuff
|
||||
# We don't have X11 yet, so leave them disabled.
|
||||
"-Dxlib-lease=disabled",
|
||||
"-Dglx=disabled",
|
||||
])
|
||||
cpp.meson_compile()
|
||||
cpp.meson_install(move=False)
|
||||
|
||||
on_build(build)
|
||||
|
||||
|
||||
libdir = f"lib/{arch.get_target()}"
|
||||
includedir = f"{libdir}/include"
|
||||
|
||||
def composer_add(composer, src, dst):
|
||||
if os.path.isdir(src):
|
||||
composer.add_dir(src, dst)
|
||||
else:
|
||||
composer.addfile(src, dst)
|
||||
|
||||
def pack_lib_simple(composer, name):
|
||||
composer.makedir("lib")
|
||||
for i in os.listdir(libdir):
|
||||
if name in i:
|
||||
composer_add(composer, f"{libdir}/{i}", f"lib/{i}")
|
||||
|
||||
def pack_dev_simple(composer, name):
|
||||
composer.makedirs("lib/pkgconfig")
|
||||
composer.makedir("include")
|
||||
for i in os.listdir(f"{libdir}/pkgconfig"):
|
||||
if name in i:
|
||||
composer.addfile(f"{libdir}/pkgconfig/{i}", f"lib/pkgconfig/{i}")
|
||||
for i in os.listdir(includedir):
|
||||
if name in i:
|
||||
composer_add(composer, f"{includedir}/{i}", f"include/{i}")
|
||||
|
||||
def pack_dri_dev(composer):
|
||||
composer.makedir("include")
|
||||
composer.add_dir(f"{includedir}/GL", "include/GL")
|
||||
composer.makedirs("lib/pkgconfig")
|
||||
composer.addfile(f"{libdir}/pkgconfig/dri.pc", "lib/pkgconfig/dri.pc")
|
||||
|
||||
def pack_libgallium(composer):
|
||||
pack_lib_simple(composer, "gallium")
|
||||
composer.add_dir(f"{libdir}/dri", "lib/dri")
|
||||
composer.add_dir("share/drirc.d", "share/drirc.d")
|
||||
|
||||
def pack_libegl(composer):
|
||||
pack_lib_simple(composer, "EGL")
|
||||
composer.add_dir("share/glvnd", "share/glvnd")
|
||||
|
||||
def pack_vulkan(composer, name):
|
||||
composer.makedir("lib")
|
||||
composer.addfile(f"{libdir}/libvulkan_{name}.so", f"lib/libvulkan_{name}.so")
|
||||
composer.makedirs("lib/vulkan/icd.d")
|
||||
composer.addfile(f"{libdir}/vulkan/icd.d/{name}_icd.json", f"lib/vulkan/icd.d/{name}_icd.json")
|
||||
|
||||
def hasvulkan(name):
|
||||
return name in archspec[arch.get_target()]["vulkan_drivers"]
|
||||
|
||||
|
||||
package("libgbm")
|
||||
dep("libdrm @same-arch")
|
||||
dep("semi-libc @same-arch")
|
||||
on_pack(lambda composer: pack_lib_simple(composer, "gbm"))
|
||||
|
||||
package("libgbm-dev")
|
||||
dep("libdrm-dev @same-arch")
|
||||
dep("libgbm (same)")
|
||||
on_pack(lambda composer: pack_dev_simple(composer, "gbm"))
|
||||
|
||||
package("libgallium")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libllvm @same-arch")
|
||||
dep("libexpat @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(pack_libgallium)
|
||||
|
||||
package("mesa-dri-dev")
|
||||
on_pack(pack_dri_dev)
|
||||
|
||||
package("libegl-mesa")
|
||||
dep("libgallium (same)")
|
||||
dep("libgbm (same)")
|
||||
dep("libexpat @same-arch")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
on_pack(pack_libegl)
|
||||
|
||||
package("libegl-mesa-dev")
|
||||
dep("libgbm-dev (same)")
|
||||
dep("libexpat-dev @same-arch")
|
||||
dep("libdrm-dev @same-arch")
|
||||
dep("libwayland-dev @same-arch")
|
||||
dep("libegl-mesa (same)")
|
||||
on_pack(lambda composer: pack_dev_simple(composer, "EGL"))
|
||||
|
||||
if hasvulkan("mesa-vulkan-asahi"):
|
||||
package("mesa-vulkan-asahi")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(lambda composer: pack_vulkan(composer, "asahi"))
|
||||
|
||||
if hasvulkan("mesa-vulkan-freedreno"):
|
||||
package("mesa-vulkan-freedreno")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(lambda composer: pack_vulkan(composer, "freedreno"))
|
||||
|
||||
if hasvulkan("mesa-vulkan-intel"):
|
||||
package("mesa-vulkan-intel")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(lambda composer: pack_vulkan(composer, "intel"))
|
||||
|
||||
if hasvulkan("mesa-vulkan-lvp"):
|
||||
package("mesa-vulkan-lvp")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(lambda composer: pack_vulkan(composer, "lvp"))
|
||||
|
||||
if hasvulkan("mesa-vulkan-panfrost"):
|
||||
package("mesa-vulkan-panfrost")
|
||||
dep("libdrm @same-arch")
|
||||
dep("libwayland @same-arch")
|
||||
dep("libz @same-arch")
|
||||
dep("libzstd @same-arch")
|
||||
dep("libcxx @same-arch")
|
||||
on_pack(lambda composer: pack_vulkan(composer, "panfrost"))
|
||||
@@ -119,7 +119,6 @@ def cmd_build_package(package: str):
|
||||
"version": pkgver,
|
||||
"arch": pkgarch,
|
||||
"description": pkginfo[lib.make._key_description],
|
||||
"maintainers": pkginfo[lib.make._key_maintainers],
|
||||
"dependencies": pkginfo[lib.make._key_dependencies],
|
||||
"provides": pkginfo[lib.make._key_provides],
|
||||
"recommendations": pkginfo[lib.make._key_recommendations],
|
||||
|
||||
Reference in New Issue
Block a user