File xorg-x11-server.spec of Package xorg-x11-server.26500

#
# spec file for package xorg-x11-server
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


#Compat macro for new _fillupdir macro introduced in Nov 2017
%if ! %{defined _fillupdir}
  %define _fillupdir /var/adm/fillup-templates
%endif

%define pci_ids_dir %{_sysconfdir}/X11/xorg_pci_ids
%if 0%{?suse_version} >= 1330 || 0%{?build_xwayland}
%define have_wayland 1
%endif

%define build_suid_wrapper 0

%if 0%{!?build_suid_wrapper:1}
%ifarch s390 s390x
%define build_suid_wrapper 0
%else
%if 0%{?suse_version} >= 1330
%define build_suid_wrapper 1
%define suid_wrapper_dir %{_libexecdir}
%else
%define build_suid_wrapper 0
%endif
%endif
%endif

Name:           xorg-x11-server
Version:        1.20.3
Release:        0
Url:            http://xorg.freedesktop.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Summary:        X
# Source URL: http://xorg.freedesktop.org/archive/individual/xserver/
License:        MIT
Group:          System/X11/Servers/XF86_4
Source0:        xorg-server-%{version}.tar.bz2
Source1:        sysconfig.displaymanager.template
Source2:        README.updates
Source3:        xorgcfg.tar.bz2
Source4:        xorg-backtrace
Source5:        50-extensions.conf
Source6:        modesetting.ids
Source7:        xkb-tmpfiles.conf
# RPM Macros to be installed. The ABI Versions will be injected by configure.
Source90:       xorg-x11-server.macros.in
# Source91 and Source99 are used to ensure proper ABI provides.
Source91:       xorg-server-provides
Source92:       pre_checkin.sh

BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(bigreqsproto) >= 1.1.0
BuildRequires:  pkgconfig(compositeproto)
BuildRequires:  pkgconfig(damageproto) >= 1.1
BuildRequires:  pkgconfig(dbus-1) >= 1.0
BuildRequires:  pkgconfig(dmx) >= 1.0.99.1
BuildRequires:  pkgconfig(dri) >= 7.8.0
BuildRequires:  pkgconfig(dri2proto)
BuildRequires:  pkgconfig(dri3proto)
BuildRequires:  pkgconfig(egl)
BuildRequires:  pkgconfig(epoxy) >= 1.1
%if 0%{?have_wayland} == 1
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(wayland-protocols)
%endif
BuildRequires:  pkgconfig(fixesproto) >= 4.1
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(fontenc)
BuildRequires:  pkgconfig(fontsproto)
BuildRequires:  pkgconfig(fontutil)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(gbm)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(glproto)
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(inputproto) >= 1.9.99.902
BuildRequires:  pkgconfig(kbproto) >= 1.0.3
BuildRequires:  pkgconfig(libdrm)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(pciaccess) >= 0.8.0
BuildRequires:  pkgconfig(pixman-1) >= 0.24
BuildRequires:  pkgconfig(presentproto)
BuildRequires:  pkgconfig(randrproto) >= 1.5.0
BuildRequires:  pkgconfig(renderproto) >= 0.11
BuildRequires:  pkgconfig(resourceproto)
BuildRequires:  pkgconfig(scrnsaverproto)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xaw7)
BuildRequires:  pkgconfig(xcb-aux)
BuildRequires:  pkgconfig(xcb-icccm)
BuildRequires:  pkgconfig(xcb-image)
BuildRequires:  pkgconfig(xcb-keysyms)
BuildRequires:  pkgconfig(xcb-renderutil)
BuildRequires:  pkgconfig(xcmiscproto) >= 1.2.0
BuildRequires:  pkgconfig(xdmcp)
BuildRequires:  pkgconfig(xext) >= 1.0.99.4
BuildRequires:  pkgconfig(xextproto) >= 7.1.99
BuildRequires:  pkgconfig(xf86dgaproto)
BuildRequires:  pkgconfig(xf86driproto)
BuildRequires:  pkgconfig(xf86vidmodeproto)
BuildRequires:  pkgconfig(xfixes)
BuildRequires:  pkgconfig(xfont2)
BuildRequires:  pkgconfig(xi) >= 1.2.99.1
BuildRequires:  pkgconfig(xineramaproto)
BuildRequires:  pkgconfig(xkbcomp)
BuildRequires:  pkgconfig(xkbfile)
BuildRequires:  pkgconfig(xmu)
BuildRequires:  pkgconfig(xorg-macros)
BuildRequires:  pkgconfig(xp)
BuildRequires:  pkgconfig(xpm)
BuildRequires:  pkgconfig(xprintutil)
BuildRequires:  pkgconfig(xproto) >= 7.0.31
BuildRequires:  pkgconfig(xrender)
BuildRequires:  pkgconfig(xres)
BuildRequires:  pkgconfig(xshmfence)
BuildRequires:  pkgconfig(xt)
BuildRequires:  pkgconfig(xtrans) >= 1.3.1
BuildRequires:  pkgconfig(xtst) >= 1.0.99.2
BuildRequires:  pkgconfig(xv)
### udev support (broken on openSUSE 11.2, see also bnc #589997)
%if 0%{?suse_version} >= 1130
BuildRequires:  pkgconfig(libudev) >= 143
%endif

