Index: graphics/dri/Makefile =================================================================== --- graphics/dri/Makefile +++ graphics/dri/Makefile @@ -3,6 +3,7 @@ PORTNAME= dri PORTVERSION= ${MESAVERSION} +PORTREVISION= 0 PORTEPOCH= 2 CATEGORIES= graphics Index: graphics/dri/pkg-plist =================================================================== --- graphics/dri/pkg-plist +++ graphics/dri/pkg-plist @@ -63,6 +63,9 @@ @comment lib/libglapi.so @comment lib/libglapi.so.0 @comment lib/libglapi.so.0.0.0 +@comment lib/libwayland-egl.so +@comment lib/libwayland-egl.so.1 +@comment lib/libwayland-egl.so.1.0.0 %%VDPAU%%lib/vdpau/libvdpau_r300.so %%VDPAU%%lib/vdpau/libvdpau_r300.so.1 %%VDPAU%%lib/vdpau/libvdpau_r300.so.1.0 @@ -81,3 +84,4 @@ @comment libdata/pkgconfig/gl.pc @comment libdata/pkgconfig/glesv2.pc @comment libdata/pkgconfig/osmesa.pc +@comment libdata/pkgconfig/wayland-egl.pc Index: graphics/gbm/Makefile =================================================================== --- graphics/gbm/Makefile +++ graphics/gbm/Makefile @@ -22,7 +22,7 @@ .include .include "${.CURDIR}/../../graphics/libGL/Makefile.common" -MESA_BUILD_WRKSRC= src/mapi src/gbm +MESA_BUILD_WRKSRC= src/egl/wayland/wayland-drm src/mapi src/gbm MESA_INSTALL_WRKSRC= src/gbm .include "${.CURDIR}/../../graphics/libGL/Makefile.targets" Index: graphics/libEGL/Makefile =================================================================== --- graphics/libEGL/Makefile +++ graphics/libEGL/Makefile @@ -22,8 +22,9 @@ .include .include "${.CURDIR}/../../graphics/libGL/Makefile.common" -MESA_BUILD_WRKSRC= src/mapi src/gbm src/egl/ -MESA_INSTALL_WRKSRC= src/egl +MESA_BUILD_WRKSRC= src/mapi src/egl/wayland/wayland-egl \ + src/egl/wayland/wayland-drm src/gbm src/egl +MESA_INSTALL_WRKSRC= src/egl src/egl/wayland/wayland-egl .include "${.CURDIR}/../../graphics/libGL/Makefile.targets" Index: graphics/libEGL/pkg-plist =================================================================== --- graphics/libEGL/pkg-plist +++ graphics/libEGL/pkg-plist @@ -7,4 +7,8 @@ lib/libEGL.so lib/libEGL.so.1 lib/libEGL.so.1.0.0 +lib/libwayland-egl.so +lib/libwayland-egl.so.1 +lib/libwayland-egl.so.1.0.0 libdata/pkgconfig/egl.pc +libdata/pkgconfig/wayland-egl.pc Index: graphics/libGL/Makefile =================================================================== --- graphics/libGL/Makefile +++ graphics/libGL/Makefile @@ -12,7 +12,7 @@ libglapi.so:graphics/libglapi \ libexpat.so:textproc/expat2 -USE_XORG= dri2proto dri3proto glproto presentproto x11 xcb xdamage xext \ +USE_XORG= dri2proto:both dri3proto glproto presentproto x11 xcb xdamage xext \ xfixes xshmfence xxf86vm .include Index: graphics/libGL/Makefile.common =================================================================== --- graphics/libGL/Makefile.common +++ graphics/libGL/Makefile.common @@ -18,19 +18,23 @@ MESAVERSION= ${MESABASEVERSION}${MESASUBVERSION:C/^(.)/.\1/} MESADISTVERSION=${MESABASEVERSION}${MESASUBVERSION:C/^(.)/-\1/} -MESABASEVERSION= 13.0.5 +MESABASEVERSION= 17.0.2 # if there is a subversion, don't include the '-' between 7.11-rc2. -MESASUBVERSION= +MESASUBVERSION= -MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/${MESABASEVERSION}/ +MASTER_SITES= ftp://ftp.freedesktop.org/pub/mesa/ DISTFILES= mesa-${MESADISTVERSION}${EXTRACT_SUFX} MAINTAINER= x11@FreeBSD.org -BUILD_DEPENDS+= makedepend:devel/makedepend +BUILD_DEPENDS+= makedepend:devel/makedepend \ + libudev-devd>=0:devel/libudev-devd \ + clang${MESA_LLVM_VER}:devel/llvm${MESA_LLVM_VER} \ + clang++${MESA_LLVM_VER}:devel/llvm${MESA_LLVM_VER} \ + clang-cpp${MESA_LLVM_VER}:devel/llvm${MESA_LLVM_VER} -USES+= compiler:c++11-lib bison gettext-tools gmake libtool \ +USES+= bison gettext-tools gmake libtool \ localbase pathfix pkgconfig python:2,build shebangfix tar:xz USE_LDCONFIG= yes GNU_CONFIGURE= yes @@ -44,6 +48,15 @@ PORTSCOUT= ignore:1 .endif +BUILD_DEPENDS+= binutils>=0:devel/binutils +CONFIGURE_ENV+= LD=${LOCALBASE}/bin/ld \ + AR=${LOCALBASE}/bin/ar \ + RANLIB=${LOCALBASE}/bin/ranlib \ + CC=${LOCALBASE}/bin/clang${MESA_LLVM_VER} \ + CXX=${LOCALBASE}/bin/clang++${MESA_LLVM_VER} \ + CPP=${LOCALBASE}/bin/clang-cpp${MESA_LLVM_VER} + + python_OLD_CMD= "/usr/bin/env[[:space:]]python" python_CMD= ${LOCALBASE}/bin/python2 SHEBANG_FILES= src/gallium/*/*/*.py src/gallium/tools/trace/*.py \ @@ -60,10 +73,20 @@ COMPONENT= ${PORTNAME:tl:C/^lib//:C/mesa-//} -MESA_LLVM_VER=39 +MESA_LLVM_VER=40 CONFIGURE_ARGS+= --with-sha1=libcrypto +.if ${OPSYS} == FreeBSD && \ + (${OSVERSION} >= 1200019 && ${ARCH} == amd64 )#|| \ +# ${OSVERSION} >= 1000019 && ${ARCH} == i386)) +USE_XORG+= dri3proto presentproto xshmfence +LIB_DEPENDS+= libxcb.so:x11/libxcb +CONFIGURE_ARGS+= --enable-dri3 +.else +CONFIGURE_ARGS+= --disable-dri3 +.endif + CONFIGURE_ARGS+= --enable-gbm # There are issues that need to be fixed to use TLS model "initial-exec" @@ -72,11 +95,17 @@ # pthread_setspecific which it uses now by default. But since this # configure switch is going away ... # https://lists.freebsd.org/pipermail/freebsd-arch/2016-February/017699.html -#CONFIGURE_ARGS+= --enable-glx-tls +CONFIGURE_ARGS+= --enable-glx-tls # libEGL, dri and clover need gallium enabled. + +# XXX revise this to a BUILD_DEPENDS and only LIBS_DEPEND for ports that need it. +LIB_DEPENDS+= libwayland-client.so:graphics/wayland \ + libwayland-server.so:graphics/wayland \ + libudev.so:devel/libudev-devd + # the third option in --with-egl-platforms is wayland. -CONFIGURE_ARGS+= --enable-egl --with-egl-platforms=x11,drm +CONFIGURE_ARGS+= --enable-egl --with-egl-platforms=x11,drm,wayland # we don't care about GLes v1 CONFIGURE_ARGS+= --disable-gles1 --enable-gles2 @@ -110,14 +139,14 @@ CONFIGURE_ARGS+= --enable-osmesa # gallium -BUILD_DEPENDS+= llvm${MESA_LLVM_VER}>=3.9.0_4:devel/llvm${MESA_LLVM_VER} +BUILD_DEPENDS+= llvm${MESA_LLVM_VER}>=4.0.0:devel/llvm${MESA_LLVM_VER} .if ${COMPONENT:Mdri} != "" || ${COMPONENT:Mclover} != "" || ${COMPONENT:Megl} != "" -RUN_DEPENDS+= llvm${MESA_LLVM_VER}>=3.9.0_4:devel/llvm${MESA_LLVM_VER} +RUN_DEPENDS+= llvm${MESA_LLVM_VER}>=4.0.0:devel/llvm${MESA_LLVM_VER} .endif CONFIGURE_ENV+= LLVM_CONFIG=${LOCALBASE}/bin/llvm-config${MESA_LLVM_VER} -CONFIGURE_ARGS+=--enable-gallium-llvm --enable-llvm-shared-libs \ +CONFIGURE_ARGS+=--enable-gallium-llvm \ --enable-xvmc .if ${PORT_OPTIONS:MTEXTURE} Index: graphics/libGL/distinfo =================================================================== --- graphics/libGL/distinfo +++ graphics/libGL/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1487852413 -SHA256 (mesa-13.0.5.tar.xz) = bfcea7e2c801525a60895c8aff11aa68457ee9aa35d01a4638e1f310a3f5ef87 -SIZE (mesa-13.0.5.tar.xz) = 9171480 +TIMESTAMP = 1490151671 +SHA256 (mesa-17.0.2.tar.xz) = f8f191f909e01e65de38d5bdea5fb057f21649a3aed20948be02348e77a689d4 +SIZE (mesa-17.0.2.tar.xz) = 9451056 Index: graphics/libGL/files/configure.ac =================================================================== --- graphics/libGL/files/configure.ac +++ graphics/libGL/files/configure.ac @@ -1,73 +0,0 @@ ---- configure.ac.orig 2016-06-21 14:31:09.000000000 +0200 -+++ configure.ac 2016-07-08 13:05:53.236433000 +0200 -@@ -871,7 +872,7 @@ - [enable_dri=yes]) - - case "$host_os" in --linux*) -+linux*|freebsd*) - dri3_default=yes - ;; - *) -@@ -1540,6 +1548,19 @@ - ;; - gnu*) - DEFINES="$DEFINES -DHAVE_ALIAS" -+dnl not sure about dri3 support, just enable it for now. -+ if test "x$enable_dri3" = xyes; then -+ DEFINES="$DEFINES -DHAVE_DRI3" -+ fi -+ -+ case "$host_cpu" in -+ powerpc* | sparc*) -+ # Build only the drivers for cards that exist on PowerPC/sparc -+ if test "x$with_dri_drivers" = "xyes"; then -+ with_dri_drivers="r200 radeon swrast" -+ fi -+ ;; -+ esac - ;; - cygwin*) - if test "x$with_dri_drivers" = "xyes"; then -@@ -1921,9 +1948,19 @@ - AC_MSG_ERROR([cannot enable OpenCL without Gallium]) - fi - -+ if test "x$acv_mesa_CLANG" = xno; then -+ -+ GCC_VERSION=`$CC -dumpversion` -+ if test $? -eq 0; then -+ GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1` -+ GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2` -+ fi -+ - if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then - AC_MSG_ERROR([gcc >= 4.7 is required to build clover]) - fi -+# end of clang test. -+ fi - - if test "x$have_libclc" = xno; then - AC_MSG_ERROR([pkg-config cannot find libclc.pc which is required to build clover. -@@ -2102,9 +2139,9 @@ - strip_unwanted_llvm_flags() { - # Use \> (marks the end of the word) - echo `$1` | sed \ -- -e 's/-march=\S*//g' \ -- -e 's/-mtune=\S*//g' \ -- -e 's/-mcpu=\S*//g' \ -+ -e 's/-march=[[:graph:]]* //g' \ -+ -e 's/-mtune=[[:graph:]]* //g' \ -+ -e 's/-mcpu=[[:graph:]]* //g' \ - -e 's/-DNDEBUG\>//g' \ - -e 's/-D_GNU_SOURCE\>//g' \ - -e 's/-pedantic\>//g' \ -@@ -2196,8 +2233,6 @@ - CLANG_LIBDIR=${LLVM_LIBDIR} - fi - CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION} -- AS_IF([test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"], -- [AC_MSG_ERROR([Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries.])]) - fi - else - MESA_LLVM=0 Index: graphics/libGL/files/patch-configure =================================================================== --- graphics/libGL/files/patch-configure +++ graphics/libGL/files/patch-configure @@ -1,6 +1,326 @@ ---- configure.orig 2017-01-05 15:52:21 UTC +--- configure.orig 2017-03-04 15:47:01 UTC +++ configure -@@ -21955,7 +21955,7 @@ fi +@@ -1956,7 +1956,7 @@ Optional Features: + Disable writable .text section on x86 (decreases + performance) [default=disabled] + --enable-gallium-llvm build gallium LLVM support [default=enabled on +- x86/x86_64] ++ x86/amd64] + --enable-valgrind Build mesa with valgrind support (default: auto) + + Optional Packages: +@@ -9620,7 +9620,7 @@ mips64*-*linux*) + rm -rf conftest* + ;; + +-x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ ++amd64-*kfreebsd*-gnu|amd64-*linux*|powerpc*-*linux*| \ + s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the +@@ -9637,13 +9637,13 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in +- x86_64-*kfreebsd*-gnu) ++ amd64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; +- x86_64-*linux*) ++ amd64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) +- LD="${LD-ld} -m elf32_x86_64" ++ LD="${LD-ld} -m elf32_amd64" + ;; + *) + LD="${LD-ld} -m elf_i386" +@@ -9666,11 +9666,11 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux* + ;; + *64-bit*) + case $host in +- x86_64-*kfreebsd*-gnu) +- LD="${LD-ld} -m elf_x86_64_fbsd" ++ amd64-*kfreebsd*-gnu) ++ LD="${LD-ld} -m elf_amd64_fbsd" + ;; +- x86_64-*linux*) +- LD="${LD-ld} -m elf_x86_64" ++ amd64-*linux*) ++ LD="${LD-ld} -m elf_amd64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" +@@ -9752,8 +9752,8 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } + case $lt_cv_prog_gnu_ld in + yes*) + case $host in +- i?86-*-solaris*|x86_64-*-solaris*) +- LD="${LD-ld} -m elf_x86_64" ++ i?86-*-solaris*|amd64-*-solaris*) ++ LD="${LD-ld} -m elf_amd64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" +@@ -11462,7 +11462,7 @@ lt_prog_compiler_static= + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in +- # old Intel for x86_64, which still supported -KPIC. ++ # old Intel for amd64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' +@@ -11905,7 +11905,7 @@ $as_echo_n "checking whether the $compil + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no +- link_all_deplibs=unknown ++ link_all_deplibs=no + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= +@@ -12204,7 +12204,7 @@ _LT_EOF + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + fi + ;; + +@@ -12223,7 +12223,7 @@ _LT_EOF + _LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -12252,7 +12252,7 @@ _LT_EOF + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -12270,7 +12270,7 @@ _LT_EOF + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + else + ld_shlibs=no + fi +@@ -12918,7 +12918,7 @@ $as_echo "$lt_cv_irix_exported_symbol" > + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' +- archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' ++ archive_expsym_cmds='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-version-script,$lib-ver' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else +@@ -13767,7 +13767,7 @@ freebsd* | dragonfly*) + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) +- library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ++ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no +@@ -14899,7 +14899,7 @@ striplib= + old_striplib= + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 + $as_echo_n "checking whether stripping libraries is possible... " >&6; } +-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then ++if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +@@ -15151,7 +15151,7 @@ hardcode_automatic_CXX=no + inherit_rpath_CXX=no + module_cmds_CXX= + module_expsym_cmds_CXX= +-link_all_deplibs_CXX=unknown ++link_all_deplibs_CXX=no + old_archive_cmds_CXX=$old_archive_cmds + reload_flag_CXX=$reload_flag + reload_cmds_CXX=$reload_cmds +@@ -15362,7 +15362,7 @@ with_gnu_ld=$lt_cv_prog_gnu_ld + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' +@@ -16054,7 +16054,7 @@ fi + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= +@@ -16062,7 +16062,7 @@ fi + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no +@@ -16094,7 +16094,7 @@ fi + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$lib-ver -o $lib' + ;; + esac + +@@ -16105,7 +16105,7 @@ fi + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' +- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-version-script $wl$lib-ver' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' +@@ -16139,7 +16139,7 @@ fi + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' +- archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-version-script $wl$lib-ver' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=yes +@@ -16207,7 +16207,7 @@ fi + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then +- archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' ++ archive_expsym_cmds_CXX='echo "{ global:" > $lib-ver~ sed -e "s|$|;|" < $export_symbols >> $lib-ver~ echo "local: *; };" >> $lib-ver~$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-version-script,$lib-ver -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi +@@ -16842,7 +16842,7 @@ lt_prog_compiler_static_CXX= + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) +- # old Intel C++ for x86_64, which still supported -KPIC. ++ # old Intel C++ for amd64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' +@@ -17729,7 +17729,7 @@ freebsd* | dragonfly*) + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) +- library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ++ library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no +@@ -20377,7 +20377,7 @@ if ac_fn_c_try_compile "$LINENO"; then : + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in +- i?86 | x86_64 | ppc | ppc64) ++ i?86 | amd64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else +@@ -20960,10 +20960,10 @@ asm_arch="" + $as_echo_n "checking whether to enable assembly... " >&6; } + test "x$enable_asm" = xno && { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + $as_echo "no" >&6; } +-# disable if cross compiling on x86/x86_64 since we must run gen_matypes ++# disable if cross compiling on x86/amd64 since we must run gen_matypes + if test "x$enable_asm" = xyes -a "x$cross_compiling" = xyes; then + case "$host_cpu" in +- i?86 | x86_64 | amd64) ++ i?86 | amd64 | amd64) + if test "x$host_cpu" != "x$target_cpu"; then + enable_asm=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, cross compiling" >&5 +@@ -20982,10 +20982,10 @@ if test "x$enable_asm" = xyes; then + ;; + esac + ;; +- x86_64|amd64) ++ amd64|amd64) + case "$host_os" in + linux* | *freebsd* | dragonfly* | *netbsd* | openbsd*) +- asm_arch=x86_64 ++ asm_arch=amd64 + ;; + esac + ;; +@@ -21004,10 +21004,10 @@ if test "x$enable_asm" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, x86" >&5 + $as_echo "yes, x86" >&6; } + ;; +- x86_64|amd64) ++ amd64|amd64) + DEFINES="$DEFINES -DUSE_X86_64_ASM" +- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, x86_64" >&5 +-$as_echo "yes, x86_64" >&6; } ++ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes, amd64" >&5 ++$as_echo "yes, amd64" >&6; } + ;; + sparc) + DEFINES="$DEFINES -DUSE_SPARC_ASM" +@@ -22308,17 +22308,26 @@ llvm_add_target() { + strip_unwanted_llvm_flags() { + # Use \> (marks the end of the word) + echo " `$1`" | sed \ +- -e 's/\s\+-m\S*//g' \ +- -e 's/\s\+-DNDEBUG\>//g' \ +- -e 's/\s\+-D_GNU_SOURCE\>//g' \ +- -e 's/\s\+-pedantic\>//g' \ +- -e 's/\s\+-W\S*//g' \ +- -e 's/\s\+-O\S*//g' \ +- -e 's/\s\+-g\S*//g' \ +- -e 's/-fno-rtti\>/-Fno-rtti/g' \ +- -e 's/\s\+-f\S*//g' \ +- -e 's/-Fno-rtti\>/-fno-rtti/g' \ +- -e 's/^ //' ++ -e 's/-march=[:graph:]* //g' \ ++ -e 's/-mtune=[:graph:]* //g' \ ++ -e 's/-mcpu=[:graph:]* //g' \ ++ -e 's/-DNDEBUG[[:>:]]//g' \ ++ -e 's/-D_GNU_SOURCE[[:>:]]//g' \ ++ -e 's/-pedantic[[:>:]]//g' \ ++ -e 's/-Wcovered-switch-default[[:>:]]//g' \ ++ -e 's/-O.[[:>:]]//g' \ ++ -e 's/-g[[:>:]]//g' \ ++ -e 's/-Wall[[:>:]]//g' \ ++ -e 's/-Wcast-qual[[:>:]]//g' \ ++ -e 's/-Woverloaded-virtual[[:>:]]//g' \ ++ -e 's/-fcolor-diagnostics[[:>:]]//g' \ ++ -e 's/-fdata-sections[[:>:]]//g' \ ++ -e 's/-ffunction-sections[[:>:]]//g' \ ++ -e 's/-fno-exceptions[[:>:]]//g' \ ++ -e 's/-fomit-frame-pointer[[:>:]]//g' \ ++ -e 's/-fvisibility-inlines-hidden[[:>:]]//g' \ ++ -e 's/-fPIC[[:>:]]//g' \ ++ -e 's/-fstack-protector-strong[[:>:]]//g' + } + + llvm_set_environment_variables() { +@@ -22516,7 +22525,7 @@ fi case "$host_os" in @@ -9,10 +329,11 @@ dri3_default=yes ;; *) -@@ -23968,6 +23968,18 @@ if test "x$enable_dri" = xyes; then +@@ -24080,6 +24089,20 @@ if test "x$enable_dri" = xyes; then + with_dri_drivers="swrast" + fi ;; - *freebsd* | dragonfly* | *netbsd* | openbsd*) - DEFINES="$DEFINES -DHAVE_ALIAS" ++ *freebsd*) + if test "x$enable_dri3" = xyes; then + DEFINES="$DEFINES -DHAVE_DRI3" + fi @@ -25,36 +346,69 @@ + fi + ;; + esac - ;; - gnu*) - DEFINES="$DEFINES -DHAVE_ALIAS" -@@ -25849,9 +25861,19 @@ if test "x$enable_opencl" = xyes; then ++ ;; + esac + + # default drivers +@@ -24781,7 +24804,7 @@ fi + if test "x$enable_gallium_llvm" = xauto; then + if test "x$FOUND_LLVM" = xyes; then + case "$host_cpu" in +- i*86|x86_64|amd64) enable_gallium_llvm=yes;; ++ i*86|amd64|amd64) enable_gallium_llvm=yes;; + *) enable_gallium_llvm=no;; + esac + else +@@ -25807,6 +25830,14 @@ if test "x$enable_opencl" = xyes; then as_fn_error $? "cannot enable OpenCL without Gallium" "$LINENO" 5 fi + if test "x$acv_mesa_CLANG" = xno; then -+ -+ GCC_VERSION=`$CC -dumpversion` -+ if test $? -eq 0; then -+ GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1` -+ GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2` ++ GCC_VERSION=`$CC -dumpversion` ++ if test $? -eq 0; then ++ GCC_VERSION_MAJOR=`echo $GCC_VERSION | cut -d. -f1` ++ GCC_VERSION_MINOR=`echo $GCC_VERSION | cut -d. -f2` ++ fi + fi + if test $GCC_VERSION_MAJOR -lt 4 -o $GCC_VERSION_MAJOR -eq 4 -a $GCC_VERSION_MINOR -lt 7; then as_fn_error $? "gcc >= 4.7 is required to build clover" "$LINENO" 5 fi -+# end of clang test. -+ fi - - if test "x$have_libclc" = xno; then - as_fn_error $? "pkg-config cannot find libclc.pc which is required to build clover. -@@ -26670,9 +26692,6 @@ fi - CLANG_LIBDIR=${LLVM_LIBDIR} - fi - CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION} -- if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then : +@@ -25850,10 +25881,6 @@ if test "x$enable_opencl" = xyes; then + if test -z "$CLANG_LIBDIR"; then + CLANG_LIBDIR=${LLVM_LIBDIR} + fi +- CLANG_RESOURCE_DIR=$CLANG_LIBDIR/clang/${LLVM_VERSION} +- if test ! -f "$CLANG_RESOURCE_DIR/include/stddef.h"; then : - as_fn_error $? "Could not find clang internal header stddef.h in $CLANG_RESOURCE_DIR Use --with-clang-libdir to specify the correct path to the clang libraries." "$LINENO" 5 -fi - fi - else - MESA_LLVM=0 + fi + if test "x$enable_opencl" = xyes; then + HAVE_CLOVER_TRUE= +@@ -26453,7 +26480,7 @@ fi + r300_require_llvm() { + case "$host" in *gnux32) return;; esac + case "$host_cpu" in +- i*86|x86_64|amd64) require_llvm $1 ++ i*86|amd64|amd64) require_llvm $1 + ;; + esac + } +@@ -28006,7 +28033,7 @@ else + fi + + +- if test "x$asm_arch" = xx86 -o "x$asm_arch" = xx86_64; then ++ if test "x$asm_arch" = xx86 -o "x$asm_arch" = xamd64; then + HAVE_X86_ASM_TRUE= + HAVE_X86_ASM_FALSE='#' + else +@@ -28014,7 +28041,7 @@ else + HAVE_X86_ASM_FALSE= + fi + +- if test "x$asm_arch" = xx86_64; then ++ if test "x$asm_arch" = xamd64; then + HAVE_X86_64_ASM_TRUE= + HAVE_X86_64_ASM_FALSE='#' + else Index: graphics/libGL/files/patch-include__GL__internal__dri_interface.h =================================================================== --- graphics/libGL/files/patch-include__GL__internal__dri_interface.h +++ graphics/libGL/files/patch-include__GL__internal__dri_interface.h @@ -1,7 +1,7 @@ GCC on 9.x doesn't allow types to be overwritten, these types are defined in drm.h also, which causes build issues in xorg-server. ---- include/GL/internal/dri_interface.h.orig 2016-11-10 22:05:17 UTC +--- include/GL/internal/dri_interface.h.orig 2017-02-06 13:49:08 UTC +++ include/GL/internal/dri_interface.h @@ -40,13 +40,7 @@ #ifndef DRI_INTERFACE_H Index: graphics/libGL/files/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c =================================================================== --- graphics/libGL/files/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c +++ graphics/libGL/files/patch-src__gallium__auxiliary__pipe-loader__pipe_loader_drm.c @@ -25,9 +25,9 @@ Reviewed-by: Francisco Jerez ---- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2016-11-10 22:05:17 UTC +--- src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c.orig 2017-02-06 13:49:09 UTC +++ src/gallium/auxiliary/pipe-loader/pipe_loader_drm.c -@@ -215,6 +215,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa +@@ -225,6 +225,14 @@ pipe_loader_drm_probe_fd(struct pipe_loa } static int @@ -42,7 +42,7 @@ open_drm_render_node_minor(int minor) { char path[PATH_MAX]; -@@ -226,8 +234,15 @@ open_drm_render_node_minor(int minor) +@@ -236,8 +244,15 @@ open_drm_render_node_minor(int minor) int pipe_loader_drm_probe(struct pipe_loader_device **devs, int ndev) { @@ -59,7 +59,7 @@ for (i = DRM_RENDER_NODE_MIN_MINOR, j = 0; i <= DRM_RENDER_NODE_MAX_MINOR; i++) { struct pipe_loader_device *dev; -@@ -241,6 +256,9 @@ pipe_loader_drm_probe(struct pipe_loader +@@ -251,6 +266,9 @@ pipe_loader_drm_probe(struct pipe_loader continue; } @@ -69,7 +69,7 @@ if (j < ndev) { devs[j] = dev; } else { -@@ -250,6 +268,46 @@ pipe_loader_drm_probe(struct pipe_loader +@@ -260,6 +278,46 @@ pipe_loader_drm_probe(struct pipe_loader j++; } Index: graphics/libGL/files/patch-src__gallium__auxiliary__util__u_network.c =================================================================== --- graphics/libGL/files/patch-src__gallium__auxiliary__util__u_network.c +++ graphics/libGL/files/patch-src__gallium__auxiliary__util__u_network.c @@ -0,0 +1,12 @@ +--- src/gallium/auxiliary/util/u_network.c.orig 2017-02-06 13:49:09 UTC ++++ src/gallium/auxiliary/util/u_network.c +@@ -7,7 +7,8 @@ + # include + # include + #elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \ +- defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) ++ defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) || \ ++ defined(PIPE_OS_BSD) + # include + # include + # include Index: graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h =================================================================== --- graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h +++ graphics/libGL/files/patch-src__gallium__include__pipe__p_config.h @@ -1,4 +1,4 @@ ---- src/gallium/include/pipe/p_config.h.orig 2016-11-10 22:05:17 UTC +--- src/gallium/include/pipe/p_config.h.orig 2017-02-06 13:49:09 UTC +++ src/gallium/include/pipe/p_config.h @@ -76,6 +76,13 @@ #define PIPE_CC_ICL Index: graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp =================================================================== --- graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp +++ graphics/libGL/files/patch-src__gallium__state_trackers__clover__util__range.hpp @@ -5,7 +5,7 @@ See: https://bugs.freedesktop.org/show_bug.cgi?id=74098#c3 ---- src/gallium/state_trackers/clover/util/range.hpp.orig 2016-11-10 22:05:17 UTC +--- src/gallium/state_trackers/clover/util/range.hpp.orig 2017-02-06 13:49:09 UTC +++ src/gallium/state_trackers/clover/util/range.hpp @@ -362,6 +362,12 @@ namespace clover { return { i, i + n }; Index: graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c =================================================================== --- graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c +++ graphics/libGL/files/patch-src__gallium__winsys__svga__drm__vmw_screen_ioctl.c @@ -1,4 +1,4 @@ ---- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2016-11-10 22:05:17 UTC +--- src/gallium/winsys/svga/drm/vmw_screen_ioctl.c.orig 2017-02-06 13:49:09 UTC +++ src/gallium/winsys/svga/drm/vmw_screen_ioctl.c @@ -70,6 +70,11 @@ vmw_region_size(struct vmw_region *regio return region->size; Index: graphics/libGL/files/patch-src__loader__Makefile.in =================================================================== --- graphics/libGL/files/patch-src__loader__Makefile.in +++ graphics/libGL/files/patch-src__loader__Makefile.in @@ -0,0 +1,11 @@ +--- src/loader/Makefile.in.orig 2017-02-06 18:32:27 UTC ++++ src/loader/Makefile.in +@@ -538,7 +538,7 @@ AM_CPPFLAGS = \ + $(XCB_DRI3_CFLAGS) \ + $(LIBDRM_CFLAGS) + +-libloader_la_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_1) ++libloader_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBDEVQ_CFLAGS) $(am__append_1) + libloader_la_SOURCES = $(LOADER_C_FILES) + libloader_la_LIBADD = $(am__append_2) $(am__append_3) + @HAVE_DRI3_TRUE@libloader_dri3_helper_la_SOURCES = \ Index: graphics/libGL/files/patch-src__loader__loader.c =================================================================== --- graphics/libGL/files/patch-src__loader__loader.c +++ graphics/libGL/files/patch-src__loader__loader.c @@ -0,0 +1,320 @@ +--- src/loader/loader.c.orig 2017-02-06 13:49:09 UTC ++++ src/loader/loader.c +@@ -33,6 +33,16 @@ + #include + #include + #include ++ ++ ++#include ++#include ++#include ++#include ++ ++#undef HAVE_LIBDRM ++#define HAVE_LIBUDEV 1 ++ + #ifdef MAJOR_IN_MKDEV + #include + #endif +@@ -82,6 +92,231 @@ loader_open_device(const char *device_na + return fd; + } + ++#ifdef HAVE_LIBUDEV ++#include ++ ++static void *udev_handle = NULL; ++ ++static void * ++udev_dlopen_handle(void) ++{ ++ char name[80]; ++ unsigned flags = RTLD_NOLOAD | RTLD_LOCAL | RTLD_LAZY; ++ int version; ++ ++ /* libudev.so.1 changed the return types of the two unref functions ++ * from voids to pointers. We don't use those return values, and the ++ * only ABI I've heard that cares about this kind of change (calling ++ * a function with a void * return that actually only returns void) ++ * might be ia64. ++ */ ++ ++ /* First try opening an already linked libudev, then try loading one */ ++ do { ++ for (version = 1; version >= 0; version--) { ++ snprintf(name, sizeof(name), "libudev.so.%d", version); ++ udev_handle = dlopen(name, flags); ++ if (udev_handle) ++ return udev_handle; ++ } ++ ++ if ((flags & RTLD_NOLOAD) == 0) ++ break; ++ ++ flags &= ~RTLD_NOLOAD; ++ } while (1); ++ ++ log_(_LOADER_WARNING, ++ "Couldn't dlopen libudev.so.1 or " ++ "libudev.so.0, driver detection may be broken.\n"); ++ return NULL; ++} ++ ++static int dlsym_failed = 0; ++ ++static void * ++checked_dlsym(void *dlopen_handle, const char *name) ++{ ++ void *result = dlsym(dlopen_handle, name); ++ if (!result) ++ dlsym_failed = 1; ++ return result; ++} ++ ++#define UDEV_SYMBOL(ret, name, args) \ ++ ret (*name) args = checked_dlsym(udev_dlopen_handle(), #name); ++ ++ ++static inline struct udev_device * ++udev_device_new_from_fd(struct udev *udev, int fd) ++{ ++ struct udev_device *device; ++ struct stat buf; ++ UDEV_SYMBOL(struct udev_device *, udev_device_new_from_devnum, ++ (struct udev *udev, char type, dev_t devnum)); ++ ++ if (dlsym_failed) ++ return NULL; ++ ++ if (fstat(fd, &buf) < 0) { ++ log_(_LOADER_WARNING, "MESA-LOADER: failed to stat fd %d\n", fd); ++ return NULL; ++ } ++ ++ device = udev_device_new_from_devnum(udev, 'c', buf.st_rdev); ++ if (device == NULL) { ++ log_(_LOADER_WARNING, ++ "MESA-LOADER: could not create udev device for fd %d\n", fd); ++ return NULL; ++ } ++ ++ return device; ++} ++ ++static int ++libudev_get_pci_id_for_fd(int fd, int *vendor_id, int *chip_id) ++{ ++ struct udev *udev = NULL; ++ struct udev_device *device = NULL, *parent; ++ const char *pci_id; ++ UDEV_SYMBOL(struct udev *, udev_new, (void)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_get_parent, ++ (struct udev_device *)); ++ UDEV_SYMBOL(const char *, udev_device_get_property_value, ++ (struct udev_device *, const char *)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_unref, ++ (struct udev_device *)); ++ UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *)); ++ ++ *chip_id = -1; ++ ++ if (dlsym_failed) ++ return 0; ++ ++ udev = udev_new(); ++ device = udev_device_new_from_fd(udev, fd); ++ if (!device) ++ goto out; ++ ++ parent = udev_device_get_parent(device); ++ if (parent == NULL) { ++ log_(_LOADER_WARNING, "MESA-LOADER: could not get parent device\n"); ++ goto out; ++ } ++ ++ pci_id = udev_device_get_property_value(parent, "PCI_ID"); ++ if (pci_id == NULL) { ++ log_(_LOADER_INFO, "MESA-LOADER: no PCI ID\n"); ++ *chip_id = -1; ++ goto out; ++ } else if (sscanf(pci_id, "%x:%x", vendor_id, chip_id) != 2) { ++ log_(_LOADER_WARNING, "MESA-LOADER: malformed PCI ID\n"); ++ *chip_id = -1; ++ goto out; ++ } ++ ++out: ++ if (device) ++ udev_device_unref(device); ++ if (udev) ++ udev_unref(udev); ++ ++ return (*chip_id >= 0); ++} ++ ++static char * ++get_render_node_from_id_path_tag(struct udev *udev, ++ char *id_path_tag, ++ char another_tag) ++{ ++ struct udev_device *device; ++ struct udev_enumerate *e; ++ struct udev_list_entry *entry; ++ const char *path, *id_path_tag_tmp; ++ char *path_res; ++ char found = 0; ++ UDEV_SYMBOL(struct udev_enumerate *, udev_enumerate_new, ++ (struct udev *)); ++ UDEV_SYMBOL(int, udev_enumerate_add_match_subsystem, ++ (struct udev_enumerate *, const char *)); ++ UDEV_SYMBOL(int, udev_enumerate_add_match_sysname, ++ (struct udev_enumerate *, const char *)); ++ UDEV_SYMBOL(int, udev_enumerate_scan_devices, ++ (struct udev_enumerate *)); ++ UDEV_SYMBOL(struct udev_list_entry *, udev_enumerate_get_list_entry, ++ (struct udev_enumerate *)); ++ UDEV_SYMBOL(void, udev_enumerate_unref, ++ (struct udev_enumerate *)); ++ UDEV_SYMBOL(struct udev_list_entry *, udev_list_entry_get_next, ++ (struct udev_list_entry *)); ++ UDEV_SYMBOL(const char *, udev_list_entry_get_name, ++ (struct udev_list_entry *)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_new_from_syspath, ++ (struct udev *, const char *)); ++ UDEV_SYMBOL(const char *, udev_device_get_property_value, ++ (struct udev_device *, const char *)); ++ UDEV_SYMBOL(const char *, udev_device_get_devnode, ++ (struct udev_device *)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_unref, ++ (struct udev_device *)); ++ ++ e = udev_enumerate_new(udev); ++ udev_enumerate_add_match_subsystem(e, "drm"); ++ udev_enumerate_add_match_sysname(e, "render*"); ++ ++ udev_enumerate_scan_devices(e); ++ udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) { ++ path = udev_list_entry_get_name(entry); ++ device = udev_device_new_from_syspath(udev, path); ++ if (!device) ++ continue; ++ id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG"); ++ if (id_path_tag_tmp) { ++ if ((!another_tag && !strcmp(id_path_tag, id_path_tag_tmp)) || ++ (another_tag && strcmp(id_path_tag, id_path_tag_tmp))) { ++ found = 1; ++ break; ++ } ++ } ++ udev_device_unref(device); ++ } ++ ++ udev_enumerate_unref(e); ++ ++ if (found) { ++ path_res = strdup(udev_device_get_devnode(device)); ++ udev_device_unref(device); ++ return path_res; ++ } ++ return NULL; ++} ++ ++static char * ++get_id_path_tag_from_fd(struct udev *udev, int fd) ++{ ++ struct udev_device *device; ++ const char *id_path_tag_tmp; ++ char *id_path_tag; ++ UDEV_SYMBOL(const char *, udev_device_get_property_value, ++ (struct udev_device *, const char *)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_unref, ++ (struct udev_device *)); ++ ++ device = udev_device_new_from_fd(udev, fd); ++ if (!device) ++ return NULL; ++ ++ id_path_tag_tmp = udev_device_get_property_value(device, "ID_PATH_TAG"); ++ if (!id_path_tag_tmp) ++ return NULL; ++ ++ id_path_tag = strdup(id_path_tag_tmp); ++ ++ udev_device_unref(device); ++ return id_path_tag; ++} ++#endif ++ + #if defined(HAVE_LIBDRM) + #ifdef USE_DRICONF + static const char __driConfigOptionsLoader[] = +@@ -304,9 +539,48 @@ loader_get_pci_id_for_fd(int fd, int *ve + if (drm_get_pci_id_for_fd(fd, vendor_id, chip_id)) + return 1; + #endif ++#if HAVE_LIBUDEV ++ if (libudev_get_pci_id_for_fd(fd, vendor_id, chip_id)) ++ return 1; ++#endif + return 0; + } + ++#ifdef HAVE_LIBUDEV ++static char * ++libudev_get_device_name_for_fd(int fd) ++{ ++ char *device_name = NULL; ++ struct udev *udev; ++ struct udev_device *device; ++ const char *const_device_name; ++ UDEV_SYMBOL(struct udev *, udev_new, (void)); ++ UDEV_SYMBOL(const char *, udev_device_get_devnode, ++ (struct udev_device *)); ++ UDEV_SYMBOL(struct udev_device *, udev_device_unref, ++ (struct udev_device *)); ++ UDEV_SYMBOL(struct udev *, udev_unref, (struct udev *)); ++ ++ if (dlsym_failed) ++ return NULL; ++ ++ udev = udev_new(); ++ device = udev_device_new_from_fd(udev, fd); ++ if (device == NULL) ++ return NULL; ++ ++ const_device_name = udev_device_get_devnode(device); ++ if (!const_device_name) ++ goto out; ++ device_name = strdup(const_device_name); ++ ++out: ++ udev_device_unref(device); ++ udev_unref(udev); ++ return device_name; ++} ++#endif ++ + + #if defined(HAVE_LIBDRM) + static char * +@@ -332,6 +606,10 @@ loader_get_device_name_for_fd(int fd) + { + char *result = NULL; + ++#if HAVE_LIBUDEV ++ if ((result = libudev_get_device_name_for_fd(fd))) ++ return result; ++#endif + #if HAVE_LIBDRM + if ((result = drm_get_device_name_for_fd(fd))) + return result; +@@ -386,7 +664,7 @@ loader_get_driver_for_fd(int fd) + + out: + log_(driver ? _LOADER_DEBUG : _LOADER_WARNING, +- "pci id for fd %d: %04x:%04x, driver %s\n", ++ "UGH....pci id for fd %d: %04x:%04x, driver %s\n", + fd, vendor_id, chip_id, driver); + return driver; + } Index: graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py =================================================================== --- graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py +++ graphics/libGL/files/patch-src__mapi__glapi__gen__gl_gentable.py @@ -1,4 +1,4 @@ ---- src/mapi/glapi/gen/gl_gentable.py.orig 2017-01-06 02:14:06 UTC +--- src/mapi/glapi/gen/gl_gentable.py.orig 2017-02-06 18:32:27 UTC +++ src/mapi/glapi/gen/gl_gentable.py @@ -44,7 +44,7 @@ header = """/* GLXEXT is the define used #endif Index: graphics/libGL/files/patch-src__mesa__main__compiler.h =================================================================== --- graphics/libGL/files/patch-src__mesa__main__compiler.h +++ graphics/libGL/files/patch-src__mesa__main__compiler.h @@ -1,4 +1,4 @@ ---- src/mesa/main/compiler.h.orig 2016-11-10 22:05:17 UTC +--- src/mesa/main/compiler.h.orig 2017-02-06 13:49:09 UTC +++ src/mesa/main/compiler.h @@ -56,6 +56,9 @@ extern "C" { #if defined(__linux__) Index: graphics/libGL/files/patch-src_gallium_auxiliary_util_u__network.c =================================================================== --- graphics/libGL/files/patch-src_gallium_auxiliary_util_u__network.c +++ graphics/libGL/files/patch-src_gallium_auxiliary_util_u__network.c @@ -1,11 +0,0 @@ ---- src/gallium/auxiliary/util/u_network.c.orig 2016-11-10 22:05:17 UTC -+++ src/gallium/auxiliary/util/u_network.c -@@ -6,7 +6,7 @@ - #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) - # include - # include --#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || \ -+#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_HAIKU) || \ - defined(PIPE_OS_APPLE) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_SOLARIS) - # include - # include Index: graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp =================================================================== --- graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp +++ graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_invocation.cpp @@ -1,30 +1,14 @@ -# fix errors like the following -# -# llvm/invocation.cpp:(.text+0x1275): undefined reference to `std::__1::basic_string, std::__1::allocator >::c_str() - const' -# /usr/bin/ld: ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): relocation R_X86_64_PC32 against `_ZNKSt3__112bas -ic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE5c_strEv' can not be used when making a shared object; recompile with -fPIC -# /usr/bin/ld: final link failed: Bad value -# ---- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2016-11-28 15:34:30 UTC +--- src/gallium/state_trackers/clover/llvm/invocation.cpp.orig 2017-02-06 13:49:09 UTC +++ src/gallium/state_trackers/clover/llvm/invocation.cpp -@@ -93,6 +93,8 @@ namespace { - return ctx; - } - -+ const char* cstr(const std::string& str) { return str.c_str(); } -+ - std::unique_ptr - create_compiler_instance(const target &target, - const std::vector &opts, -@@ -104,8 +106,8 @@ namespace { +@@ -105,8 +105,9 @@ namespace { // Parse the compiler options. A file name should be present at the end // and must have the .cl extension in order for the CompilerInvocation // class to recognize it as an OpenCL source file. - const std::vector copts = - map(std::mem_fn(&std::string::c_str), opts); + std::vector copts; -+ std::transform(opts.begin(), opts.end(), copts.begin(), cstr); ++ std::transform(opts.begin(), opts.end(), std::back_inserter(copts), std::mem_fn(&std::string::c_str)); ++// map(std::mem_fn(&std::string::c_str), opts); if (!clang::CompilerInvocation::CreateFromArgs( c->getInvocation(), copts.data(), copts.data() + copts.size(), diag)) Index: graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp =================================================================== --- graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp +++ graphics/libGL/files/patch-src_gallium_state__trackers_clover_llvm_metadata.hpp @@ -1,6 +1,4 @@ -# Fix error: no matching constructor for initialization of 'std::vector' -# ---- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig 2016-11-10 22:05:17 UTC +--- src/gallium/state_trackers/clover/llvm/metadata.hpp.orig 2017-02-06 13:49:09 UTC +++ src/gallium/state_trackers/clover/llvm/metadata.hpp @@ -42,7 +42,7 @@ namespace clover { get_kernel_nodes(const ::llvm::Module &mod) { Index: graphics/libGL/files/patch-src_gallium_winsys_amdgpu_drm_amdgpu__winsys.c =================================================================== --- graphics/libGL/files/patch-src_gallium_winsys_amdgpu_drm_amdgpu__winsys.c +++ graphics/libGL/files/patch-src_gallium_winsys_amdgpu_drm_amdgpu__winsys.c @@ -0,0 +1,18 @@ +--- src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c.orig 2017-02-06 13:49:09 UTC ++++ src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +@@ -107,6 +107,7 @@ static bool do_winsys_init(struct amdgpu + int r, i, j; + drmDevicePtr devinfo; + ++#ifdef NEED_REDUNDANT_PCIINFO + /* Get PCI info. */ + r = drmGetDevice(fd, &devinfo); + if (r) { +@@ -118,6 +119,7 @@ static bool do_winsys_init(struct amdgpu + ws->info.pci_dev = devinfo->businfo.pci->dev; + ws->info.pci_func = devinfo->businfo.pci->func; + drmFreeDevice(&devinfo); ++#endif + + /* Query hardware and driver information. */ + r = amdgpu_query_gpu_info(ws->dev, &ws->amdinfo); Index: graphics/libGL/files/patch-src_intel_tools_aubinator.c =================================================================== --- graphics/libGL/files/patch-src_intel_tools_aubinator.c +++ graphics/libGL/files/patch-src_intel_tools_aubinator.c @@ -1,11 +1,10 @@ -# We don't have MAP_NORESERVE so use MAP_NOSYNC | MAP_NOCORE and -# hope for the best (this alloc is too big but it's only a test) -# ---- src/intel/tools/aubinator.c.orig 2016-11-28 15:34:30 UTC +Not sure if these mmap() flags are right ... + +--- src/intel/tools/aubinator.c.orig 2017-02-06 13:49:09 UTC +++ src/intel/tools/aubinator.c -@@ -1226,7 +1226,7 @@ int main(int argc, char *argv[]) +@@ -1299,7 +1299,7 @@ int main(int argc, char *argv[]) /* mmap a terabyte for our gtt space. */ - gtt_size = 1ul << 40; + gtt_size = 1ull << 40; gtt = mmap(NULL, gtt_size, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); + MAP_PRIVATE | MAP_ANONYMOUS | MAP_NOSYNC | MAP_NOCORE, -1, 0); Index: graphics/libGL/files/patch-src_util_ralloc.c =================================================================== --- graphics/libGL/files/patch-src_util_ralloc.c +++ graphics/libGL/files/patch-src_util_ralloc.c @@ -1,6 +1,6 @@ ---- src/util/ralloc.c.orig 2016-11-28 15:34:30 UTC +--- src/util/ralloc.c.orig 2017-02-06 13:49:09 UTC +++ src/util/ralloc.c -@@ -315,6 +315,7 @@ ralloc_parent(const void *ptr) +@@ -325,6 +325,7 @@ ralloc_parent(const void *ptr) static void *autofree_context = NULL; @@ -8,7 +8,7 @@ static void autofree(void) { -@@ -326,7 +327,6 @@ ralloc_autofree_context(void) +@@ -336,7 +337,6 @@ ralloc_autofree_context(void) { if (unlikely(autofree_context == NULL)) { autofree_context = ralloc_context(NULL); Index: graphics/libGL/files/patch-src_util_u__endian.h =================================================================== --- graphics/libGL/files/patch-src_util_u__endian.h +++ graphics/libGL/files/patch-src_util_u__endian.h @@ -1,11 +1,12 @@ ---- src/util/u_endian.h.orig 2016-11-10 22:05:17 UTC +--- src/util/u_endian.h.orig 2017-02-06 13:49:09 UTC +++ src/util/u_endian.h -@@ -54,7 +54,7 @@ +@@ -54,7 +54,8 @@ # define PIPE_ARCH_BIG_ENDIAN #endif -#elif defined(__OpenBSD__) || defined(__NetBSD__) -+#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) ++#elif defined(__OpenBSD__) || defined(__NetBSD__)|| \ ++ defined(__FreeBSD__) || defined(__DragonFly__) #include #include Index: lang/clover/Makefile =================================================================== --- lang/clover/Makefile +++ lang/clover/Makefile @@ -23,11 +23,13 @@ .include .include "${.CURDIR}/../../graphics/libGL/Makefile.common" -#MESA_BUILD_WRKSRC= src/util src/glsl src/mesa src/gallium MESA_INSTALL_WRKSRC= src/gallium/targets/opencl src/gallium/targets/pipe-loader .include "${.CURDIR}/../../graphics/libGL/Makefile.targets" +post-configure: + @${TOUCH} ${WRKSRC}/src/gallium/state_trackers/clover/git_sha1.h + post-install: @${MV} ${STAGEDIR}/etc/OpenCL ${STAGEDIR}${PREFIX}/etc/