Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create xorg-libxshmfence feedstock #27560

Merged
merged 20 commits into from
Sep 12, 2024
18 changes: 18 additions & 0 deletions recipes/xorg-libxshmfence/bld.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
:: Trailing semicolon in this variable as set by current (2017/01)
:: conda-build breaks us. Manual fix:
set "MSYS2_ARG_CONV_EXCL=/AI;/AL;/OUT;/out"
:: Delegate to the Unixy script. We need to translate the key path variables
:: to be Unix-y rather than Windows-y, though.
set "saved_recipe_dir=%RECIPE_DIR%"
FOR /F "delims=" %%i IN ('cygpath.exe -u -p "%PATH%"') DO set "PATH_OVERRIDE=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -m "%BUILD_PREFIX%"') DO set "BUILD_PREFIX_M=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -m "%LIBRARY_PREFIX%"') DO set "LIBRARY_PREFIX_M=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%LIBRARY_PREFIX%"') DO set "LIBRARY_PREFIX_U=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%PREFIX%"') DO set "PREFIX=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%PYTHON%"') DO set "PYTHON=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%RECIPE_DIR%"') DO set "RECIPE_DIR=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%SP_DIR%"') DO set "SP_DIR=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%SRC_DIR%"') DO set "SRC_DIR=%%i"
FOR /F "delims=" %%i IN ('cygpath.exe -u "%STDLIB_DIR%"') DO set "STDLIB_DIR=%%i"
bash -x %saved_recipe_dir%\build.sh
if errorlevel 1 exit 1
71 changes: 71 additions & 0 deletions recipes/xorg-libxshmfence/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#!/bin/bash
# Get an updated config.sub and config.guess
cp $BUILD_PREFIX/share/gnuconfig/config.* .

set -e
IFS=$' \t\n' # workaround for conda 4.2.13+toolchain bug

# Adopt a Unix-friendly path if we're on Windows (see bld.bat).
[ -n "$PATH_OVERRIDE" ] && export PATH="$PATH_OVERRIDE"

# On Windows we want $LIBRARY_PREFIX in both "mixed" (C:/Conda/...) and Unix
# (/c/Conda) forms, but Unix form is often "/" which can cause problems.
if [ -n "$LIBRARY_PREFIX_M" ] ; then
mprefix="$LIBRARY_PREFIX_M"
if [ "$LIBRARY_PREFIX_U" = / ] ; then
uprefix=""
else
uprefix="$LIBRARY_PREFIX_U"
fi
else
mprefix="$PREFIX"
uprefix="$PREFIX"
fi

# Cf. https://github.com/conda-forge/staged-recipes/issues/673, we're in the
# process of excising Libtool files from our packages. Existing ones can break
# the build while this happens. We have "/." at the end of $uprefix to be safe
# in case the variable is empty.
find $uprefix/. -name '*.la' -delete

# On Windows we need to regenerate the configure scripts.
if [ -n "$CYGWIN_PREFIX" ] ; then
am_version=1.15 # keep sync'ed with meta.yaml
export ACLOCAL=aclocal-$am_version
export AUTOMAKE=automake-$am_version
autoreconf_args=(
--force
--install
-I "$mprefix/share/aclocal"
-I "$BUILD_PREFIX_M/Library/mingw-w64/share/aclocal"
)
autoreconf "${autoreconf_args[@]}"

# And we need to add the search path that lets libtool find the
# msys2 stub libraries for ws2_32.
platlibs=$(cd $(dirname $(gcc --print-prog-name=ld))/../lib && pwd -W)
export LDFLAGS="$LDFLAGS -L$platlibs"
fi

export PKG_CONFIG_LIBDIR=$uprefix/lib/pkgconfig:$uprefix/share/pkgconfig
configure_args=(
--prefix=$mprefix
--disable-static
--disable-dependency-tracking
--disable-selective-werror
--disable-silent-rules
)

