Project

General

Profile

Feature #686 » 0078-meson-installer_build.sh-Support-building-from-a-sep.patch

Marko Lindqvist, 05/30/2024 02:16 AM

View differences:

platforms/windows/installer_cross/meson-installer_build.sh
mkdir -p $2/etc &&
cp -R $1/etc/gtk-3.0 $2/etc/ &&
cp $1/bin/gtk-update-icon-cache.exe $2/bin/ &&
cp ./helpers/installer-helper-gtk3.cmd $2/bin/installer-helper.cmd
cp "${SRC_DIR}/helpers/installer-helper-gtk3.cmd" $2/bin/installer-helper.cmd
}
add_gtk4_env() {
......
cp $1/bin/libtiff-6.dll $2/ &&
cp $1/bin/gdbus.exe $2/ &&
cp $1/bin/gtk4-update-icon-cache.exe $2/bin/ &&
cp ./helpers/installer-helper-gtk4.cmd $2/bin/installer-helper.cmd
cp "${SRC_DIR}/helpers/installer-helper-gtk4.cmd" $2/bin/installer-helper.cmd
}
add_qt6_env() {
......
cp $1/bin/Qt6Widgets.dll $2/ &&
cp $1/bin/libpcre2-16-0.dll $2/ &&
mkdir -p $2/bin &&
cp ./helpers/installer-helper-qt.cmd $2/bin/installer-helper.cmd
cp "${SRC_DIR}/helpers/installer-helper-qt.cmd" $2/bin/installer-helper.cmd
}
add_sdl2_env() {
......
DLLSPATH="$1"
GUI="$2"
case $GUI in
case ${GUI} in
gtk3.22)
GUINAME="GTK3.22"
MPGUI="gtk3"
......
exit 1
fi
if ! ./meson-winbuild.sh "$DLLSPATH" "$GUI" ; then
SRC_DIR="$(cd "$(dirname "$0")" || exit 1 ; pwd)"
SRC_ROOT="$(cd "${SRC_DIR}/../../.." || exit 1 ; pwd)"
BUILD_ROOT="$(pwd)"
if ! "${SRC_DIR}/meson-winbuild.sh" "${DLLSPATH}" "${GUI}" ; then
exit 1
fi
SETUP=$(grep "CrosserSetup=" $DLLSPATH/crosser.txt | sed -e 's/CrosserSetup="//' -e 's/"//')
SRC_ROOT="$(cd ../../.. || exit 1 ; pwd)"
VERREV="$("${SRC_ROOT}/fc_version")"
if ! ( cd "meson/build/${SETUP}-${GUI}" && ninja langstat_core.txt ) ; then
if ! ( cd "${BUILD_ROOT}/meson/build/${SETUP}-${GUI}" && ninja langstat_core.txt ) ; then
echo "langstat_core.txt creation failed!" >&2
exit 1
fi
if test "$GUI" = "ruledit" &&
! ( cd "meson/build/${SETUP}-${GUI}" && ninja langstat_ruledit.txt ) ; then
if test "${GUI}" = "ruledit" &&
! ( cd "${BUILD_ROOT}/meson/build/${SETUP}-${GUI}" && ninja langstat_ruledit.txt ) ; then
echo "langstat_ruledit.txt creation failed!" >&2
exit 1
fi
......
fi
fi
INSTDIR="meson/install/freeciv-${VERREV}-${SETUP}-${GUI}"
INSTDIR="${BUILD_ROOT}/meson/install/freeciv-${VERREV}-${SETUP}-${GUI}"
if ! mv $INSTDIR/bin/* $INSTDIR/ ||
! mv $INSTDIR/share/freeciv $INSTDIR/data ||
! mv $INSTDIR/share/doc $INSTDIR/ ||
! mkdir -p $INSTDIR/doc/freeciv/installer ||
! cat licenses/header.txt "${SRC_ROOT}/COPYING" \
if ! mv "${INSTDIR}/bin/"* "${INSTDIR}/" ||
! mv "${INSTDIR}/share/freeciv" "${INSTDIR}/data" ||
! mv "${INSTDIR}/share/doc" "${INSTDIR}/" ||
! mkdir -p "${INSTDIR}/doc/freeciv/installer" ||
! cat "${SRC_DIR}/licenses/header.txt" "${SRC_ROOT}/COPYING" \
> "${INSTDIR}/doc/freeciv/installer/COPYING.installer" ||
! rm -Rf $INSTDIR/lib ||
! cp Freeciv.url $INSTDIR/
! rm -Rf "${INSTDIR}/lib" ||
! cp "${SRC_DIR}/Freeciv.url" "${INSTDIR}/"
then
echo "Rearranging install directory failed!" >&2
exit 1
fi
if ! add_common_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_common_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying common environment failed!" >&2
exit 1
fi
NSI_DIR="meson/nsi"
NSI_DIR="${BUILD_ROOT}/meson/nsi"
if ! mkdir -p "$NSI_DIR" ; then
echo "Creating \"$NSI_DIR\" directory failed" >&2
if ! mkdir -p "${NSI_DIR}" ; then
echo "Creating \"${NSI_DIR}\" directory failed" >&2
exit 1
fi
if test "$GUI" = "ruledit" ; then
if ! cp freeciv-ruledit.cmd "${INSTDIR}/"
if test "${GUI}" = "ruledit" ; then
if ! cp "${SRC_DIR}/freeciv-ruledit.cmd" "${INSTDIR}/"
then
echo "Adding cmd-file failed!" >&2
exit 1
......
NSI_FILE="${NSI_DIR}/ruledit-${SETUP}-${VERREV}.nsi"
if ! ./create-freeciv-ruledit-nsi.sh \
"${INSTDIR}" "meson/output" "${VERREV}" "qt6" "Qt6" "${SETUP}" \
if ! "${SRC_DIR}/create-freeciv-ruledit-nsi.sh" \
"${INSTDIR}" "${BUILD_ROOT}/meson/output" "${VERREV}" "qt6" "Qt6" "${SETUP}" \
> "${NSI_FILE}"
then
exit 1
fi
else
if ! cp freeciv-server.cmd freeciv-${CLIENT}.cmd freeciv-mp-${FCMP}.cmd $INSTDIR/
if ! cp "${SRC_DIR}/freeciv-server.cmd" "${SRC_DIR}/freeciv-${CLIENT}.cmd" \
"${SRC_DIR}/freeciv-mp-${FCMP}.cmd" "${INSTDIR}/"
then
echo "Adding cmd-files failed!" >&2
exit 1
fi
if ! add_sdl2_mixer_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_sdl2_mixer_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying SDL2_mixer environment failed!" >&2
exit 1
fi
case $GUI in
case ${GUI} in
gtk3.22)
if ! add_gtk3_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_gtk3_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying gtk3 environment failed!" >&2
exit 1
fi
;;
gtk4|gtk4x)
if ! add_gtk4_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_gtk4_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying gtk4 environment failed!" >&2
exit 1
fi
;;
sdl2)
# For gtk4 modpack installer
if ! add_gtk4_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_gtk4_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying gtk3 environment failed!" >&2
exit 1
fi
if ! add_sdl2_env "$DLLSPATH" "$INSTDIR" ; then
if ! add_sdl2_env "${DLLSPATH}" "${INSTDIR}" ; then
echo "Copying sdl2 environment failed!" >&2
exit 1
fi
;;
qt6)
if ! cp freeciv-ruledit.cmd "${INSTDIR}"
if ! cp "${SRC_DIR}/freeciv-ruledit.cmd" "${INSTDIR}"
then
echo "Adding cmd-file failed!" >&2
exit 1
......
EXE_ID="${GUI}"
fi
if test "$GUI" = "gtk3.22" || test "$GUI" = "gtk4" ||
test "$GUI" = "gtk4x" || test "$GUI" = "sdl2" ; then
UNINSTALLER="helpers/uninstaller-helper-gtk3.sh"
if test "${GUI}" = "gtk3.22" || test "${GUI}" = "gtk4" ||
test "${GUI}" = "gtk4x" || test "${GUI}" = "sdl2" ; then
UNINSTALLER="${SRC_DIR}/helpers/uninstaller-helper-gtk3.sh"
else
UNINSTALLER=""
fi
NSI_FILE="${NSI_DIR}/client-${SETUP}-${VERREV}-${GUI}.nsi"
if test "$GUI" = "sdl2" ; then
if ! ./create-freeciv-sdl2-nsi.sh \
"$INSTDIR" "meson/output" "$VERREV" "$SETUP" "$UNINSTALLER" \
> "$NSI_FILE"
if test "${GUI}" = "sdl2" ; then
if ! "${SRC_DIR}/create-freeciv-sdl2-nsi.sh" \
"${INSTDIR}" "${BUILD_ROOT}/meson/output" "${VERREV}" "${SETUP}" "${UNINSTALLER}" \
> "${NSI_FILE}"
then
exit 1
fi
else
if ! ./create-freeciv-gtk-qt-nsi.sh \
"$INSTDIR" "meson/output" "$VERREV" "$GUI" "$GUINAME" \
"$SETUP" "$MPGUI" "$EXE_ID" "$UNINSTALLER" \
> "$NSI_FILE"
if ! "${SRC_DIR}/create-freeciv-gtk-qt-nsi.sh" \
"${INSTDIR}" "${BUILD_ROOT}/meson/output" "${VERREV}" "${GUI}" "${GUINAME}" \
"${SETUP}" "${MPGUI}" "${EXE_ID}" "${UNINSTALLER}" \
> "${NSI_FILE}"
then
exit 1
fi
fi
fi
if ! mkdir -p meson/output ; then
if ! mkdir -p "${BUILD_ROOT}/meson/output" ; then
echo "Creating meson/output directory failed" >&2
exit 1
fi
if ! makensis -NOCD "$NSI_FILE"
if ! makensis -NOCD "${NSI_FILE}"
then
echo "Creating installer failed!" >&2
exit 1
(1-1/2)