%ifnarch s390 s390x
Requires(pre):  %fillup_prereq
%endif
Requires:       pkgconfig
Requires:       xkbcomp
Recommends:     xorg-x11-fonts-core
%ifnarch s390 s390x
Requires:       libpixman-1-0 >= 0.24
%(cat %{SOURCE91})
%endif
Requires:       Mesa
%if 0%{?suse_version} >= 1315
Requires(post):   update-alternatives
Requires(postun): update-alternatives
%endif
Provides:       xorg-x11-Xvfb
Provides:       xorg-x11-server-glx
Obsoletes:      xorg-x11-Xvfb
Obsoletes:      xorg-x11-server-glx

Provides:       glamor = %{version}
Provides:       glamor-egl = %{version}
Obsoletes:      glamor < %{version}
Obsoletes:      glamor < 7.6_%{version}
Obsoletes:      glamor-egl < %{version}
Obsoletes:      glamor-egl < 7.6_%{version}

Provides:       xf86-video-modesetting = %{version}
Obsoletes:      xf86-video-modesetting < %{version}
Obsoletes:      xf86-video-modesetting < 7.6_%{version}

%if 0%{?suse_version} >= 1500
Provides:       xf86-video-ast
Obsoletes:      xf86-video-ast
Provides:       xf86-video-cirrus
Obsoletes:      xf86-video-cirrus
%endif

Provides:       xorg-x11-server = 7.6_%{version}
Obsoletes:      xorg-x11-server < 7.6_%{version}

 # Remove (also from depending driver(s)) when updating X11_ABI_VIDEODRV by updating the server package - NOTE: also remove from xorg-x11-server.macros.in !
Provides:       X11_ABI_HAS_DPMS_GET_CAPABILITIES

# Xvfb requires keyboard files as well (bnc#797124)
Requires:       xkeyboard-config

# PATCH-FEATURE-OPENSUSE n_xorg-x11-server-rpmmacros.patch dimstar@opensuse.org -- Provide RPM macros to require correct ABI Versions.
Patch1:         N_default-module-path.diff
Patch2:         N_zap_warning_xserver.diff
Patch3:         N_driver-autoconfig.diff
Patch4:         N_fix_fglrx_screendepth_issue.patch
Patch6:         N_fix-dpi-values.diff
Patch7:         N_Install-Avoid-failure-on-wrapper-installation.patch
Patch8:         u_xorg-wrapper-Drop-supplemental-group-IDs.patch
Patch9:         u_xorg-wrapper-build-Build-position-independent-code.patch
Patch100:       u_01-Improved-ConfineToShape.patch
Patch101:       u_02-DIX-ConfineTo-Don-t-bother-about-the-bounding-box-when-grabbing-a-shaped-window.patch
Patch102:       U_hw_do-not-include-sys-io-with-glibc.patch
Patch104:       u_xorg-server-xdmcp.patch
Patch112:       u_render-Cast-color-masks-to-unsigned-long-before-shifting-them.patch

