Skip to content
Snippets Groups Projects
PKGBUILD 8.9 KiB
Newer Older
Gus Fun's avatar
Gus Fun committed
# Maintainer    : Eric Vidal <eric@obarun.org>
# Maintainer    : Jean-Michel T.Dydak <jean-michel@obarun.org>
# Maintainer    : YianIris <yianiris At disroot Dot org>
Eric Vidal's avatar
Eric Vidal committed
# Obarun PkgSrc : https://git.obarun.org/obarun-pkgbuild-extra/xorg-server
Gus Fun's avatar
Gus Fun committed
#----------------
# Website       : http://xorg.freedesktop.org
#------------------------------------------------------------------------
# DESCRIPTION ]

pkgbase=xorg-server
pkgver=1.20.13
pkgrel=2

pkgname=(
    'xorg-server'
    'xorg-server-xephyr'
    'xorg-server-xvfb'
    'xorg-server-xnest'
    'xorg-server-common'
    'xorg-server-devel')

url="https://xorg.freedesktop.org/releases/individual/xserver"

track=
target="$pkgbase-$pkgver.tar.xz"
source=("$url/$target"{,.sig}
    'xserver-autobind-hotplug.patch'
    '0001-v2-FS-58644.patch'
    '0002-fix-libshadow-2.patch'
    'xvfb-run' ## with updates from FC master
    'xvfb-run.1'
    'Xwrapper.config')

#------------------------
# INSTALL CONFIGURATION ]

arch=(x86_64)

groups=(
    'xorg')

backup=(
    'etc/X11/Xwrapper.config')

#----------------------
# BUILD CONFIGURATION ]

makedepends=(
    'xorgproto'
    'pixman'
    'libx11'
    'mesa'
    'mesa-libgl'
    'xtrans'
    'libxkbfile'
    'libxfont2'
    'libpciaccess'
    'libxv'
    'libxmu'
    'libxrender'
    'libxi'
    'libxaw'
    'libxtst'
    'libxres'
    'xorg-xkbcomp'
    'xorg-util-macros'
    'xorg-font-util'
    'libepoxy'
    'xcb-util'
    'xcb-util-image'
    'xcb-util-renderutil'
    'xcb-util-wm'
    'xcb-util-keysyms'
    'libxshmfence'
    'libunwind'
    'meson'
    'git'
    'wayland-protocols'
    'egl-wayland')

#--------------------
# BUILD PREPARATION ]

prepare() {
    cd "$pkgbase-$pkgver"
    #cd xserver
    ## patch from Fedora, not yet merged
    patch -Np1 -i ../xserver-autobind-hotplug.patch

    ## https://bugs.freedesktop.org/show_bug.cgi?id=106588
    patch -Np1 -i ../0001-v2-FS-58644.patch

    ## Fix libshadow.so: libfb.so => not found - FS#58731
    patch -Np1 -i ../0002-fix-libshadow-2.patch

}

#----------------
# BUILD CONTROL ]

_path=(
    -Dxkb_dir=/usr/share/X11/xkb
    -Dxkb_output_dir=/var/lib/xkb
)

_flags=(
    -Dos_vendor="Obarun"
    -Dxvfb=true
    -Dxnest=true
    -Dxcsecurity=true
    -Dxorg=true
    -Dxephyr=true
    -Dxwayland=true
    -Dxwayland_eglstream=true
    -Dglamor=true
    -Dudev=true
    -Dsuid_wrapper=true
    -Dipv6=true
    -Dsystemd_logind=false
)

#--------
# BUILD ]

build() {

    ## Since pacman 5.0.2-2, hardened flags are now enabled in makepkg.conf
    ## With them, module fail to load with undefined symbol.
    ## https://bugs.archlinux.org/task/55102
    ## https://bugs.archlinux.org/task/54845
    export CFLAGS=${CFLAGS/-fno-plt}
    export CXXFLAGS=${CXXFLAGS/-fno-plt}
    export LDFLAGS=${LDFLAGS/,-z,now}

   # arch-meson  build
    arch-meson $pkgbase-$pkgver build "${_path[@]}" "${_flags[@]}"

    ## Print config
    meson configure build
    meson compile -C build

    ## fake installation to be seperated into packages
    meson install -C build --destdir "${srcdir}/fakeinstall"
}

#----------
# PACKAGE ]

_install() {
    local src f dir
    for src; do
     f="${src#fakeinstall/}"
     dir="${pkgdir}/${f%/*}"
     install -m755 -d "${dir}"
     mv -v "${src}" "${dir}/"
    done
}

package_xorg-server-common() {
    pkgdesc="Xorg server common files"
    depends=(
        'xkeyboard-config'
        'xorg-xkbcomp'
        'xorg-setxkbmap')

    _install fakeinstall/usr/lib/xorg/protocol.txt
    _install fakeinstall/usr/share/man/man1/Xserver.1

    install -m644 -Dt "${pkgdir}/var/lib/xkb/" "$pkgbase-$pkgver"/xkb/README.compiled
    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING
}

