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

Add org.freedesktop.Sdk.Extension.wxwidgets #3077

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/WebKitGTKApp.yaml
@@ -0,0 +1,21 @@
# this example application shows how to install webkitgtk without wxwidgets
app-id: org.webkitgtk.WebKitGTKApp
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: /usr/bin/bash
base-version: '22.08'
modules:
- name: webkitgtk
buildsystem: simple
# the debug extension can become quite large when webkitgtk's debug symbols are added,
# when https://github.com/flatpak/flatpak-builder/issues/358 wiil be fixed, it would be possible to strip symbols
# only from webkitgtk's libs
#build-options:
# strip: true
build-commands:
- /usr/lib/sdk/wxwidgets/install-webkitgtk.sh
- name: WebKitGTKApp
buildsystem: simple
build-commands:
- echo 'Doing nothing!'
32 changes: 32 additions & 0 deletions examples/wxWebViewApp.yaml
@@ -0,0 +1,32 @@
# this example application shows how to install wxwidgets with webkitgtk (with wxwebview)
app-id: org.wxwidgets.wxWebViewApp
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: /usr/bin/bash
base-version: '22.08'
modules:
- name: wxwebview
buildsystem: simple
build-commands:
- /usr/lib/sdk/wxwidgets/install.sh

# the debug extension can become quite large when webkitgtk's debug symbols are added,
# when https://github.com/flatpak/flatpak-builder/issues/358 wiil be fixed, it would be possible to strip symbols
# only from webkitgtk's libs by installing wxwidgets and webkitgtk with separate modules
# - name: wxwidgets
# buildsystem: simple
# build-commands:
# - /usr/lib/sdk/wxwidgets/install-wxwidgets.sh
# - name: webkitgtk
# buildsystem: simple
# build-options:
# # remove webkitgtk's debug symbols
# strip: true
# build-commands:
# - /usr/lib/sdk/wxwidgets/install-webkitgtk.sh

- name: wxWebViewApp
buildsystem: simple
build-commands:
- echo 'Doing nothing!'
16 changes: 16 additions & 0 deletions examples/wxWidgetsApp.yaml
@@ -0,0 +1,16 @@
# this example application shows how to install wxwidgets without webkitgtk (no wxwebview)
app-id: org.wxwidgets.wxWidgetsApp
runtime: org.freedesktop.Platform
runtime-version: '22.08'
sdk: org.freedesktop.Sdk
command: /usr/bin/bash
base-version: '22.08'
modules:
- name: wxwidgets
buildsystem: simple
build-commands:
- /usr/lib/sdk/wxwidgets/install-wxwidgets.sh
- name: wxWidgetsApp
buildsystem: simple
build-commands:
- echo 'Doing nothing!'
6 changes: 6 additions & 0 deletions flathub.json
@@ -0,0 +1,6 @@
{
"automerge-flathubbot-prs": false,
"require-important-update": true,
"skip-appstream-check": true,
"skip-icons-check": true
}
276 changes: 276 additions & 0 deletions install.sh
@@ -0,0 +1,276 @@
#!/bin/bash

set -e
shopt -s extglob
unset {COMMON,WEBKITGTK,WXWIDGETS}_{ENABLED,GI_TYPELIBS,INSTALLED,LIBS,LOCALES} WEBKITGTK_APIVER WXWIDGETS_VER{,_STABLE}
SDK_PATH=/usr/lib/sdk/wxwidgets

COMMON_LIBS=(
libnotify
libsecret
)
WXWIDGETS_LIBS=(
libGLU
libwx_
)
WXWEBVIEW_LIBS=(
libwx_gtk3u_webview
)
WEBKITGTK_LIBS=(
libenchant
libevdev
libgudev
libjavascriptcoregtk
libmanette
libwebkit2gtk
libwoff2common
libwoff2dec
libwoff2enc
libwpe
libWPEBackend-fdo
)
COMMON_GI_TYPELIBS=(
Notify
Secret
)
WEBKITGTK_GI_TYPELIBS=(
GUdev
JavaScriptCore
Manette
WebKit
WebKit2WebExtension
)
COMMON_LOCALES=(
libsecret
)
WXWIDGETS_LOCALES=(
wxstd
)
WEBKITGTK_LOCALES=(
WebKit2GTK
)