Patch115:       N_Disable-HW-Cursor-for-cirrus-and-mgag200-kernel-modules.patch

Patch117:       xorg-x11-server-byte-order.patch

Patch160:       u_vesa-Add-VBEDPMSGetCapabilities-VBEDPMSGet.patch

Patch208:       u_Panning-Set-panning-state-in-xf86RandR12ScreenSetSize.patch
Patch209:       u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch
Patch210:       u_os-connections-Check-for-stale-FDs.patch

Patch215:       u_Use-better-fallbacks-to-generate-cookies-if-arc4rand.patch

Patch1000:      n_xserver-optimus-autoconfig-hack.patch

Patch1162:      b_cache-xkbcomp-output-for-fast-start-up.patch
Patch1211:      b_0001-Prevent-XSync-Alarms-from-senslessly-calling-CheckTr.patch
Patch1222:      b_sync-fix.patch

Patch1401:      u_randr-Do-not-crash-if-slave-screen-does-not-have-pro.patch

Patch1501:      U_xkb-Fix-heap-overflow-caused-by-optimized-away-min.patch

Patch1502:      U_dix-window-Use-ConfigureWindow-instead-of-MoveWindow.patch

Patch1503:      u_xfree86-Do-not-claim-pci-slots-if-fb-slot-is-already.patch

# required for NVIDIA's PRIME render offload support
Patch1601:      0001-xsync-Add-resource-inside-of-SyncCreate-export-SyncC.patch
Patch1602:      0002-GLX-Add-a-per-client-vendor-mapping.patch
Patch1603:      0003-GLX-Use-the-sending-client-for-looking-up-XID-s.patch
Patch1604:      0004-GLX-Add-a-function-to-change-a-clients-vendor-list.patch
Patch1605:      0005-GLX-Set-GlxServerExports-major-minor-Version.patch

Patch1174633:   U_FixForZDI-11426.patch
Patch1174635:   u_xkb-CVE-2020-14345.patch
Patch1174638:   u_xichangehierarchy-CVE-2020-14346.patch
Patch1174908:   u_xkb-CVE-2020-14360.patch

Patch1703:      U_0003-Fix-XkbSelectEvents-integer-underflow.patch
Patch1704:      U_0004-Fix-XRecordRegisterClients-Integer-underflow.patch

Patch1801:      U_present-wnmd-Fix-use-after-free-on-CRTC-removal.patch
Patch1802:      U_present-wnmd-Relax-assertion-on-CRTC-on-abort_vblank.patch
Patch1803:      U_xwayland-Avoid-a-crash-on-pointer-enter-with-a-grab.patch
Patch1804:      U_xwayland-Check-status-in-GBM-pixmap-creation.patch
Patch1805:      U_xwayland-Do-not-free-a-NULL-GBM-bo.patch
Patch1806:      U_xwayland-Update-screen-pixmap-on-output-resize.patch
Patch1807:      U_xwayland-Do-not-crash-if-gbm_bo_create-fails.patch
Patch1808:      U_xwayland-glamor-gbm-Handle-DRM_FORMAT_MOD_INVALID-gracefully.patch

Patch1900:      U_xkbsetdeviceinfo.patch

Patch2000:      U_modesetting-Fix-broken-manpage-in-autoconf-build.patch

Patch1180128:   U_Fix-XChangeFeedbackControl-request-underflow.patch

