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

Flatpak #1401

Merged
merged 12 commits into from
Jan 31, 2025
Merged

Flatpak #1401

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ PolyGlot is a cross-platform [conlang](https://en.wikipedia.org/wiki/Constructed
For full user documentation, see: http://draquet.github.io/PolyGlot/readme.html or the readme file included in the docs section of this project.

## Installation
<a href="https://flathub.org/apps/details/io.github.DraqueT.PolyGlot"><img src="https://flathub.org/assets/badges/flathub-badge-en.png" width="300"/></a>

The latest release is tested on the following platforms:
- Windows 11 x86
- MacOS Apple Silicon
Expand Down
6 changes: 3 additions & 3 deletions build_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ def image():
sys.exit(1)

def dist(is_release : bool, target_type : Union[str, None]):
if os.path.exists('installer'):
shutil.rmtree('installer')

if osString == linString:
distLinux(is_release, target_type)
elif osString == osxString:
Expand All @@ -238,8 +241,6 @@ def dist(is_release : bool, target_type : Union[str, None]):
######################################
def distLinux(IS_RELEASE : bool, target_type : Union[str, None]):
print('creating linux distribution...')
os.system('rm -rf installer')
os.system('mkdir installer')
command = (JAVA_HOME + '/bin/jpackage ' +
'--app-version ' + POLYGLOT_BUILD + ' ' +
'--copyright "2014-' + CUR_YEAR + ' Draque Thompson" ' +
Expand Down Expand Up @@ -377,7 +378,6 @@ def distOsx(IS_RELEASE : bool, target_type : Union[str, None]):
def distWin(IS_RELEASE : bool, target_type : Union[str, None]):
package_location = 'PolyGlot-' + POLYGLOT_BUILD + '.exe'
print('Creating distribution package...')
os.system('rmdir /s /q installer')

# If missing, install WiX Toolset: https://wixtoolset.org/releases/
command = ('jpackage ' +
Expand Down
7 changes: 7 additions & 0 deletions create_tar_aarch64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
pushd build
cp ../packaging_files/PolyGlot0.png image/
cp ../io.github.DraqueT.PolyGlot.desktop image/
cp ../io.github.DraqueT.PolyGlot.metainfo.xml image/
tar -C image/ -czvf image_aarch64.tar.gz .
popd
7 changes: 7 additions & 0 deletions create_tar_x86_64.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
pushd build
cp ../packaging_files/PolyGlot0.png image/
cp ../io.github.DraqueT.PolyGlot.desktop image/
cp ../io.github.DraqueT.PolyGlot.metainfo.xml image/
tar -C image/ -czvf image_x86_64.tar.gz .
popd
Binary file added docs/assets/Lex_flatpak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/word_generator_flatpak.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 20 additions & 1 deletion docs/readme_developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,26 @@ Linux Fedora Setup

PolyGlot will now build itself into a platform specific application for you! This can be run on machines regardless of whether they have Java installed, as it builds a Java runtime into the distribution.


## Flatpak
### Setup
Install the runtime and SDK.
```bash
flatpak install flathub org.freedesktop.Platform//24.08 org.freedesktop.Sdk//24.08
```

### Structure
The way that flathub operates prevents us from running Maven directly as the downloads it'll perform will be blocked. Because of that, a tar file is created from the build contents generated by the Apache tools on x86 debian and rpm arm. The flatpak manifest is setup to download those tar files from the releases and copy files from there.

### Build & Install
Build & installs the flatpak locally.
```bash
flatpak-builder --force-clean --user --repo=repo --install build-dir io.github.DraqueT.PolyGlot.yml
```

Execute to run the flatpak version of PolyGlot.
```
flatpak run io.github.DraqueT.PolyGlot
```

## OPTIONAL STEPS TO BUILDING THE NON MODULAR BRIDGE
So. Some parts of PolyGlot rely on libraries that are pretty fundamentally rooted in Java 8. This was a bummer to deal with. Hopefully they will be modularized in the future and I can get rid of this hack, but for now, this is unfortunately how it is. Users WILL have to have some version of Java installed on their machine to use these features. The include: PDF Generation, Import from Excel, Export to Excel. If you want to modify this functionality, follow these steps.
Expand Down
7 changes: 7 additions & 0 deletions io.github.DraqueT.PolyGlot.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[Desktop Entry]
Name=PolyGlot
Type=Application
Exec=PolyGlot
Terminal=false
Categories=Development;Education;Science;
Icon=io.github.DraqueT.PolyGlot
60 changes: 60 additions & 0 deletions io.github.DraqueT.PolyGlot.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2025 Kelly G. Schultz -->
<component type="desktop-application">
<id>io.github.DraqueT.PolyGlot</id>
<name>PolyGlot</name>
<summary>conlang construction toolkit</summary>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MIT</project_license>
<content_rating type="oars-1.1"/>
<developer id="io.github.DraqueT">
<name>Draque Thompson</name>
</developer>
<url type="homepage">https://github.com/DraqueT/PolyGlot</url>
<url type="bugtracker">https://github.com/DraqueT/PolyGlot/issues</url>
<description>
<p>PolyGlot is a cross-platform conlang construction toolkit</p>
<ul>
<li>Conlang storage</li>
<li>Auto-generation of conjugations/declensions</li>
<li>Automated checking of lexicon with defined rules</li>
<li>Zompist Word Generator</li>
<li>Quiz Generation</li>
<li>Import/Export</li>
<li>Statistics Report</li>
<li>IPA Conversion Tool</li>
</ul>
</description>
<launchable type="desktop-id">io.github.DraqueT.PolyGlot.desktop</launchable>
<icon type="stock">io.github.DraqueT.PolyGlot.png</icon>
<releases>
<release version="3.6.1" date="2025-01-14">
<url type="details">https://github.com/DraqueT/PolyGlot/releases/tag/v3.6.1</url>
<description>
<p>Release Description</p>
<ul>
<li>Disabled file integrity check upon save</li>
</ul>
</description>
</release>
</releases>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/DraqueT/PolyGlot/423198f72f6fe884acfbb86906c04669245b0e18/docs/assets/Lex_flatpak.png</image>
<caption>Main window with example language loaded</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/DraqueT/PolyGlot/423198f72f6fe884acfbb86906c04669245b0e18/docs/assets/word_generator_flatpak.png</image>
<caption>Word Generator with example language loaded</caption>
</screenshot>
</screenshots>
<requires>
<control>keyboard</control>
<control>pointing</control>
</requires>
<categories>
<category>Development</category>
<category>Education</category>
<category>Science</category>
</categories>
</component>
45 changes: 45 additions & 0 deletions io.github.DraqueT.PolyGlot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
id: io.github.DraqueT.PolyGlot
runtime: org.freedesktop.Platform
runtime-version: '24.08'
sdk: org.freedesktop.Sdk
command: PolyGlot
finish-args:
- --device=dri # enable gpu acceleration
- --share=ipc
- --socket=x11 # java swing req
- --socket=pulseaudio # java swing req
- --filesystem=home

modules:
# taken from the lutris manifest
# - I think Java8 is depending on this outdated library
- name: libjpeg # with libjpeg.so.8
buildsystem: cmake-ninja
config-opts:
- -DCMAKE_SKIP_RPATH:BOOL=YES
- -DENABLE_STATIC:BOOL=NO
- -DWITH_JPEG8:BOOL=YES
sources: &libjpeg_sources
- type: archive
url: https://github.com/libjpeg-turbo/libjpeg-turbo/archive/refs/tags/2.1.3.tar.gz
sha256: dbda0c685942aa3ea908496592491e5ec8160d2cf1ec9d5fd5470e50768e7859
- name: PolyGlot
buildsystem: simple
build-commands:
- mkdir -p /app/bin
- install -Dm755 bin/* /app/bin
- cp -ra lib include conf legal man ${FLATPAK_DEST}
- install -Dm644 ${FLATPAK_ID}.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml
- install -Dm644 PolyGlot0.png ${FLATPAK_DEST}/share/icons/hicolor/256x256/apps/${FLATPAK_ID}.png
- install -Dm644 ${FLATPAK_ID}.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop
sources:
- type: archive
url: https://github.com/DraqueT/PolyGlot/releases/download/v3.6.1/image_x86_64.tar.gz
sha256: '2d7f0ad963ff52efb54f82ca41c3b88ddc8ec5961f6e6aa7adc88c83aace3afd'
only-arches:
- x86_64
- type: archive
url: https://github.com/DraqueT/PolyGlot/releases/download/v3.6.1/image_aarch64.tar.gz
sha256: 'b114deacbd343e009d64cb2ea52c388fb079d5b1b7f6c771e78fda69f91852af'
only-arches:
- aarch64