diff --git a/.gitignore b/.gitignore index 2fb0d2d..8c1c828 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ thirdparty/lexilla/ ui/generated/ cmake-build-debug/ flatpak-build/ +flatpak-repo/ crapForLater/ *~ +joeydev.flatpak diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c48993..fea59cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,16 @@ 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) @@ -39,6 +48,8 @@ set(SOURCE_FILES src/color.c ) +configure_file(include/config.h.in config.h) + add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES}) # Perform pre-build operations. @@ -62,8 +73,10 @@ execute_process(COMMAND pkg-config --libs gtk+-3.0 ) string(STRIP ${OUT_TMP_VAR} GTK3_LIBRARIES) + # Compile Options. include_directories( + ${PROJECT_BINARY_DIR} include ui/generated thirdparty/scintilla/include @@ -74,7 +87,7 @@ include_directories( add_definitions( -Wall -Wno-unknown-pragmas - -O0 + -O2 ${GTK3_CFLAGS} ) diff --git a/buildFlatpak.sh b/buildFlatpak.sh index f90e5c2..7a2b5ab 100755 --- a/buildFlatpak.sh +++ b/buildFlatpak.sh @@ -3,6 +3,9 @@ flatpak install flathub org.freedesktop.Platform//22.08 org.freedesktop.Sdk//22.08 [[ -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 diff --git a/com.kangaroopunch.JoeyDev.appdata.xml b/com.kangaroopunch.JoeyDev.appdata.xml new file mode 100644 index 0000000..0ee4206 --- /dev/null +++ b/com.kangaroopunch.JoeyDev.appdata.xml @@ -0,0 +1,43 @@ + + + com.kangaroopunch.JoeyDev + + JoeyDev + A free, open source, development environment for building JoeyLib based software. + Scott Duensing + scott_AT_kangaroopunch.com + + MIT + AGPL-3.0-only + + https://joeylib.com/ + + https://skunkworks.kangaroopunch.com/skunkworks/joeydev/-/wikis/FAQ + + + + Long description goes here. + + + + com.kangaroopunch.JoeyDev.desktop + + + + + + + + Initial Flatpak for testing. + + + + + diff --git a/com.kangaroopunch.JoeyDev.desktop b/com.kangaroopunch.JoeyDev.desktop index 18a8854..deb68aa 100644 --- a/com.kangaroopunch.JoeyDev.desktop +++ b/com.kangaroopunch.JoeyDev.desktop @@ -1,9 +1,11 @@ [Desktop Entry] -Version=0.1 +Version=1.0 Type=Application + Name=JoeyDev -Comment=A Development Tool for JoeyLib -Categories=Programming; +Comment=A free, open source, development environment for building JoeyLib based software. +Categories=Development;Building; + +Icon=com.kangaroopunch.JoeyDev Exec=joeydev Terminal=false -Icon=com.kangaroopunch.JoeyDev diff --git a/icon.png b/com.kangaroopunch.JoeyDev.png similarity index 100% rename from icon.png rename to com.kangaroopunch.JoeyDev.png diff --git a/com.kangaroopunch.JoeyDev.yaml b/com.kangaroopunch.JoeyDev.yaml index df1897e..09ef9a7 100644 --- a/com.kangaroopunch.JoeyDev.yaml +++ b/com.kangaroopunch.JoeyDev.yaml @@ -8,38 +8,65 @@ command: joeydev modules: - 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: - type: dir path: include dest: include + - type: dir path: src dest: src - - type: dir - path: thirdparty - dest: thirdparty + - type: dir path: ui dest: ui + - type: dir path: tools dest: tools + + - type: dir + path: thirdparty/memwatch + dest: thirdparty/memwatch + - 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 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 path: com.kangaroopunch.JoeyDev.desktop + - type: file - path: icon.png + path: com.kangaroopunch.JoeyDev.png + + - type: file + path: com.kangaroopunch.JoeyDev.appdata.xml finish-args: - --share=ipc diff --git a/src/color.h b/include/color.h similarity index 100% rename from src/color.h rename to include/color.h diff --git a/include/common.h b/include/common.h index ddcc20f..4977d04 100644 --- a/include/common.h +++ b/include/common.h @@ -24,14 +24,12 @@ #define COMMON_H -#define DEBUG // If we're debugging. - - +#include "config.h" #include #include "array.h" -#ifdef DEBUG +#ifdef DEBUG_OUTPUT #define debug(...) printf(__VA_ARGS__) #define MEMWATCH #else diff --git a/include/config.h.in b/include/config.h.in new file mode 100644 index 0000000..c62ba40 --- /dev/null +++ b/include/config.h.in @@ -0,0 +1,35 @@ +/* + * JoeyDev + * Copyright (C) 2018-2023 Scott Duensing + * + * 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 diff --git a/src/joeydev.c b/src/joeydev.c index e866364..9ea4055 100644 --- a/src/joeydev.c +++ b/src/joeydev.c @@ -49,7 +49,7 @@ EVENT void toolJoeyDevAboutClicked(GtkWidget *object, gpointer userData) { dialog = gtk_about_dialog_new(); 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_comments(GTK_ABOUT_DIALOG(dialog), "Development Environment for JoeyLib."); gtk_about_dialog_set_website(GTK_ABOUT_DIALOG(dialog), "https://JoeyLib.com"); diff --git a/tools/prebuild.sh b/tools/prebuild.sh index 2fc3dec..23f4a8f 100755 --- a/tools/prebuild.sh +++ b/tools/prebuild.sh @@ -27,55 +27,32 @@ ROOT=$1 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... 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 \ --sourcedir=ui/ \ --target=ui/generated/resources.c \ --generate-source \ ui/joeydev.gresource.xml - 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
+ Long description goes here. +
Initial Flatpak for testing.