Patch2001:      U_build-glx-Lower-gl-version-to-work-with-libglvnd.patch
Patch2002:      U_meson-Fix-another-reference-to-gl-9.2.0.patch

Patch2005:      U_xfree86-Change-displays-array-to-pointers-array-to-f.patch
Patch2006:      U_xfree86-Fix-NULL-pointer-dereference-crash.patch    

Patch2010:      u_modesetting-Fix-dirty-updates-for-sw-rotation.patch

Patch2012:      U_0002-DRI2-Add-another-Coffeelake-PCI-ID.patch
Patch2013:      U_0003-dri2-Sync-i965_pci_ids.h-from-mesa.patch
Patch2014:      U_0004-dri2-Set-fallback-driver-names-for-Intel-and-AMD-chi.patch
Patch2015:      U_0005-dri2-Sync-i965_pci_ids.h-from-mesa-iris_pci_ids.h.patch
Patch2016:      u_sync-pci-ids-with-Mesa-20.2.4.patch

Patch2020:      U_glamor-Make-pixmap-exportable-from-gbm_bo_from_pixma.patch

Patch1193030:   U_rendercompositeglyphs.patch

Patch1190487:   U_xfixes-Fix-out-of-bounds-access-in-ProcXFixesCreateP.patch
Patch1190488:   U_Xext-Fix-out-of-bounds-access-in-SProcScreenSaverSus.patch
Patch1190489:   U_record-Fix-out-of-bounds-access-in-SwapCreateRegiste.patch

#CVE-2022-2320, ZDI-CAN-16070, bsc#1194181
Patch3001:      U_boo1194181-001-xkb-swap-XkbSetDeviceInfo-and-XkbSetDeviceInfoCheck.patch
#CVE-2022-2319, ZDI-CAN-16062, bsc#1194179
Patch3101:      U_boo1194179-001-xkb-rename-xkb_h-to-xkb-procs_h.patch
Patch3102:      U_boo1194179-002-xkb-add-request-length-validation-for-XkbSetGeometry.patch

Patch1204412:   U_xkb-proof-GetCountedString-against-request-length-at.patch
Patch1204416:   U_xkb-fix-some-possible-memleaks-in-XkbGetKbdByName.patch

%description
This package contains the X.Org Server.

%package extra
Summary:        Additional Xservers (Xdmx, Xephyr, Xnest)
Group:          System/X11/Servers/XF86_4
Requires:       Mesa
Requires:       xkbcomp
Requires:       xkeyboard-config
Recommends:     xorg-x11-fonts-core
Provides:       xorg-x11-Xnest
Obsoletes:      xorg-x11-Xnest

%description extra
This package contains additional Xservers (Xdmx, Xephyr, Xnest).

%if 0%{?have_wayland} == 1
%package wayland
Summary:        Xwayland Xserver
Group:          System/X11/Servers/XF86_4
Requires:       xkbcomp
Requires:       xkeyboard-config
Recommends:     xorg-x11-fonts-core

%description wayland
This package contains the Xserver running on the Wayland Display Server.
%endif

%if 0%{?build_suid_wrapper} == 1
%package wrapper
Summary:        Xserver SUID Wrapper
Group:          System/X11/Servers/XF86_4
PreReq:         permissions
Requires:       xorg-x11-server == %{version}
Provides:       xorg-x11-server-wayland = 7.6_%{version}
Obsoletes:      xorg-x11-server-wayland < 7.6_%{version}

%description wrapper
This package contains an SUID wrapper for the Xserver.
%endif

