Move to the Freedesktop SDK Extension for Swift 5
This extension is available on Flathub
This commit is contained in:
		
							
								
								
									
										38
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								README.md
									
									
									
									
									
								
							@@ -13,49 +13,30 @@ _Adwaita Template_ is a template application for the [Adwaita package](https://g
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Installation
 | 
					## Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Install the Swift Freedesktop SDK Extension
 | 
					### Install the Swift 5 Freedesktop SDK Extension
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1. Install `flatpak` and `flatpak-builder` (https://flatpak.org/).
 | 
					1. Install `flatpak`.
 | 
				
			||||||
2. Add Flathub to Flatpak:
 | 
					2. Add Flathub to Flatpak:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
 | 
					flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
3. Install the newest version of the Freedesktop SDK:
 | 
					3. Install the newest version of the Freedesktop SDK:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
flatpak install org.freedesktop.Sdk
 | 
					flatpak install flathub org.freedesktop.Sdk
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
4. Install the LLVM 16 Freedesktop extension:
 | 
					4. Install the LLVM 16 Freedesktop extension:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
flatpak install org.freedesktop.Sdk.Extension.llvm16/x86_64/23.08
 | 
					flatpak install flathub org.freedesktop.Sdk.Extension.llvm16/x86_64/23.08
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
5. Install the GNOME SDK. It's not required for building the Swift Freedesktop SDK extension, but later for building the application:
 | 
					5. Install the GNOME SDK. It's not required for building the Swift Freedesktop SDK extension, but later for building the application:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
flatpak install org.gnome.Sdk
 | 
					flatpak install flathub org.gnome.Sdk
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
6. Download the [Swift Freedesktop SDK extension](https://github.com/AparokshaUI/org.freedesktop.Sdk.Extension.swift) using [this](https://github.com/AparokshaUI/org.freedesktop.Sdk.Extension.swift/archive/refs/heads/main.zip) link.
 | 
					6. Install the Swift 5 Freedesktop SDK Extension.
 | 
				
			||||||
7. In a terminal, enter the downloaded directory using `cd`.
 | 
					 | 
				
			||||||
8. Install the Swift Freedesktop SDK extension:
 | 
					 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
sudo flatpak-builder build-dir org.freedesktop.Sdk.Extension.swift.json --install --force-clean
 | 
					flatpak install flathub org.freedesktop.Sdk.Extension.swift5
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
> [!NOTE]  
 | 
					 | 
				
			||||||
> If you get the error:
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> bwrap: Can't find source path [path]: Permission denied
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
>
 | 
					 | 
				
			||||||
> Run the following command:
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> chmod u+s /usr/bin/bwrap
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> [!NOTE]
 | 
					 | 
				
			||||||
> Add the `--user` flag to the installation command if you get the error:
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
> open(O_TMPFILE): Permission denied
 | 
					 | 
				
			||||||
> ```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Install Other Tools
 | 
					### Install Other Tools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
The following tools are required or recommended for editing this repository:
 | 
					The following tools are required or recommended for editing this repository:
 | 
				
			||||||
@@ -88,6 +69,11 @@ file:///path/to/directory
 | 
				
			|||||||
5. Edit the app's icons using the previously installed tools according to [this](https://blogs.gnome.org/tbernard/2019/12/30/designing-an-icon-for-your-app/) tutorial.
 | 
					5. Edit the app's icons using the previously installed tools according to [this](https://blogs.gnome.org/tbernard/2019/12/30/designing-an-icon-for-your-app/) tutorial.
 | 
				
			||||||
6. In GNOME Builder, click on the dropdown next to the hammer and then on `Export`. Wait until the file explorer appears, open the `.flatpak` file and install the app on your device!
 | 
					6. In GNOME Builder, click on the dropdown next to the hammer and then on `Export`. Wait until the file explorer appears, open the `.flatpak` file and install the app on your device!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### Flatpak SPM Generator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you want to e.g. publish your app on Flathub and there is no internet connection allowed while running the build commands,
 | 
				
			||||||
 | 
					you can use [this tool](https://github.com/flatpak/flatpak-builder-tools/tree/master/spm) that lets you generate a Flatpak manifest JSON from a Swift package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Thanks
 | 
					## Thanks
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Dependencies
 | 
					### Dependencies
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
  "runtime-version": "45",
 | 
					  "runtime-version": "45",
 | 
				
			||||||
  "sdk": "org.gnome.Sdk",
 | 
					  "sdk": "org.gnome.Sdk",
 | 
				
			||||||
  "sdk-extensions": [
 | 
					  "sdk-extensions": [
 | 
				
			||||||
    "org.freedesktop.Sdk.Extension.swift"
 | 
					    "org.freedesktop.Sdk.Extension.swift5"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "command": "AdwaitaTemplate",
 | 
					  "command": "AdwaitaTemplate",
 | 
				
			||||||
  "finish-args": [
 | 
					  "finish-args": [
 | 
				
			||||||
@@ -15,8 +15,8 @@
 | 
				
			|||||||
    "--socket=wayland"
 | 
					    "--socket=wayland"
 | 
				
			||||||
  ],
 | 
					  ],
 | 
				
			||||||
  "build-options": {
 | 
					  "build-options": {
 | 
				
			||||||
    "append-path": "/usr/lib/sdk/swift/bin",
 | 
					    "append-path": "/usr/lib/sdk/swift5/bin",
 | 
				
			||||||
    "prepend-ld-library-path": "/usr/lib/sdk/swift/lib"
 | 
					    "prepend-ld-library-path": "/usr/lib/sdk/swift5/lib"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "cleanup": [
 | 
					  "cleanup": [
 | 
				
			||||||
    "/include",
 | 
					    "/include",
 | 
				
			||||||
@@ -44,9 +44,7 @@
 | 
				
			|||||||
      ],
 | 
					      ],
 | 
				
			||||||
      "build-commands": [
 | 
					      "build-commands": [
 | 
				
			||||||
        "swift build -c release --static-swift-stdlib",
 | 
					        "swift build -c release --static-swift-stdlib",
 | 
				
			||||||
        "rm -r -f /app/bin",
 | 
					        "install -Dm755 .build/release/AdwaitaTemplate /app/bin/AdwaitaTemplate",
 | 
				
			||||||
        "mkdir /app/bin",
 | 
					 | 
				
			||||||
        "cp .build/release/AdwaitaTemplate /app/bin",
 | 
					 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml $DESTDIR/app/share/metainfo/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml",
 | 
					        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml $DESTDIR/app/share/metainfo/io.github.AparokshaUI.AdwaitaTemplate.metainfo.xml",
 | 
				
			||||||
        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.desktop $DESTDIR/app/share/applications/io.github.AparokshaUI.AdwaitaTemplate.desktop",
 | 
					        "install -Dm644 data/io.github.AparokshaUI.AdwaitaTemplate.desktop $DESTDIR/app/share/applications/io.github.AparokshaUI.AdwaitaTemplate.desktop",
 | 
				
			||||||
        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/io.github.AparokshaUI.AdwaitaTemplate.svg",
 | 
					        "install -Dm644 data/icons/io.github.AparokshaUI.AdwaitaTemplate.svg $DESTDIR/app/share/icons/hicolor/scalable/apps/io.github.AparokshaUI.AdwaitaTemplate.svg",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user