if [[ "${CONDA_BUILD_CROSS_COMPILATION}" == "1" ]] ; then
configure_args+=(
--enable-malloc0returnsnull
)
fi
./configure "${configure_args[@]}"
make -j$CPU_COUNT
make install
rm -rf $uprefix/share/man $uprefix/share/doc/${PKG_NAME#xorg-}

# Remove any new Libtool files we may have installed. It is intended that
# conda-build will eventually do this automatically.
find $uprefix/. -name '*.la' -delete
64 changes: 64 additions & 0 deletions recipes/xorg-libxshmfence/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{% set xorg_name = "libxshmfence" %}
{% set xorg_category = "lib" %}
{% set name = "xorg-" ~ xorg_name %}
{% set version = "1.3.2" %}
{% set sha256 = "e93a85099604beb244ee756dcaf70e18b08701c1ca84c4de0126cd71bd6c8181" %}
{% set am_version = "1.15" %} # keep synchronized with build.sh

package:
name: {{ name|lower }}
version: {{ version }}

source:
fn: {{ name }}-{{ version }}.tar.gz
url: https://www.x.org/releases/individual/{{ xorg_category }}/{{ xorg_name }}-{{ version }}.tar.gz
sha256: {{ sha256 }}
patches:
- windows.patch # [win]

build:
number: 0
detect_binary_files_with_prefix: true
run_exports:
- {{ pin_subpackage(name|lower) }}

requirements:
build:
- m2-autoconf # [win]
- m2-automake{{ am_version }} # [win]
- m2-libtool # [win]
- m2w64-pkg-config # [win]
- make
- pkg-config # [not win]
- posix # [win]
- gnuconfig # [unix]
- {{ stdlib('c') }} # [unix]
- {{ compiler('c') }} # [unix]
- {{ compiler('m2w64_c') }} # [win]
host:
- pthread-stubs
- xorg-xproto
- xorg-util-macros
run:
- m2w64-libwinpthread-git # [win]

test:
commands:
{% set lib_idents = [ "xshmfence" ] %}
{% for lib_ident in lib_idents %}
- test -f $PREFIX/lib/lib{{ lib_ident }}.dylib # [osx]
- test -f $PREFIX/lib/lib{{ lib_ident }}.so # [linux]
- if not exist %PREFIX%/Library/lib/lib{{ lib_ident }}.dll.a exit /b 1 # [win]
- if not exist %PREFIX%/Library/bin/msys-{{ lib_ident }}-*.dll exit /b 1 # [win]
{% endfor %}

about:
home: https://www.x.org/
license: MIT
license_family: MIT
license_file: COPYING
summary: Shared memory 'SyncFence' synchronization primitive

extra:
recipe-maintainers:
- ehfd
47 changes: 47 additions & 0 deletions recipes/xorg-libxshmfence/windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--- src/xshmfence_alloc.c
+++ src/xshmfence_alloc.c
@@ -97,11 +97,7 @@ xshmfence_alloc_shm(void)
return fd;
unlink(template);
#ifndef HAVE_MKOSTEMP
- flags = fcntl(fd, F_GETFD);
- if (flags != -1) {
- flags |= FD_CLOEXEC;
- fcntl(fd, F_SETFD, &flags);
- }
+ flags = 0;
#endif
}
}
@@ -124,13 +120,7 @@ xshmfence_alloc_shm(void)
struct xshmfence *
xshmfence_map_shm(int fd)
{
- struct xshmfence *addr;
- addr = mmap (NULL, sizeof (struct xshmfence) , PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
- if (addr == MAP_FAILED) {
- close (fd);
- return 0;
- }
- return addr;
+ return 0;
}

/**
@@ -141,5 +131,5 @@ xshmfence_map_shm(int fd)
void
xshmfence_unmap_shm(struct xshmfence *f)
{
- munmap(f, sizeof (struct xshmfence));
+ return;
}
--- src/xshmfenceint.h
+++ src/xshmfenceint.h
@@ -25,7 +25,6 @@

#include <stdlib.h>
#include <unistd.h>
-#include <sys/mman.h>
#include "xshmfence.h"

#if HAVE_FUTEX