%package sdk
Summary:        X
Group:          System/Libraries
Requires:       autoconf
Requires:       automake
Requires:       c_compiler
Requires:       libtool
Requires:       xorg-x11-server
Requires:       pkgconfig(fontconfig)
Requires:       pkgconfig(fontenc)
Requires:       pkgconfig(freetype2)
Requires:       pkgconfig(ice)
Requires:       pkgconfig(libdrm)
Requires:       pkgconfig(libevdev)
Requires:       pkgconfig(libudev)
Requires:       pkgconfig(mtdev)
Requires:       pkgconfig(sm)
Requires:       pkgconfig(x11)
Requires:       pkgconfig(xau)
Requires:       pkgconfig(xdmcp)
Requires:       pkgconfig(xext)
Requires:       pkgconfig(xfixes)
Requires:       pkgconfig(xkbfile)
Requires:       pkgconfig(xmu)
Requires:       pkgconfig(xorg-macros)
Requires:       pkgconfig(xp)
Requires:       pkgconfig(xpm)
Requires:       pkgconfig(xprintutil)
Requires:       pkgconfig(xrender)
Requires:       pkgconfig(xt)
Requires:       pkgconfig(xtrans)
Requires:       pkgconfig(xv)
Provides:       xorg-x11-sdk
Obsoletes:      xorg-x11-sdk
Provides:       glamor-devel = %{version}
Obsoletes:      glamor-devel < %{version}
Obsoletes:      glamor-devel < 7.6_%{version}
Provides:       xorg-x11-server-sdk = 7.6_%{version}
Obsoletes:      xorg-x11-server-sdk < 7.6_%{version}

%description sdk
This package contains the X.Org Server SDK.

%package source
Summary:        Source code of X.Org server
Group:          Development/Sources

%description source
This package contains patched sources of X.Org Server.

%prep
%setup -q -n xorg-server-%{version} -a3
# Early verification if the ABI Defines are correct. Let's not waste build cycles if the Provides are wrong at the end.
sh %{SOURCE92} --verify . %{SOURCE91}

%if 0%{?suse_version} < 1315
%patch1
%endif
%patch2 -p1
%patch3 -p0
%patch4 -p0
%patch6 -p0
%patch7 -p1
%patch8 -p1
%patch9 -p1
#
%patch100 -p1
#%patch101 -p1
%patch102 -p1

%patch104 -p1

%patch112 -p1

%patch115 -p1

%patch117 -p1

%patch160 -p1

%patch208 -p1
%patch209 -p1

### not applicable anymore
#%patch210 -p1

%patch215 -p1

%patch1000 -p1

### disabled for now
#%patch1162 -p1
### disabled for now
#%patch1211 -p1
### patch222 might not be applicable anymore
#%patch1222 -p1

%patch1401 -p1

%patch1501 -p1

%patch1502 -p1

%patch1503 -p1

# required for NVIDIA's PRIME render offload support
%patch1601 -p1
%patch1602 -p1
%patch1603 -p1
%patch1604 -p1
%patch1605 -p1

%patch1174633 -p1
%patch1174635 -p1
%patch1174638 -p1

%patch1703 -p1
%patch1704 -p1

%patch1801 -p1
%patch1802 -p1
%patch1803 -p1
%patch1804 -p1
%patch1805 -p1
%patch1806 -p1
%patch1807 -p1
%patch1808 -p1

%patch1900 -p1

%patch1174908 -p1

%patch2000 -p1

%patch1180128 -p0

%patch2001 -p1
%patch2002 -p1

%patch2005 -p1
%patch2006 -p1

%patch2010 -p1

%patch2012 -p1
%patch2013 -p1
%patch2014 -p1
%patch2015 -p1
%patch2016 -p1

%patch2020 -p1

%patch1193030 -p1

%patch1190487 -p1
%patch1190488 -p1
%patch1190489 -p1

%patch3001 -p1
%patch3101 -p1
%patch3102 -p1

%patch1204412 -p1
%patch1204416 -p1

%build
test -e source-file-list || \
    find -L . -type f \! -name '*.orig' \! -path ./source-file-list > \
    source-file-list