install_locale() {
locfile=$1
cd ${SDK_PATH}
for f in share/locale/*/LC_MESSAGES/${locfile}; do
install -vDm644 ${f} ${FLATPAK_DEST}/${f}
done
}

is_in_array() {
# 1: array, 2: filename
local -a 'array=("${'"$1"'[@]}")'
for e in "${array[@]}"; do
[[ $2 =~ $e ]] && return 0
done
return 1
}

install_lib() {
local f="$1"
local fn="$(basename $f)"
local libn="$(basename ${f%%+(.[0-9])})"
if [ -z "$fn" ] || [ -z "$libn" ]; then
echo "Something is wrong! Could not parse filename: $f"
exit 1
fi

install -vDm644 $f ${FLATPAK_DEST}/${f}

# create symlinks
for syml in $(find lib/ -maxdepth 1 -type l -name ${libn}'*'); do
if [ "$syml" = '*' ]; then
echo 'Something is wrong! Symlink filename is *'
exit 1
fi
echo $syml
symlt=$(basename $(readlink $syml))
ln -vs ${symlt} ${FLATPAK_DEST}/${syml}
done
}


cd ${SDK_PATH}

if WXWIDGETS_VER=$(${SDK_PATH}/bin/wx-config --version 2>/dev/null); then
echo -e "\nwxWidgets version: $WXWIDGETS_VER\n"
WXWIDGETS_VER_STABLE="${WXWIDGETS_VER%.*}"
if [ -n "$WXWIDGETS_VER_STABLE" ]; then
echo -e "\nwxWidgets stable version: $WXWIDGETS_VER_STABLE\n"
else
echo -e "\nFailed detecting wxWidgets major version!\n"
exit 1
fi
else
echo -e "\nFailed detecting wxWidgets version!\n"
exit 1
fi

WEBKITGTK_APIVER="$(find lib/ -maxdepth 1 -name 'libwebkit2gtk-*.so' -exec basename '{}' \; | sed 's/libwebkit2gtk-\(.*\)\.so/\1/' )"
if [ -n "$WEBKITGTK_APIVER" ]; then
echo -e "\nWebKitGTK API version: $WEBKITGTK_APIVER\n"
else
echo "Failed detecting WebKitGTK API version!"
exit 1
fi

# handle cases where both install-webkitgtk.sh and install-wxwidgets.sh were used instead of install.sh
if [ -e "${FLATPAK_DEST}/lib/libwebkit2gtk-${WEBKITGTK_APIVER}.so" ]; then
WEBKITGTK_INSTALLED=1
COMMON_INSTALLED=1
fi

if [ ! -e "lib/libwx_baseu-${WXWIDGETS_VER_STABLE}.so" ]; then
echo "WxWidgets detection test is outdated!"
exit 1
fi

if [ -e "${FLATPAK_DEST}/lib/libwx_baseu-${WXWIDGETS_VER_STABLE}.so" ]; then
WXWIDGETS_INSTALLED=1
COMMON_INSTALLED=1
fi

EXEC=$(basename $0)
case $EXEC in
install-webkitgtk.sh)
WEBKITGTK_ENABLED=1
;;
install-wxwidgets.sh)
WXWIDGETS_ENABLED=1
;;
*)
WEBKITGTK_ENABLED=1
WXWIDGETS_ENABLED=1
;;
esac

# ${SDK_PATH}/lib
echo -e "\nInstalling shared libraries...\n"
for f in $(find lib/ -maxdepth 1 -type f); do
fn="$(basename $f)"
if [ -z "$fn" ]; then
echo "Something is wrong! Could not parse filename: $f"
exit 1
fi

if is_in_array COMMON_LIBS ${fn}; then
if [ -z "$COMMON_INSTALLED" ]; then
install_lib $f
fi
elif is_in_array WXWIDGETS_LIBS ${fn}; then
# testing also if wxwidgets already installed, and then only add wxwebview
if [ -n "$WXWIDGETS_ENABLED" ] || [ -n "$WXWIDGETS_INSTALLED" ]; then
if [[ ${fn} =~ libwx_gtk3u_webview ]]; then
if [ -n "$WEBKITGTK_ENABLED" ] || [ -n "$WEBKITGTK_INSTALLED" ]; then
install_lib $f
fi
# install everything but wxwebview if wxwidgets is enabled
elif [ -n "$WXWIDGETS_ENABLED" ]; then
install_lib $f
fi
fi
elif is_in_array WEBKITGTK_LIBS ${fn}; then
if [ -n "$WEBKITGTK_ENABLED" ]; then
install_lib $f
fi
else
echo "Unknown library ${fn}"
exit 1
fi
done


# ${SDK_PATH}/lib/girepository*/
echo -e "\nInstalling GObject Introspection's typelibs...\n"

for f in $(find lib/girepository*/ -type f); do
fn="$(basename $f)"
if [ -z "$fn" ]; then
echo "Something is wrong! Could not parse filename: $f"
exit 1
fi

if is_in_array COMMON_GI_TYPELIBS ${fn}; then
if [ -z "$COMMON_INSTALLED" ]; then
install -vDm644 $f ${FLATPAK_DEST}/${f}
fi
elif is_in_array WEBKITGTK_GI_TYPELIBS ${fn}; then
if [ -n "$WEBKITGTK_ENABLED" ]; then
install -vDm644 $f ${FLATPAK_DEST}/${f}
fi
else
echo "Unknown typelib ${fn}"
exit 1
fi
done


# types: runtime: lib/webkit, lib/wx/ver share/locale
if [ -n "${WEBKITGTK_ENABLED}" ];then

# ${SDK_PATH}/lib/webkit2gtk*/
echo -e "\nInstalling WebKitGTK injected bundle client...\n"
for f in $(find lib/webkit2gtk*/injected-bundle -type f); do
install -vDm644 $f ${FLATPAK_DEST}/${f}
done

# ${SDK_PATH}/libexec/webkit2gtk*/
echo -e "\nInstalling WebKitGTK executables...\n"
for f in $(find libexec/webkit2gtk*/ -type f); do
install -vDm755 $f ${FLATPAK_DEST}/${f}
done

# ${SDK_PATH}/lib/enchant*/
echo -e "\nInstalling Enchant spell-checkers...\n"
for f in $(find lib/enchant*/ -type f); do
install -vDm644 $f ${FLATPAK_DEST}/${f}
done

# ${SDK_PATH}/share/enchant/
echo -e "\nInstalling Enchant ordering file\n"
for f in $(find share/enchant*/ -type f); do
install -vDm644 $f ${FLATPAK_DEST}/${f}
done
fi


# ${SDK_PATH}/lib/wx/wxver/web-extensions/webkit2_extu-*.so
if { [ -n "${WEBKITGTK_ENABLED}" ] && [ -n "${WXWIDGETS_ENABLED}" ]; } ||
{ [ -n "${WEBKITGTK_ENABLED}" ] && [ -n "${WXWIDGETS_INSTALLED}" ]; } ||
{ [ -n "${WEBKITGTK_INSTALLED}" ] && [ -n "${WXWIDGETS_ENABLED}" ]; }; then

echo -e "\n\Installing wxWebView web extension...\n"
for f in $(find lib/wx/${WXWIDGETS_VER}/web-extensions/ -type f); do
install -vDm644 $f ${FLATPAK_DEST}/${f}
done
fi


# ${SDK_PATH}/share/locale
echo -e "\nInstalling locales...\n"

for f in $(find share/locale/ -type f -name '*.mo'); do
fn="$(basename $f)"
if [ -z "$fn" ]; then
echo "Something is wrong! Could not parse filename: $f"
exit 1
fi

if is_in_array COMMON_LOCALES ${fn}; then
if [ -z "$COMMON_INSTALLED" ]; then
install -vDm644 $f ${FLATPAK_DEST}/${f}
fi
elif is_in_array WXWIDGETS_LOCALES ${fn}; then
if [ -n "$WXWIDGETS_ENABLED" ]; then
install -vDm644 $f ${FLATPAK_DEST}/${f}
fi
elif is_in_array WEBKITGTK_LOCALES ${fn}; then
if [ -n "$WEBKITGTK_ENABLED" ]; then
install -vDm644 $f ${FLATPAK_DEST}/${f}
fi
else
echo "Unknown locale ${fn}"
exit 1
fi
done
13 changes: 13 additions & 0 deletions org.freedesktop.Sdk.Extension.wxwidgets.metainfo.xml
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="runtime">
<id>org.freedesktop.Sdk.Extension.wxwidgets</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>LGPL-2.1-or-later WITH WxWindows-exception-3.1</project_license>
<name>WxWidgets Sdk extension</name>
<summary>Cross-Platform GUI Library</summary>
<url type="homepage">https://www.wxwidgets.org/</url>
<releases>
<release version="3.2.1" date="2022-09-08"/>
<release version="3.2.0" date="2022-07-07"/>
</releases>
</component>