Skip to content

Commit

Permalink
Merge branch 'develop' into macos
Browse files Browse the repository at this point in the history
  • Loading branch information
PerryWerneck committed Jan 1, 2024
2 parents e814e0c + 5dac243 commit 9fb7175
Show file tree
Hide file tree
Showing 10 changed files with 213 additions and 173 deletions.
3 changes: 2 additions & 1 deletion src/main/windows/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
return path;
}

g_free(path);
g_message("Cant find path for '%s'",path);
g_free(path);

return NULL;

}
Expand Down
22 changes: 20 additions & 2 deletions src/objects/application/application.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,27 @@ static void pw3270Application_init(pw3270Application *app) {
g_settings_bind(app->settings, "ui-style", app, "ui-style", G_SETTINGS_BIND_DEFAULT);
}

// Load plugin from default paths.
{
lib3270_autoptr(char) plugin_path = lib3270_build_data_filename("plugins",NULL);
pw3270_load_plugins_from_path(app, plugin_path);
const char *paths[] = {
"plugins",
G_STRINGIFY(PRODUCT_NAME) "-plugins",
"lib\\plugins",
"lib\\" G_STRINGIFY(PRODUCT_NAME) "-plugins",
};
size_t ix;

g_autofree gchar * install = g_win32_get_package_installation_directory_of_module(NULL);

for(ix = 0; ix < G_N_ELEMENTS(paths);ix++) {
g_autofree gchar * path = g_build_filename(install,paths[ix],NULL);
g_message("Checking '%s' for plugin files",path);
if(g_file_test(path,G_FILE_TEST_IS_DIR)) {
pw3270_load_plugins_from_path(app, path);
break;
}
}

}

#elif defined(__APPLE__)
Expand Down
4 changes: 4 additions & 0 deletions src/objects/application/plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ void pw3270_load_plugins_from_path(pw3270Application *app, const char *path) {

}

} else {

g_warning("Can't load plugins from %s: %s",path,"Invalid path");

}

}
6 changes: 3 additions & 3 deletions src/objects/settings/gsettings.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,13 @@
schema_id,
TRUE);

g_message("Loading '%s'",names[ix]);
// g_message("Loading '%s'",names[ix]);
settings = g_settings_new_full(schema, NULL, NULL);

g_settings_schema_source_unref(source);

if(settings) {
g_message("Got gsettings from %s",names[ix]);
// g_message("Got gsettings from %s",names[ix]);
return settings;
}

Expand Down Expand Up @@ -157,7 +157,7 @@

GSettings * pw3270_application_settings_new() {
return settings_new(G_STRINGIFY(PRODUCT_ID));
}
}

