meson_dist_script.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. GIT_VERSION_H="$1"
  3. # MESON_SOURCE_ROOT and MESON_BUILD_ROOT environment variables are
  4. # passed since meson 0.54.0 but we depend on 0.53.0 so I also pass them
  5. # as script arguments. When we bump out meson requirement, this test may
  6. # go away.
  7. if [ -z "$MESON_SOURCE_ROOT" ]; then
  8. MESON_SOURCE_ROOT="$2"
  9. fi
  10. if [ -z "$MESON_BUILD_ROOT" ]; then
  11. MESON_BUILD_ROOT="$3"
  12. fi
  13. # `meson dist` doesn't trigger a build, which is a problem because we
  14. # need to add some configured/built files. The case where we didn't
  15. # build at all is the less annoying (we'd get a failure, which is
  16. # actually acceptable as it warns us). But the case where we would copy
  17. # outdated data is much more insidious (such as wrong INSTALL
  18. # information or wrong git information) as it would be silent.
  19. # See: https://github.com/mesonbuild/meson/issues/10650
  20. # And: https://gitlab.gnome.org/GNOME/gimp/-/issues/7907
  21. # This is why we manually trigger, not only a reconfigure, but also a
  22. # rebuild of the main project before copying data around.
  23. # INSTALL file is generated at configure time.
  24. meson --reconfigure $MESON_SOURCE_ROOT
  25. # git-version.h is generated at build time.
  26. meson compile
  27. cp -f 'INSTALL' "${MESON_DIST_ROOT}"
  28. rm -f "${MESON_DIST_ROOT}/INSTALL.in"
  29. cp "$GIT_VERSION_H" "${MESON_DIST_ROOT}"