linux build file

This commit is contained in:
haorendashu
2025-02-07 13:53:16 +08:00
parent 269beba037
commit 725234ce98
11 changed files with 249 additions and 114 deletions

183
README.md
View File

@@ -21,6 +21,8 @@ This app helps you manage your nostr identity securely across devices while main
| Android | √ | √ | √ |
| IOS | √ | √ | |
| MacOS | √ | √ | |
| Windows | √ | √ | |
| Linux | √ | √ | |
## Downloads
@@ -30,88 +32,121 @@ IOS: Download from [TestFlight](https://testflight.apple.com/join/b4zVVxaM) http
MacOS: Download from [TestFlight](https://testflight.apple.com/join/9VD8rk5B) https://testflight.apple.com/join/9VD8rk5B
## Building from Source
## Git Module
### Prerequisites
- Flutter SDK
- Android Studio (for Android builds)
- Xcode (for iOS builds)
- Git
Nowser is a multi module project, after you clone this project, please run git module scrpit to init the module git repos.
### Platform-Specific Notes
#### iOS/macOS Prerequisites
1. Install CocoaPods if you haven't already:
```bash
sudo gem install cocoapods
```
2. Install project CocoaPods:
```bash
cd ios # or 'cd macos' for macOS builds
pod install
```
3. Open the workspace in Xcode:
```bash
open ios/Runner.xcworkspace # or 'open macos/Runner.xcworkspace' for macOS
```
4. In Xcode:
- Select the Runner project in the navigator
- Select the Runner target
- Under Signing & Capabilities:
- Select your Team
- Update Bundle Identifier if needed
- If building for macOS, ensure the following capabilities are enabled:
- Outgoing Connections (Client)
- Incoming Connections (Server)
#### Web
```bash
flutter build web
```
- The web build will be available in `build/web` directory
- You can serve it using any web server
- For local testing, you can use Python's built-in server:
```bash
cd build/web
python -m http.server 8000
```
#### Desktop Builds
- For Windows, you need Visual Studio with "Desktop development with C++" workload
- For Linux, you need the following dependencies:
```bash
sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev
```
### Build Instructions
1. Clone the repository with submodules:
```bash
git clone --recursive https://github.com/haorendashu/nowser.git
cd nowser
```
2. If you already cloned without submodules, initialize and update them:
```bash
``` bash
git submodule init
git submodule update
```
3. Install Flutter dependencies:
```bash
flutter pub get
## Build Script
### Android
```
-- build for appbundle
flutter build appbundle --release
-- build for apk
flutter build apk --release --split-per-abi
```
4. Build the app:
- For Android:
```bash
flutter build apk
### IOS and MacOS
build by XCode
### Windows
```
- For iOS:
```bash
flutter build ios
flutter build windows --release
```
### Linux
Linux depend on ```libsecret-1-dev```, ```libsqlite3-0```, ```libsqlite3-dev``` you can try to run this script to install before it run:
Ubuntu:
```
sudo apt-get -y install libsecret-1-dev libsqlite3-0 libsqlite3-dev
```
Fedora:
```
sudo dnf install libsecret-devel sqlite3 sqlite-devel
```
```
flutter build linux --release
```
#### About Linux package
We use ```flutter_distributor``` to build linux package, so you should install ```flutter_distributor``` and add some other config.
Install ```flutter_distributor``` to your system:
```
dart pub global activate flutter_distributor
```
Install some compile tools:
```
sudo apt-get install clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
```
rpm package requirements:
Debian/Ubuntu:
```
apt install rpm patchelf
```
Fedora:
```
dnf install gcc rpm-build rpm-devel rpmlint make python bash coreutils diffutils patch rpmdevtools patchelf
```
Arch:
```
yay -S rpmdevtools patchelf or pamac install rpmdevtools patchelf
```
appimage package requirements:
install ```flutter_distriutor```
```
dart pub global activate flutter_distributor
```
install and update filedbs:
```
sudo apt install locate
sudo updatedb
```
install Appimage Builder:
```
wget -O appimagetool "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod +x appimagetool
sudo mv appimagetool /usr/local/bin/
```
If your config all the steps, you can run these script to package the packages:
```
flutter_distributor release --name=dev --jobs=release-dev-linux-deb
flutter_distributor release --name=dev --jobs=release-dev-linux-rpm
flutter_distributor release --name=dev --jobs=release-dev-linux-appimage
```

BIN
dist/1.0.0+5/nowser-1.0.0+5-linux.AppImage vendored Executable file

Binary file not shown.

BIN
dist/1.0.0+5/nowser-1.0.0+5-linux.deb vendored Normal file

Binary file not shown.

BIN
dist/1.0.0+5/nowser-1.0.0+5-linux.rpm vendored Normal file

Binary file not shown.

22
distribute_options.yaml Normal file
View File

@@ -0,0 +1,22 @@
output: dist/
releases:
- name: dev
jobs:
- name: release-dev-linux-deb
package:
platform: linux
target: deb
build_args:
enable-experiment: records
- name: release-dev-linux-rpm
package:
platform: linux
target: rpm
build_args:
enable-experiment: records
- name: release-dev-linux-appimage
package:
platform: linux
target: appimage
build_args:
enable-experiment: records

View File

@@ -1,9 +1,5 @@
import 'dart:io';
import 'package:nostr_sdk/utils/platform_util.dart';
import 'package:nostr_sdk/utils/db_util.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
import 'package:process_run/shell_run.dart';
class DB {
static const _VERSION = 2;
@@ -13,23 +9,15 @@ class DB {
static Database? _database;
static init() async {
String path = _dbName;
if (!PlatformUtil.isWeb()) {
var databasesPath = await getDatabasesPath();
path = join(databasesPath, _dbName);
}
String path = await DBUtil.getPath(_dbName);
print("path $path");
try {
_database = await openDatabase(path,
version: _VERSION, onCreate: _onCreate, onUpgrade: _onUpgrade);
} catch (e) {
if (Platform.isLinux) {
// maybe it need install sqlite first, but this command need run by root.
await run('sudo apt-get -y install libsqlite3-0 libsqlite3-dev');
_database = await openDatabase(path,
version: _VERSION, onCreate: _onCreate, onUpgrade: _onUpgrade);
}
print("db open fail");
print(e);
}
}

View File

@@ -0,0 +1,30 @@
display_name: Nowser
icon: assets/imgs/logo/logo512.png
keywords:
- Nostr
- Nostr Client
generic_name: Nowser
categories:
- Network
startup_notify: true
# You can specify the shared libraries that you want to bundle with your app
#
# flutter_distributor automatically detects the shared libraries that your app
# depends on, but you can also specify them manually here.
#
# The following example shows how to bundle the libcurl library with your app.
#
# include:
# - libcurl.so.4
# The builder will copy these shared libraries to appimage, but sometimes these files are links and it will cause appimage run error.
# So i place the file version here, you should change to file name depend on your system.
# You can try to look at these script: ```cd /lib/x86_64-linux-gnu; ll | grep mpv```
include:
- libsqlite3.so
- libsecret-1.so.0.0.0

View File

@@ -0,0 +1,35 @@
display_name: Nowser
package_name: Nowser
maintainer:
name: DASHU
email: haorendashu@gmail.com
priority: optional
section: x11
installed_size: 15700
dependencies:
- libsqlite3-0
- libsqlite3-dev
- libsecret-1-dev
essential: false
icon: assets/imgs/logo/logo512.png
postuninstall_scripts:
- echo "Sorry to see you go."
keywords:
- Nostr
- Nostr Client
generic_name: Nostr Client
categories:
- Network
startup_notify: true

View File

@@ -0,0 +1,25 @@
display_name: Nowser
icon: assets/imgs/logo/logo512.png
summary: A Nostr Signer
group: Applications/Sociality
vendor: DASHU
packager: DASHU
packagerEmail: haorendashu@gmail.com
license: GNU General Public License v3.0
url: https://github.com/haorendashu/nowser
requires:
- sqlite3
- sqlite-devel
- libsecret-devel
keywords:
- Nostr
- Nostr signer
generic_name: Nowser
categories:
- Network
startup_notify: true

View File

@@ -133,10 +133,10 @@ packages:
dependency: transitive
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
convert:
dependency: transitive
description:
@@ -431,10 +431,10 @@ packages:
dependency: "direct main"
description:
name: flutter_slidable
sha256: "2c5611c0b44e20d180e4342318e1bbc28b0a44ad2c442f5df16962606fd3e8e3"
sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "4.0.0"
flutter_socks_proxy:
dependency: transitive
description:
@@ -529,18 +529,18 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05"
sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06"
url: "https://pub.dev"
source: hosted
version: "10.0.5"
version: "10.0.7"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806"
sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379"
url: "https://pub.dev"
source: hosted
version: "3.0.5"
version: "3.0.8"
leak_tracker_testing:
dependency: transitive
description:
@@ -863,10 +863,10 @@ packages:
dependency: "direct main"
description:
name: searchfield
sha256: "8d23d53967ac5b0774611150b286dacd70c9c5de74d3db433bda2104b4803755"
sha256: "9d091c2731868926e2aeb9ac551d1b9116a4533a424373119509d754ae0d0f45"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.2.4"
shared_preferences:
dependency: "direct main"
description:
@@ -927,7 +927,7 @@ packages:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
version: "0.0.0"
source_span:
dependency: transitive
description:
@@ -1012,10 +1012,10 @@ packages:
dependency: transitive
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377"
url: "https://pub.dev"
source: hosted
version: "1.11.1"
version: "1.12.0"
stream_channel:
dependency: transitive
description:
@@ -1028,10 +1028,10 @@ packages:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
version: "1.3.0"
string_validator:
dependency: transitive
description:
@@ -1060,10 +1060,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb"
sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c"
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.7.3"
typed_data:
dependency: transitive
description:
@@ -1100,10 +1100,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
url: "https://pub.dev"
source: hosted
version: "14.2.5"
version: "14.3.0"
web:
dependency: transitive
description:
@@ -1177,5 +1177,5 @@ packages:
source: hosted
version: "3.1.2"
sdks:
dart: ">=3.5.3 <4.0.0"
flutter: ">=3.24.0"
dart: ">=3.6.0 <4.0.0"
flutter: ">=3.27.0"

View File

@@ -50,12 +50,12 @@ dependencies:
flutter_secure_storage: ^9.2.2
pretty_qr_code: ^3.3.0
qr_code_scanner: ^1.0.1
flutter_slidable: ^3.1.1
flutter_slidable: ^4.0.0
window_manager: ^0.4.2
quick_actions: ^1.0.8
flutter_pinned_shortcut_plus: ^0.0.2
flutter_cache_manager: ^3.4.1
searchfield: 1.2.0
searchfield: ^1.2.4
dev_dependencies:
flutter_launcher_icons: ^0.13.1