package_xorg-server() {
    pkgdesc="Xorg X server"
    depends=(
        'libepoxy'
        'libxfont2'
        'pixman'
        'xorg-server-common'
        'libunwind'
        'dbus'
        'libgl'
        'xf86-input-libinput'
        'nettle'
        'libpciaccess'
        'libdrm'
        'libxshmfence') ## FS#52949

    ## see xorg-server-*/hw/xfree86/common/xf86Module.h for ABI versions.
    ## we provide major numbers that drivers can depend on
    ## and /usr/lib/pkgconfig/xorg-server.pc in xorg-server-devel pkg
    provides=(
        'X-ABI-VIDEODRV_VERSION=24.0'
        'X-ABI-XINPUT_VERSION=24.1'
        'X-ABI-EXTENSION_VERSION=10.0'
        'x-server')
    conflicts=(
        'nvidia-utils<=331.20'
        'glamor-egl'
        'xf86-video-modesetting')
    replaces=(
        'glamor-egl'
        'xf86-video-modesetting')

    install=xorg-server.install

    _install fakeinstall/usr/bin/{Xorg,cvt,gtf}
    ln -s /usr/bin/Xorg "${pkgdir}/usr/bin/X"
    _install fakeinstall/usr/lib/Xorg{,.wrap}
    _install fakeinstall/usr/lib/xorg/modules/*
    _install fakeinstall/usr/share/X11/xorg.conf.d/10-quirks.conf
    _install fakeinstall/usr/share/man/man1/{Xorg,Xorg.wrap,cvt,gtf}.1
    _install fakeinstall/usr/share/man/man4/{exa,fbdevhw,modesetting}.4
    _install fakeinstall/usr/share/man/man5/{Xwrapper.config,xorg.conf,xorg.conf.d}.5

    ## distro specific files must be installed in /usr/share/X11/xorg.conf.d
    install -m755 -d "${pkgdir}/etc/X11/xorg.conf.d"

    ## Xwrapper.config
    install -Dm0644 Xwrapper.config "${pkgdir}"/etc/X11/Xwrapper.config

    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING
}

package_xorg-server-xephyr() {
    pkgdesc="A nested X server that runs as an X application"
    depends=(
        'libxfont2'
        'libgl'
        'libepoxy'
        'libunwind'
        'libxv'
        'pixman'
        'xorg-server-common'
        'xcb-util-image'
        'xcb-util-renderutil'
        'xcb-util-wm'
        'xcb-util-keysyms'
        'nettle'
        'libtirpc')

    _install fakeinstall/usr/bin/Xephyr
    _install fakeinstall/usr/share/man/man1/Xephyr.1

    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING
}

package_xorg-server-xvfb() {
    pkgdesc="Virtual framebuffer X server"
    depends=(
        'libxfont2'
        'libunwind'
        'pixman'
        'xorg-server-common'
        'xorg-xauth'
        'libgl'
        'nettle'
        'libtirpc')

    _install fakeinstall/usr/bin/Xvfb
    _install fakeinstall/usr/share/man/man1/Xvfb.1

    install -m755 "${srcdir}/xvfb-run" "${pkgdir}/usr/bin/"
    install -m644 "${srcdir}/xvfb-run.1" "${pkgdir}/usr/share/man/man1/" # outda

    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING
}

package_xorg-server-xnest() {
    pkgdesc="A nested X server that runs as an X application"
    depends=(
        'libxfont2'
        'libxext'
        'pixman'
        'xorg-server-common'
        'nettle'
        'libtirpc')

    _install fakeinstall/usr/bin/Xnest
    _install fakeinstall/usr/share/man/man1/Xnest.1

    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING
}

package_xorg-server-devel() {
    pkgdesc="Development files for the X.Org X server"
    depends=(
        'xorgproto'
        'mesa'
        'libpciaccess'
        'xorg-util-macros') ## not technically required but almost every Xorg pkg needs it to build

    _install fakeinstall/usr/include/xorg/*
    _install fakeinstall/usr/lib/pkgconfig/xorg-server.pc
    _install fakeinstall/usr/share/aclocal/xorg-server.m4

    ## license
    install -m644 -Dt "${pkgdir}/usr/share/licenses/${pkgname}" "$pkgbase-$pkgver"/COPYING

    ## make sure there are no files left to install
    rm fakeinstall/usr/bin/Xwayland
    find fakeinstall -depth -print0 | xargs -0 rmdir
}

#---------------------------
# LICENSE AND VERIFICATION ]

license=('CUSTOM')

validpgpkeys=('7B27A3F1A6E18CD9588B4AE8310180050905E40C'
              'C383B778255613DFDB409D91DB221A6900000011'
              'DD38563A8A8224537D1F90E45B8A2D50A0ECD0D3'
              '995ED5C8A6138EB0961F18474C09DD83CAAA50B2'
              '3BB639E56F861FA2E86505690FDD682D974CA72A')

sha512sums=('4e0b7bd4e070dc52cb2c51c2056feb133de2c0487d359392ed63abba9702910cd2e2983e9415973d8d6e9672eac78be6f39202687fc56610877914ce722554b3'
            'SKIP'
            '876e17d65f35714c75eced72ac67609f7fd83c7c6d3a842c011d3b3adbcda75447721024f49ce164cefbbe698d00b291af6f21d6f081879986cca7e447784f86'
            'f05c18354a3cf5b5b0fa97c4a887cfd688297e39d7ddc93b5900357119a689a060321019aeec9ca9c1366ea4b65b7875b2a9cadb84e46d2c193c15e6df22fcd8'
            'f9b22b91acdebedc0e485ba99bfeab107bced5706693d16ba66aa4a6ea1f6b39d835b5dba6eda38da02bc2dca16150ccceae42e18e6563eff3fac4e4195aa328'
            'c1da07f0040f52ffcfec4c9b96d80c07738db6451c149c36a5636f28307dfcffa46c2f2490a52691c6fbffa7cc45565b552da87d6ef487b5198f00f4482257be'
            'de5e2cb3c6825e6cf1f07ca0d52423e17f34d70ec7935e9dd24be5fb9883bf1e03b50ff584931bd3b41095c510ab2aa44d2573fd5feaebdcb59363b65607ff22'
            '97315b682bef7892d3cf641ea9add6e0d22901150763930020302cc73de5fe5bda0f47384b7d405c7169cb5f072d27da306066063d5a8ea116e97ea474caffe8')