Flatpak seems to be working! Now to fix all the memory issues.

This commit is contained in:
Scott Duensing 2022-12-14 20:35:36 -06:00
parent 50fc235ea6
commit b1aa9fa490
12 changed files with 168 additions and 68 deletions

2
.gitignore vendored
View file

@ -6,6 +6,8 @@ thirdparty/lexilla/
ui/generated/ ui/generated/
cmake-build-debug/ cmake-build-debug/
flatpak-build/ flatpak-build/
flatpak-repo/
crapForLater/ crapForLater/
*~ *~
joeydev.flatpak

View file

@ -21,7 +21,16 @@
cmake_minimum_required(VERSION 3.22) cmake_minimum_required(VERSION 3.22)
project(joeydev C)
project(joeydev LANGUAGES C VERSION 1.0)
# There are also version numbers in:
# com.kangaroopunch.JoeyDev.appdata.xml
# com.kangaroopunch.JoeyDev.desktop
# Default to ON for developing the app. buildFlatpak.sh turns this off for us.
option(DEBUG_OUTPUT "Enable debugging output and memory tracing?" ON)
set(CMAKE_C_STANDARD 99) set(CMAKE_C_STANDARD 99)
@ -39,6 +48,8 @@ set(SOURCE_FILES
src/color.c src/color.c
) )
configure_file(include/config.h.in config.h)
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES}) add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
# Perform pre-build operations. # Perform pre-build operations.
@ -62,8 +73,10 @@ execute_process(COMMAND pkg-config --libs gtk+-3.0
) )
string(STRIP ${OUT_TMP_VAR} GTK3_LIBRARIES) string(STRIP ${OUT_TMP_VAR} GTK3_LIBRARIES)
# Compile Options. # Compile Options.
include_directories( include_directories(
${PROJECT_BINARY_DIR}
include include
ui/generated ui/generated
thirdparty/scintilla/include thirdparty/scintilla/include
@ -74,7 +87,7 @@ include_directories(
add_definitions( add_definitions(
-Wall -Wall
-Wno-unknown-pragmas -Wno-unknown-pragmas
-O0 -O2
${GTK3_CFLAGS} ${GTK3_CFLAGS}
) )

View file

@ -3,6 +3,9 @@
flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08 flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08
[[ -d .flatpak-builder ]] && rm -rf .flatpak-builder [[ -d .flatpak-builder ]] && rm -rf .flatpak-builder
[[ -d flatpak-build ]] && rm -rf flatpak-build [[ -d flatpak-build ]] && rm -rf flatpak-build
[[ -d flatpak-repo ]] && rm -rf flatpak-repo
[[ -f joeydev.flatpak ]] && rm -f joeydev.flatpak
flatpak-builder -v --user --install flatpak-build com.kangaroopunch.JoeyDev.yaml flatpak-builder -v --user --keep-build-dirs --gpg-sign=336B3B1987C3D17F --repo=flatpak-repo --install flatpak-build com.kangaroopunch.JoeyDev.yaml
flatpak build-bundle flatpak-repo joeydev.flatpak com.kangaroopunch.JoeyDev --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo

View file

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>com.kangaroopunch.JoeyDev</id>
<name>JoeyDev</name>
<summary>A free, open source, development environment for building JoeyLib based software.</summary>
<developer_name>Scott Duensing</developer_name>
<update_contact>scott_AT_kangaroopunch.com</update_contact>
<metadata_license>MIT</metadata_license>
<project_license>AGPL-3.0-only</project_license>
<url type="homepage">https://joeylib.com/</url>
<!-- url type="donation">https://joplinapp.org/donate/</url -->
<url type="faq">https://skunkworks.kangaroopunch.com/skunkworks/joeydev/-/wikis/FAQ</url>
<description>
<p>
Long description goes here.
</p>
</description>
<launchable type="desktop-id">com.kangaroopunch.JoeyDev.desktop</launchable>
<!-- screenshots>
<screenshot type="default">
<image>https://joplinapp.org/images/home-top-img.png</image>
<caption>The options dialog</caption>
</screenshot>
<screenshot><image>https://joplinapp.org/images/multimedia-notes-img.png</image></screenshot>
<screenshot><image>https://joplinapp.org/images/save-web-img.png</image></screenshot>
</screenshots -->
<releases>
<!-- Date is YYYY-MM-DD -->
<release version="1.0" date="2022-12-14">
<description>
<p>Initial Flatpak for testing.</p>
</description>
</release>
</releases>
</component>

View file

@ -1,9 +1,11 @@
[Desktop Entry] [Desktop Entry]
Version=0.1 Version=1.0
Type=Application Type=Application
Name=JoeyDev Name=JoeyDev
Comment=A Development Tool for JoeyLib Comment=A free, open source, development environment for building JoeyLib based software.
Categories=Programming; Categories=Development;Building;
Icon=com.kangaroopunch.JoeyDev
Exec=joeydev Exec=joeydev
Terminal=false Terminal=false
Icon=com.kangaroopunch.JoeyDev

View file

@ -8,38 +8,65 @@ command: joeydev
modules: modules:
- name: joeydev - name: joeydev
buildsystem: cmake-ninja
buildsystem: simple
build-commands:
- tools/prebuild.sh $(pwd)
- cmake -DDEBUG_OUTPUT=OFF -G Ninja
- ninja
- install -D joeydev /app/bin/joeydev
- install -Dm755 com.kangaroopunch.JoeyDev.desktop -t /app/share/applications
- install -Dm644 com.kangaroopunch.JoeyDev.png /app/share/icons/hicolor/128x128/apps/com.kangaroopunch.JoeyDev.png
- install -Dm644 com.kangaroopunch.JoeyDev.appdata.xml -t /app/share/metainfo
sources: sources:
- type: dir - type: dir
path: include path: include
dest: include dest: include
- type: dir - type: dir
path: src path: src
dest: src dest: src
- type: dir
path: thirdparty
dest: thirdparty
- type: dir - type: dir
path: ui path: ui
dest: ui dest: ui
- type: dir - type: dir
path: tools path: tools
dest: tools dest: tools
- type: dir
path: thirdparty/memwatch
dest: thirdparty/memwatch
- type: file - type: file
path: buildDeps.sh path: thirdparty/stb_ds.h
dest: thirdparty/
- type: file
path: thirdparty/stb_image.h
dest: thirdparty/
- type: file
path: thirdparty/scintilla531.tgz
dest: thirdparty/
- type: file
path: thirdparty/lexilla520.tgz
dest: thirdparty/
- type: file - type: file
path: CMakeLists.txt path: CMakeLists.txt
- name: desktop
buildsystem: simple
build-commands:
- install -Dm755 com.kangaroopunch.JoeyDev.desktop -t /app/share/applications
- install -Dm644 icon.png /app/share/icons/hicolor/128x128/com.kangaroopunch.JoeyDev.png
sources:
- type: file - type: file
path: com.kangaroopunch.JoeyDev.desktop path: com.kangaroopunch.JoeyDev.desktop
- type: file - type: file
path: icon.png path: com.kangaroopunch.JoeyDev.png
- type: file
path: com.kangaroopunch.JoeyDev.appdata.xml
finish-args: finish-args:
- --share=ipc - --share=ipc

View file

@ -24,14 +24,12 @@
#define COMMON_H #define COMMON_H
#define DEBUG // If we're debugging. #include "config.h"
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "array.h" #include "array.h"
#ifdef DEBUG #ifdef DEBUG_OUTPUT
#define debug(...) printf(__VA_ARGS__) #define debug(...) printf(__VA_ARGS__)
#define MEMWATCH #define MEMWATCH
#else #else

35
include/config.h.in Normal file
View file

@ -0,0 +1,35 @@
/*
* JoeyDev
* Copyright (C) 2018-2023 Scott Duensing <scott@kangaroopunch.com>
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef CONFIG_H_IN
#define CONFIG_H_IN
#define joeydev_VERSION_MAJOR @joeydev_VERSION_MAJOR@
#define joeydev_VERSION_MINOR @joeydev_VERSION_MINOR@
#define JOEYDEV_VERSION "@joeydev_VERSION_MAJOR@.@joeydev_VERSION_MINOR@"
#cmakedefine DEBUG_OUTPUT
#endif // CONFIG_H_IN

View file

@ -49,7 +49,7 @@ EVENT void toolJoeyDevAboutClicked(GtkWidget *object, gpointer userData) {
dialog = gtk_about_dialog_new(); dialog = gtk_about_dialog_new();
gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), "JoeyDev"); gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(dialog), "JoeyDev");
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), "0.1"); gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), JOEYDEV_VERSION);
gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"Copyright (C) 2018-2023 Scott Duensing"); gtk_about_dialog_set_copyright(GTK_ABOUT_DIALOG(dialog),"Copyright (C) 2018-2023 Scott Duensing");
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), "Development Environment for JoeyLib."); gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), "Development Environment for JoeyLib.");
gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), "https://JoeyLib.com"); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), "https://JoeyLib.com");

View file

@ -27,55 +27,32 @@ ROOT=$1
pushd "${ROOT}" || exit &> /dev/null pushd "${ROOT}" || exit &> /dev/null
if [[ ! -d thirdparty/scintilla ]]; then
pushd thirdparty || exit &> /dev/null
echo Building Dependency: Scintilla...
tar xzf scintilla531.tgz
pushd scintilla/gtk || exit &> /dev/null
GTK3=1 make
popd || true &> /dev/null
popd || true &> /dev/null
fi
if [[ ! -d thirdparty/lexilla ]]; then
pushd thirdparty || exit &> /dev/null
echo Building Dependency: Lexilla...
tar xzf lexilla520.tgz
pushd lexilla/src || exit &> /dev/null
make
popd || true &> /dev/null
popd || true &> /dev/null
fi
echo Generating UI Embedded Code... echo Generating UI Embedded Code...
mkdir -p ui/generated mkdir -p ui/generated
:<<'SKIP'
glib-compile-resources \
--sourcedir=ui/ \
--target=ui/generated/resources \
--generate \
ui/joeydev.gresource.xml
glib-compile-resources \
--sourcedir=ui/ \
--target=ui/generated/resources.h \
--generate-header \
ui/joeydev.gresource.xml
SKIP
glib-compile-resources \ glib-compile-resources \
--sourcedir=ui/ \ --sourcedir=ui/ \
--target=ui/generated/resources.c \ --target=ui/generated/resources.c \
--generate-source \ --generate-source \
ui/joeydev.gresource.xml ui/joeydev.gresource.xml
popd || true &> /dev/null popd || true &> /dev/null
:<<'OLD'
pushd "${ROOT}/tools" || exit &> /dev/null
echo Generating UI Headers...
rm -f ../ui/generated/*.h &> /dev/null || true
# We do this from the tools folder so the variable names get "__ui_" prepended to them.
for E in glade png; do
for F in ../ui/*."${E}"; do
I="${F}" # Input File.
R="${E}" # What extension to remove.
GUARD="${E^^}"_$(basename -s ."${R}" "${I}")_H
GUARD=${GUARD^^}
HEADER=../ui/generated/"${E}"$(basename -s ."${R}" "${I}").h
echo " ${HEADER}"
echo "#ifndef ${GUARD}" > "${HEADER}"
# shellcheck disable=SC2129
echo "#define ${GUARD}" >> "${HEADER}"
xxd -i "${I}" - >> "${HEADER}"
echo "#endif // ${GUARD}" >> "${HEADER}"
sed -i 's/unsigned char/char/' "${HEADER}"
done
done
popd || true &> /dev/null
OLD