autoreconf -fi
%if 0%{?pci_ids_dir:1}
export PCI_TXT_IDS_DIR=%{pci_ids_dir}
%endif
%configure CFLAGS="%{optflags} -fno-strict-aliasing" \
            --enable-xf86vidmode \
	    --sysconfdir=/etc \
            --enable-xdmcp \
            --enable-xdm-auth-1 \
            --enable-dri \
            --enable-dri2 \
            --enable-dri3 \
            --enable-glamor \
            --enable-dmx \
            --enable-xnest \
            --enable-kdrive \
            --enable-kdrive-evdev \
            --enable-xephyr \
            --disable-xfake \
            --disable-xfbdev \
            --enable-record \
            --enable-xcsecurity \
            --enable-systemd-logind \
            --with-sha1=libcrypto \
            --disable-linux-acpi \
            --disable-linux-apm \
%ifarch s390 s390x
            --disable-xorg \
            --disable-aiglx \
%else
            --enable-xorg \
%if 0%{?suse_version} > 1120
	    --enable-config-udev \
%endif
%endif
%if 0%{?have_wayland} == 1
            --enable-xwayland \
%else
            --disable-xwayland \
%endif
%if 0%{?build_suid_wrapper} == 1
	    --enable-suid-wrapper \
	    --libexecdir=%{suid_wrapper_dir} \
%endif
            --with-log-dir="/var/log" \
            --with-os-name="openSUSE" \
            --with-os-vendor="SUSE LINUX" \
            --with-fontrootdir="/usr/share/fonts" \
            --with-xkb-path="/usr/share/X11/xkb" \
            --with-xkb-output="/var/lib/xkb/compiled" \
	    --with-default-font-path="/usr/share/fonts/misc:unscaled,\
/usr/share/fonts/Type1/,/usr/share/fonts/100dpi:unscaled,\
%if 0%{?suse_version} > 1210
/usr/share/fonts/75dpi:unscaled,/usr/share/fonts/ghostscript/,\
%else
/usr/share/fonts/75dpi:unscaled,/usr/share/fonts/URW/,\
%endif
/usr/share/fonts/cyrillic:unscaled,\
/usr/share/fonts/misc/sgi:unscaled,\
/usr/share/fonts/truetype/,built-ins"
make %{?_smp_mflags}
make -C hw/kdrive %{?_smp_mflags}

%install
%make_install
make -C hw/kdrive install DESTDIR=%{buildroot}
%ifnarch s390 s390x
# remove .la files
find %{buildroot}%{_libdir}/xorg/modules/ -name "*.la" | \
  xargs rm
install -m 644 hw/xfree86/parser/{xf86Parser.h,xf86Optrec.h} \
  %{buildroot}%{_includedir}/xorg
