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

Fix the shebang in certain scripts #192

Merged
merged 14 commits into from
Oct 14, 2024
4 changes: 2 additions & 2 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then

meson setup native-build \
"${meson_config_args[@]}" \
--prefix="$BUILD_PREFIX" \
-Dintrospection=enabled \
--prefix="$BUILD_PREFIX" \
-Dintrospection=enabled \
-Dlocalstatedir="$BUILD_PREFIX/var" \
|| { cat native-build/meson-logs/meson-log.txt ; exit 1 ; }

Expand Down
91 changes: 52 additions & 39 deletions recipe/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,56 @@ find $PREFIX -name '*.la' -delete
# (255 chars) which causes installation issues so remove it.
rm -rf $PREFIX/share/gdb

if [[ "$PKG_NAME" != glib ]]; then
if [[ "$PKG_NAME" == glib-tools ]]; then
mkdir .keep
# We ship these binaries as part of the glib-tools package because
# they can be depended on separately by other packages, e.g. gtk
# (equivalent to Debian's libglib2.0-bin)
mv $PREFIX/bin/gdbus .keep
mv $PREFIX/bin/glib-compile-schemas .keep
else
rm -f $PREFIX/bin/gapplication
rm $PREFIX/bin/gio*
rm $PREFIX/bin/gresource
rm $PREFIX/bin/gsettings
rm $PREFIX/share/bash-completion/completions/{gapplication,gdbus,gio,gresource,gsettings}

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
done
fi
rm $PREFIX/bin/{gdbus*,glib-*,gobject*,gtester*,gi-*}
if [[ "$PKG_NAME" == glib-tools ]]; then
mv .keep/* $PREFIX/bin
fi
rm -r $PREFIX/include/gio-* $PREFIX/include/glib-*
rm -r $PREFIX/lib/glib-*
rm -r $PREFIX/lib/lib{gmodule,glib,gobject,gthread,gio}-2.0${SHLIB_EXT}
rm -r $PREFIX/share/aclocal/{glib-*,gsettings*}
rm -r $PREFIX/share/gettext/its
rm -r $PREFIX/share/glib-*
# Manually install introspection data during cross-compilation
# These files are the only difference when running with a different setting of -Dintrospection
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then
cp -ap introspection/lib/girepository-1.0 $PREFIX/lib
cp -ap introspection/share/gir-1.0 $PREFIX/share
fi
if [[ "${PKG_NAME}" == "glib" ]]; then
# unsured about why the build prefix of the split package is appearing
# in there, but we must remove it
# sed -i.bak "1s|^#!.*|#!${PREFIX}/bin/python|" "${PREFIX}/bin/glib-mkenums"
# sed -i.bak "1s|^#!.*|#!${PREFIX}/bin/python|" "${PREFIX}/bin/glib-genmarshal"
# sed -i.bak "1s|^#!.*|#!${PREFIX}/bin/python|" "${PREFIX}/bin/gtester-report"

# rm ${PREFIX}/bin/glib-mkenums.bak
# rm ${PREFIX}/bin/glib-genmarshal.bak
# rm ${PREFIX}/bin/gtester-report.bak

# The remainder of the script is only for other packages. exit here with success.
exit 0
elif [[ "$PKG_NAME" == glib-tools ]]; then
mkdir .keep
# We ship these binaries as part of the glib-tools package because
# they can be depended on separately by other packages, e.g. gtk
# (equivalent to Debian's libglib2.0-bin)
mv $PREFIX/bin/gdbus .keep
mv $PREFIX/bin/glib-compile-schemas .keep
else
rm -f $PREFIX/bin/gapplication
rm $PREFIX/bin/gio*
rm $PREFIX/bin/gresource
rm $PREFIX/bin/gsettings
rm $PREFIX/share/bash-completion/completions/{gapplication,gdbus,gio,gresource,gsettings}

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}_${CHANGE}.sh"
done
fi

rm $PREFIX/bin/{gdbus*,glib-*,gobject*,gtester*,gi-*}
if [[ "$PKG_NAME" == glib-tools ]]; then
mv .keep/* $PREFIX/bin
fi
rm -r $PREFIX/include/gio-* $PREFIX/include/glib-*
rm -r $PREFIX/lib/glib-*
rm -r $PREFIX/lib/lib{gmodule,glib,gobject,gthread,gio}-2.0${SHLIB_EXT}
rm -r $PREFIX/share/aclocal/{glib-*,gsettings*}
rm -r $PREFIX/share/gettext/its
rm -r $PREFIX/share/glib-*

# Manually install introspection data during cross-compilation
# These files are the only difference when running with a different setting of -Dintrospection
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-0}" == 1 ]]; then
cp -ap introspection/lib/girepository-1.0 $PREFIX/lib
cp -ap introspection/share/gir-1.0 $PREFIX/share
fi
49 changes: 33 additions & 16 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{% set posix = 'm2-' if win else '' %}
{% set native = 'm2w64-' if win else '' %}

# Keep in sync with
# https://gitlab.gnome.org/GNOME/glib/-/blob/main/meson.build?ref_type=heads#L2468
{% set minimum_python_version = "3.7" %}

package:
name: glib-split
version: {{ version }}
Expand All @@ -27,7 +31,7 @@ source:
- patches/0005-Increase-some-test-timeouts.patch # [win]

build:
number: 0
number: 1
ignore_run_exports_from:
- python *

Expand All @@ -39,24 +43,29 @@ requirements:
- ninja
- {{ native }}pkg-config
- {{ compiler('c') }}
- {{ stdlib("c") }}
- {{ stdlib('c') }}
- {{ compiler('cxx') }}
- python >=2.7
- packaging
- setuptools <=71
- libffi # [build_platform != target_platfrom]
- libintl-devel # [(build_platform != target_platform) and (not linux)]
- zlib # [build_platform != target_platfrom]
- pcre2 # [build_platform != target_platfrom]
- libiconv # [build_platform != target_platfrom]
# While python is purely a build tool, the name of the python executable
# seems to appear in some shebang lines in the installed code.
- python >={{ minimum_python_version }} # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- packaging # [build_platform != target_platform]
- setuptools # [build_platform != target_platform]
- libffi # [build_platform != target_platfrom]
- libintl-devel # [(build_platform != target_platform) and (not linux)]
- zlib # [build_platform != target_platfrom]
- pcre2 # [build_platform != target_platfrom]
- libiconv # [build_platform != target_platfrom]
host:
- python >={{ minimum_python_version }}
- setuptools
- libffi
- libintl-devel # [not linux]
- zlib
- pcre2
- libiconv
run:
- python >=2.7
- python >={{ minimum_python_version }}

outputs:
- name: libglib
Expand All @@ -79,9 +88,9 @@ outputs:
- {{ stdlib("c") }}
- {{ compiler('cxx') }}
- ninja
- python >=2.7
- python >={{ minimum_python_version }}
- packaging
- setuptools <=71
- setuptools
host:
- libffi
- libintl-devel # [not linux]
Expand Down Expand Up @@ -125,9 +134,9 @@ outputs:
- {{ stdlib("c") }}
- {{ compiler('cxx') }}
- ninja
- python >=2.7
- python >={{ minimum_python_version }}
- packaging
- setuptools <=71
- setuptools
host:
- {{ pin_subpackage("libglib", exact=True) }}
- libintl-devel # [not linux]
Expand All @@ -151,6 +160,8 @@ outputs:
ignore_run_exports_from:
- python *
- {{ compiler('cxx') }} # [unix]
- {{ compiler('c') }} # [unix]
- {{ stdlib('c') }} # [unix]
- libiconv
- pcre2
- zlib
Expand All @@ -173,7 +184,7 @@ outputs:
- ninja
- python >=2.7
- packaging
- setuptools <=71
- setuptools
host:
- {{ pin_subpackage("libglib", exact=True) }}
- {{ pin_subpackage("glib-tools", exact=True) }}
Expand Down Expand Up @@ -205,6 +216,12 @@ outputs:
- test -f ${PREFIX}/lib/libglib-2.0${SHLIB_EXT} # [unix]
- glib-compile-resources --help
- gobject-query --help
# hmaarrfk - 2024/10 -- The PREFIX may end up becoming "/usr/bin/env python"
# due to the way that conda handles very long shebang lines
# https://github.com/conda-forge/glib-feedstock/pull/192#discussion_r1786546999
- head -n 1 ${PREFIX}/bin/glib-mkenums | grep -E "^\#!(${PREFIX}|/usr/bin/env python)" # [unix]
- head -n 1 ${PREFIX}/bin/glib-genmarshal | grep -E "^\#!(${PREFIX}|/usr/bin/env python)" # [unix]
- head -n 1 ${PREFIX}/bin/gtester-report | grep -E "^\#!(${PREFIX}|/usr/bin/env python)" # [unix]
hmaarrfk marked this conversation as resolved.
Show resolved Hide resolved
- gtester --help # [not win]
- gdbus-codegen --help # [not win]
- ${CC} ${LDFLAGS} ${CFLAGS} test.c $(pkg-config --cflags --libs glib-2.0) -o test-glib && ./test-glib # [unix]
Expand Down
Loading