GSettings * pw3270_application_window_settings_new() {
return settings_new(G_STRINGIFY(PRODUCT_ID) ".window");
Expand Down
154 changes: 38 additions & 116 deletions win/bundle.common
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

#
# References:
#
# https://www.gtk.org/docs/installations/windows/
# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
#

# Check command-line arguments
argument() {

Expand Down Expand Up @@ -52,7 +45,10 @@ if [ "$?" == "0" ]; then
echo ""
echo " --help Help options (this screen)"
echo " --zip Build zipfile"
echo " --nsi Build nsi installer"

if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then
echo " --nsi Build nsi installer"
fi
echo " --upload Upload bundle to github"
fi

Expand Down Expand Up @@ -90,11 +86,6 @@ if [ -z ${PACKAGE_VERSION} ]; then
exit -1
fi

GTK_PREFIX=$(${PKG_CONFIG} --variable=prefix gtk+-3.0)
GTK_BINARY_VERSION=$(${PKG_CONFIG} --variable=gtk_binary_version gtk+-3.0)
GTK_LIBDIR=$(echo $(${PKG_CONFIG} --variable=libdir gtk+-3.0) | sed "s@^C:/@/c/@g")
GDK_LOADERS=$(echo $(${PKG_CONFIG} --variable=gdk_pixbuf_binarydir gdk-pixbuf-2.0) | sed -e "s@${GTK_PREFIX}@@g")

mkdir -p .bin/bundle
if [ "$?" != "0" ]; then
echo "Cant mkdir base buildroot"
Expand Down Expand Up @@ -304,98 +295,6 @@ install_locale() {
rm -f ${FILENAMES}
}

install_schemas() {

mkdir -p ${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas

schemas="
org.gtk.Settings.FileChooser.gschema.xml
gschema.dtd
"

for schema in ${schemas}
do
cp -v "${MINGW_PREFIX}/share/glib-2.0/schemas/${schema}" "${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"
if [ "$?" != "0" ]; then
exit -1
fi
done

glib-compile-schemas \
--targetdir="${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas" \
"${buildroot}${MINGW_PREFIX}/share/glib-2.0/schemas"

if [ "$?" != "0" ]; then
exit -1
fi
}

install_theme() {

mkdir -p "${buildroot}${MINGW_PREFIX}/etc"
cp -rv "${MINGW_PREFIX}/etc/gtk-3.0" "${buildroot}${MINGW_PREFIX}/etc"
if [ "$?" != "0" ]; then
exit -1
fi

# https://stackoverflow.com/questions/37035936/how-to-get-native-windows-decorations-on-gtk3-on-windows-7-and-msys2
mkdir -p ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0
rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
rm -f ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/gtkrc

echo "[Settings]" > ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini
echo "gtk-theme-name=${1}" >> ${buildroot}${MINGW_PREFIX}/etc/gtk-3.0/settings.ini

if [ -e "${srcdir}/win/gtk.css" ]; then
mkdir -p "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0"
cp "${srcdir}/win/gtk.css" "${buildroot}${MINGW_PREFIX}/share/themes/Default/gtk-3.0/gtk.css"
fi

}

install_icons() {

mkdir -p "${buildroot}${MINGW_PREFIX}/share/icons"

if [ -d "${MINGW_PREFIX}/share/icons/${1}" ]; then

cp -rv "${MINGW_PREFIX}/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
if [ "$?" != 0 ]; then
echo "Can´t copy ${1} icons"
exit -1
fi

elif [ -d "/usr/share/icons/${1}" ]; then

cp -rv "/usr/share/icons/${1}" "${buildroot}${MINGW_PREFIX}/share/icons"
if [ "$?" != 0 ]; then
echo "Can´t copy ${1} icons"
exit -1
fi

else

echo "Can´t find ${1} icons"
exit -1

fi

}

install_loaders() {

if [ -d "${MINGW_PREFIX}${GDK_LOADERS}" ]; then
mkdir -p "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
cp -rv ${MINGW_PREFIX}${GDK_LOADERS}/* "${buildroot}/${MINGW_PREFIX}${GDK_LOADERS}"
if [ "$?" != "0" ]; then
exit -1
fi

find ${buildroot}/${MINGW_PREFIX}${GDK_LOADERS} -iname "*.a" -exec rm -f {} \;

fi

}

make_zip() {

Expand Down Expand Up @@ -433,6 +332,7 @@ make_nsis() {
-DWITHIPC \
-DWITHPLUGINS \
-DWITHSDK \
-DPKGDIR=${buildroot}${MINGW_PREFIX} \
${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi
if [ "$?" != "0" ]; then
echo "Cant build nsis script"
Expand All @@ -456,25 +356,47 @@ make_nsis() {
fi
}

install_runtime() {
install_license() {
mkdir -p "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
cp "${srcdir}/LICENSE" "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
if [ "$?" != "0" ]; then
echo "Cant copy LICENSE"
exit -1
fi
}

install_loaders
install_runtime() {
install_bin
install_locale
install_schemas
install_theme "Adwaita"
install_icons "Adwaita"

}

make_packages() {
build_package() {

mkdir -p "${buildroot}${MINGW_PREFIX}/nsi"
cp "${srcdir}/win/pw3270.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi"
# Build
make -C "${srcdir}" all
if [ "$?" != "0" ]; then
echo "Cant copy nsis script"
fi
echo "Build failed"
exit -1
fi

make -C "${srcdir}" "DESTDIR=${buildroot}" install
if [ "$?" != "0" ]; then
echo "Install failed"
exit -1
fi

}

make_packages() {

if [ -e "${srcdir}/win/${PACKAGE_NAME}.nsi" ]; then
mkdir -p "${buildroot}${MINGW_PREFIX}/nsi"
cp "${srcdir}/win/${PACKAGE_NAME}.nsi" "${buildroot}${MINGW_PREFIX}/${PACKAGE_NAME}.nsi"
if [ "$?" != "0" ]; then
echo "Cant copy nsis script"
fi
fi

argument "zip" > /dev/null
if [ "$?" == "0" ]; then
make_zip
Expand Down
37 changes: 2 additions & 35 deletions win/bundle.cross
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,13 @@
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

#
# References:
#
# https://www.gtk.org/docs/installations/windows/
# http://drup.org/gtk-warning-error-loading-icon-couldnt-recognize-image-file-format
#

MINGW_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw"
PKG_CONFIG="/usr/bin/x86_64-w64-mingw32-pkg-config"
MINGW_PACKAGE_PREFIX="mingw64"
REPOSITORY_NAME="pw3270"

# Load bundle functions
. "$(dirname $(readlink -f "${0}"))/bundle.common"
. "$(dirname $(readlink -f "${0}"))/bundle.gtk3"

argument "help" > /dev/null
if [ "$?" == "0" ]; then
Expand Down Expand Up @@ -83,23 +76,6 @@ install_prereqs() {
done
}

build_package() {

# Build
make -C "${srcdir}" all
if [ "$?" != "0" ]; then
echo "Build failed"
exit -1
fi

make -C "${srcdir}" "DESTDIR=${buildroot}" install
if [ "$?" != "0" ]; then
echo "Install failed"
exit -1
fi

}

argument "install-requires" > /dev/null
if [ "$?" == "0" ]; then
install_prereqs
Expand Down Expand Up @@ -193,18 +169,9 @@ unpack_rpm() {

}

install_license() {
mkdir -p "${buildroot}${MINGW_PREFIX}/usr/share/${PACKAGE_NAME}"
cp "${srcdir}/LICENSE" "${buildroot}${MINGW_PREFIX}/share/${PACKAGE_NAME}"
if [ "$?" != "0" ]; then
echo "Cant copy LICENSE"
exit -1
fi
}

unpack_rpm

install_runtime
install_gtk3_runtime
install_license

make_packages
Expand Down
Loading

0 comments on commit 9fb7175

Please sign in to comment.