# bnc #632737
chmod u-s %{buildroot}%{_bindir}/Xorg
%if 0%{?pci_ids_dir:1}
%__mkdir_p %{buildroot}%{pci_ids_dir}
install -m 644 %{S:6} %{buildroot}%{pci_ids_dir}
%endif
ln -snf Xorg %{buildroot}%{_bindir}/X
%if 0%{?suse_version} > 1120
# get rid of evdev config file, since it's meanwhile shipped with
# evdev driver itself (since 2.10.0)
rm -f %{buildroot}/%{_datadir}/X11/xorg.conf.d/10-evdev.conf
mkdir -p %{buildroot}%{_sysconfdir}/X11/xorg.conf.d
cp %{buildroot}/%{_datadir}/X11/xorg.conf.d/10-quirks.conf %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/
%{__install} -m 644 %{S:5} %{buildroot}%{_sysconfdir}/X11/xorg.conf.d/
%endif
%if 0%{?suse_version} < 1315
mkdir -p %{buildroot}%{_libdir}/xorg/modules/updates/{fonts,input,linux,drivers,multimedia,extensions}
install -m 644 $RPM_SOURCE_DIR/README.updates %{buildroot}%{_libdir}/xorg/modules/updates
%endif
%else
rm -f %{buildroot}%{_datadir}/aclocal/*.m4
%endif
# FATE#325524
mkdir -p %{buildroot}%{_datadir}/factory/%{_localstatedir}/lib/xkb/compiled
mv %{buildroot}%{_localstatedir}/lib/xkb/compiled/README.compiled %{buildroot}%{_datadir}/factory/%{_localstatedir}/lib/xkb/compiled/
mkdir -p %{buildroot}%{_tmpfilesdir}
install -m 644 %{S:7} %{buildroot}%{_tmpfilesdir}/xkb.conf
%ifarch s390 s390x
rm -f %{buildroot}%{_sysconfdir}/X11/10-quirks.conf
mkdir -p %{buildroot}%{_includedir}/xorg
install -m 644 include/list.h \
         %{buildroot}%{_includedir}/xorg
%endif
%ifnarch s390 s390x
mkdir -p %{buildroot}%{_fillupdir}
install -m 644 %_sourcedir/sysconfig.displaymanager.template \
  %{buildroot}%{_fillupdir}/sysconfig.displaymanager-%{name}
%endif
install -m 755 $RPM_SOURCE_DIR/xorg-backtrace %{buildroot}%{_bindir}/xorg-backtrace
cp %{S:90} .
./config.status --file xorg-x11-server.macros
install -D xorg-x11-server.macros %{buildroot}%{_sysconfdir}/rpm/macros.xorg-server
%ifnarch s390 s390x
%if 0%{?suse_version} >= 1315
mkdir -p %{buildroot}%{_libdir}/xorg/modules/extensions/xorg
mv  %{buildroot}%{_libdir}/xorg/modules/extensions/libglx.so \
    %{buildroot}%{_libdir}/xorg/modules/extensions/xorg/xorg-libglx.so
ln -snf %{_sysconfdir}/alternatives/libglx.so %{buildroot}%{_libdir}/xorg/modules/extensions/libglx.so
%endif
%endif

mkdir -p %{buildroot}/usr/src/xserver
xargs cp --parents --target-directory=%{buildroot}/usr/src/xserver < source-file-list

%post
%tmpfiles_create xbb.conf
%ifnarch s390 s390x
%{fillup_only -an displaymanager}
# Move SaX2 generated xorg.conf file to xorg.conf.sle11
#
# Only in very rare cases a static X configuration is still
# required on sle12. And, in some cases the migration from a
# static sle11 X configuration to a static sle12 X configuration
# is not possible at all, e.g. some video and input drivers
# are no longer available on sle12. In short, trying to migrate
# will result in more harm than benefit.
if [ -f etc/X11/xorg.conf -a ! -f etc/X11/xorg.conf.sle11 ]; then
  echo "xorg.conf exists and xorg.conf.sle11 does not"
  if grep -q "SaX generated X11 config file" etc/X11/xorg.conf; then
    echo "move SaX generated xorg.conf to xorg.conf.sle11"
    mv etc/X11/xorg.conf etc/X11/xorg.conf.sle11
    # remove dangling link (bnc#879360, comment#15)
    rm -f etc/X11/XF86Config
    # prevent %postun of NVIDIA/fglrx driver packages from restoring xorg.conf
    # backup or running sax2 as fallback to create a new xorg.conf (bcn#877315)
    rm -f etc/X11/xorg.conf.nvidia-post \
          etc/X11/xorg.conf.fglrx-post
    chmod -x usr/sbin/sax2
  fi
fi
%if 0%{?suse_version} >= 1315
%_sbindir/update-alternatives \
    --force --install %{_libdir}/xorg/modules/extensions/libglx.so libglx.so %{_libdir}/xorg/modules/extensions/xorg/xorg-libglx.so 50
%endif
%endif
exit 0

%ifnarch s390 s390x
%if 0%{?suse_version} >= 1315
%postun
if [ "$1" = 0 ] ; then
   "%_sbindir/update-alternatives" --remove libglx.so %{_libdir}/xorg/modules/extensions/xorg/xorg-libglx.so
fi
%endif
%endif

%if 0%{?build_suid_wrapper} == 1
%post wrapper
%set_permissions %{suid_wrapper_dir}/Xorg.wrap

%verifyscript wrapper
%verify_permissions -e %{suid_wrapper_dir}/Xorg.wrap
%endif

%files
%defattr(-,root,root)
%ifnarch s390 s390x
%if 0%{?suse_version} > 1120
%dir %{_sysconfdir}/X11/xorg.conf.d
%if 0%{?pci_ids_dir:1}
%dir %{pci_ids_dir}
%{pci_ids_dir}/modesetting.ids
%endif
%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/10-quirks.conf
%config(noreplace) %{_sysconfdir}/X11/xorg.conf.d/50-extensions.conf
%dir %{_datadir}/X11/xorg.conf.d
%{_datadir}/X11/xorg.conf.d/10-*.conf
%endif
%endif
%{_tmpfilesdir}/xkb.conf
%dir %{_localstatedir}/lib/xkb
%dir %{_localstatedir}/lib/xkb/compiled
%dir %{_libdir}/xorg
%{_libdir}/xorg/protocol.txt
%{_mandir}/man1/*
%exclude %{_mandir}/man1/Xdmx.1*
%exclude %{_mandir}/man1/Xephyr.1*
%exclude %{_mandir}/man1/Xnest.1*
%dir %{_datadir}/factory
%dir %{_datadir}/factory/var
%dir %{_datadir}/factory/var/lib
%dir %{_datadir}/factory/var/lib/xkb
%dir %{_datadir}/factory/var/lib/xkb/compiled
%{_datadir}/factory/%{_localstatedir}/lib/xkb/compiled/README.compiled
%ifnarch s390 s390x
%{_bindir}/Xorg
%if 0%{?build_suid_wrapper} == 1
%{suid_wrapper_dir}/Xorg
%endif
%{_bindir}/X

%{_bindir}/cvt
%{_bindir}/gtf
%{_libdir}/xorg/modules/
%{_mandir}/man4/*
%{_mandir}/man5/*
%{_fillupdir}/sysconfig.displaymanager-%{name}
%if 0%{?suse_version} >= 1315
%ghost %{_sysconfdir}/alternatives/libglx.so
%endif
%endif
%{_bindir}/Xvfb
%{_bindir}/xorg-backtrace

%if 0%{?have_wayland} == 1
%files wayland
%{_bindir}/Xwayland
%endif

%if 0%{?build_suid_wrapper} == 1
%files wrapper
%defattr(-,root,root)
%attr(4755,root,root) %{suid_wrapper_dir}/Xorg.wrap
%endif

%files extra
%defattr(-,root,root)
%{_bindir}/Xephyr
%{_bindir}/Xnest
%{_bindir}/Xdmx
%{_bindir}/dmxaddinput
%{_bindir}/dmxaddscreen
%{_bindir}/dmxinfo
%{_bindir}/dmxreconfig
%{_bindir}/dmxresize
%{_bindir}/dmxrminput
%{_bindir}/dmxrmscreen
%{_bindir}/dmxtodmx
%{_bindir}/dmxwininfo
%{_bindir}/vdltodmx
%{_bindir}/xdmxconfig
%{_mandir}/man1/Xdmx.1*
%{_mandir}/man1/Xephyr.1*
%{_mandir}/man1/Xnest.1*

%files sdk
%defattr(-,root,root)
%{_includedir}/xorg/
%ifnarch s390 s390x
%{_libdir}/pkgconfig/*.pc
%{_datadir}/aclocal/*.m4
%endif
%{_sysconfdir}/rpm/macros.xorg-server

%files source
%defattr(-,root,root)
/usr/src/xserver

%changelog
openSUSE Build Service is sponsored by