packaging: linux now installs a sh script to invoke cwtch so its command line callable, not just desktop. use bundled tor. windows bat files to trigger file logging for debug
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2021-07-06 09:24:42 -07:00
parent 3285053932
commit 3e82b447f2
16 changed files with 77 additions and 34 deletions

View File

@ -52,17 +52,10 @@ steps:
path: /root/.pub-cache
commands:
- flutter build linux --dart-define BUILD_VER=`cat VERSION` --dart-define BUILD_DATE=`cat BUILDDATE`
- mkdir deploy/linux
- cp -r build/linux/x64/release/bundle/* deploy/linux
- cp linux/cwtch.*.desktop deploy/linux
- cp linux/install-*.sh deploy/linux
- cp linux/cwtch.png deploy/linux
- cp linux/libCwtch.so deploy/linux/lib/
# should not be needed, should be in data/flutter_assets and work from there
#- cp /sdks/flutter/bin/cache/artifacts/engine/linux-x64/icudtl.dat deploy/linux
- cp linux/tor deploy/linux
- linux/package-release.sh
- mkdir -p deploy/cwtch
- cp -r build/linux/x64/release/bundle/* deploy/cwtch
- cd deploy
- mv linux cwtch
- tar -czf cwtch-`cat ../VERSION`.tar.gz cwtch
- rm -r cwtch
@ -222,6 +215,8 @@ steps:
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140.dll $Env:releasedir
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\vcruntime140_1.dll $Env:releasedir
- copy C:\BuildTools\VC\Redist\MSVC\14.29.30036\x64\Microsoft.VC142.CRT\msvcp140.dll $Env:releasedir
- copy README.md $Env:releasedir\
- copy windows\*.bat $Env:releasedir\
- powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:releasedir\Tor"
- name: package-windows

View File

@ -1 +1 @@
v1.0.0-20-gf8eedca-2021-06-30-20-48
v1.0.0-22-g343c3bc-2021-07-06-15-30

View File

@ -4,7 +4,23 @@ A Flutter based [Cwtch](https://cwtch.im) UI.
This README covers build instructions, for information on Cwtch itself please go to [https://cwtch.im](https://cwtch.im)
## Getting Started
## Installing
- Android: Available from the Google Play Store (currently patrons only) or from [https://cwtch.im/download/](https://cwtch.im/download/) as an APK
- Windows: Available from [https://cwtch.im/download/](https://cwtch.im/download/) as an installer or .zip file
- Linux: Available from [https://cwtch.im/download/](https://cwtch.im/download/) as a .tar.gz
- `install.home.sh` installs the app into your home directory
- `install.sys.sh` as root to install system wide
## Running
Cwtch logging is controlable with the following environment variables:
- `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console
- `LOG_LEVEL=debug` will set the log level to debug instead of info
## Building
### Getting Started
First you will need a valid [flutter sdk installation](https://flutter.dev/docs/get-started/install)
and run `flutter pub get` to fetch dependencies.
@ -28,7 +44,7 @@ You will probably want to disable Analytics on the Flutter Tool: `flutter config
- Follow the steps above to fetch `libCwtch-go` and `tor` (these will fetch Android versions of these binaries also)
- run `flutter run` with an Android phone connect via USB (or some other valid debug mode)
#### Known Platform Issues
### Known Platform Issues
- **Windows**: Flutter engine has a [known bug](https://github.com/flutter/flutter/issues/75675) around the Right Shift key being sticky.
We have implemented a partial workaround, if this happens, tap left shift and it will reset.

View File

@ -90,7 +90,17 @@ class CwtchFfi implements Cwtch {
Map<String, String> envVars = Platform.environment;
if (Platform.isLinux) {
home = (envVars['HOME'])!;
bundledTor = "./tor";
if (await File("linux/tor").exists()) {
bundledTor = "linux/tor";
} else if (await File("lib/tor").exists()) {
bundledTor = "lib/tor";
} else if (await File(path.join(home, ".local/lib/cwtch/tor")).exists()) {
bundledTor = path.join(home, ".local/lib/cwtch/tor");
} else if (await File("/usr/lib/cwtch/tor").exists()) {
bundledTor = "/usr/lib/cwtch/tor";
} else {
bundledTor = "tor";
}
} else if (Platform.isWindows) {
home = (envVars['UserProfile'])!;
bundledTor = "Tor\\Tor\\tor.exe";
@ -99,7 +109,7 @@ class CwtchFfi implements Cwtch {
if (EnvironmentConfig.BUILD_VER == dev_version) {
cwtchDir = path.join(cwtchDir, "dev");
}
print("cwtchDir $cwtchDir");
print("StartCwtch( cwtchdir: $cwtchDir, torPath: $bundledTor )");
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("c_StartCwtch");
// ignore: non_constant_identifier_names

3
linux/cwtch Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
env LD_LIBRARY_PATH=./lib/ ./lib/cwtch

View File

@ -3,7 +3,7 @@ Version=1.0
Type=Application
Name=Cwtch
Comment=Metadata Resistant Chat
Exec=env LD_LIBRARY_PATH=~/.local/lib/cwtch/ ~/.local/bin/cwtch
Exec=~/.local/bin/cwtch
Icon=cwtch
Terminal=false
Categories=Network;InstantMessaging;

3
linux/cwtch.home.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
env LD_LIBRARY_PATH=~/.local/lib/cwtch/ ~/.local/lib/cwtch/cwtch

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Cwtch
Comment=Metadata Resistant Chat
Exec=env LD_LIBRARY_PATH=./lib/ ./cwtch
Icon=cwtch
Terminal=false
Categories=Network;InstantMessaging;
Keywords=Internet;IM;Instant Messaging;Messaging;Chat

View File

@ -3,7 +3,7 @@ Version=1.0
Type=Application
Name=Cwtch
Comment=Metadata Resistant Chat
Exec=env LD_LIBRARY_PATH=/usr/lib/cwtch /usr/bin/cwtch
Exec=/usr/bin/cwtch
Icon=cwtch
Terminal=false
Categories=Network;InstantMessaging;

3
linux/cwtch.sys.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
env LD_LIBRARY_PATH=/usr/lib/cwtch /usr/lib/cwtch/cwtch

View File

@ -1,7 +1,7 @@
#!/bin/sh
mkdir -p ~/.local/bin
cp cwtch ~/.local/bin/
sed "s|~|$HOME|g" cwtch.home.sh > ~/.local/bin/cwtch
mkdir -p ~/.local/share/icons
cp cwtch.png ~/.local/share/icons
@ -13,5 +13,4 @@ mkdir -p ~/.local/lib/cwtch
cp -r lib/* ~/.local/lib/cwtch
mkdir -p ~/.local/share/applications
sed "s|~|$HOME|g" cwtch.home.desktop > $HOME/.local/share/applications/cwtch.desktop
sed "s|~|$HOME|g" cwtch.home.desktop > $HOME/.local/share/applications/cwtch.desktop

View File

@ -1,6 +1,6 @@
#!/bin/sh
cp cwtch /usr/bin/
cp cwtch.sys.sh /usr/bin/cwtch
cp cwtch.png /usr/share/icons

View File

@ -76,8 +76,16 @@ static void my_application_activate(GApplication* application) {
// Check if assets folder is relative to the executable or if we can use a system copy
struct stat info;
// if we're not in freshly compiled structure
if (stat(fl_dart_project_get_assets_path(project), &info ) != 0 ) {
if( stat("/usr/share/cwtch/data/flutter_assets", &info ) != 0 ) {
if( stat("lib/cwtch", &info) == 0) {
// use local dir structure
project->assets_path = g_build_filename("data", "flutter_assets", nullptr);
project->aot_library_path = g_build_filename("lib", "libapp.so", nullptr);
project->icu_data_path = g_build_filename("data", "icudtl.dat", nullptr);
gtk_window_set_icon_from_file(window, "./cwtch.png", NULL);
} else if( stat("/usr/share/cwtch/data/flutter_assets", &info ) != 0 ) {
// if we're non in sys installed structure, use home dir structure
struct passwd *pw = getpwuid(getuid());
const char *homedir = pw->pw_dir;
// /home/$USER/.local/share/cwtch/data/flutter_assets
@ -88,6 +96,7 @@ static void my_application_activate(GApplication* application) {
project->icu_data_path = g_build_filename(homedir, ".local", "share", "cwtch", "data", "icudtl.dat", nullptr);
gtk_window_set_icon_from_file(window, g_build_filename(homedir, ".local", "share", "icons", "cwtch.png", nullptr), NULL);
} else {
// else assume we are in sys installed structure
// /usr/share/cwtch/data/flutter_assets
project->assets_path = g_build_filename("/", "usr", "share", "cwtch", "data", "flutter_assets", nullptr);
// /usr/lib/cwtch
@ -96,9 +105,8 @@ static void my_application_activate(GApplication* application) {
project->icu_data_path = g_build_filename("/", "usr", "share", "cwtch", "data", "icudtl.dat", nullptr);
gtk_window_set_icon_from_file(window, "/usr/share/icons/cwtch.png", NULL);
}
} else {
gtk_window_set_icon_from_file(window, "./cwtch.png", NULL);
}
printf("my_application.cc: using aot_library_path or '%s'\n", project->aot_library_path);
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);

11
linux/package-release.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
mv build/linux/x64/release/bundle/cwtch build/linux/x64/release/bundle/lib/cwtch
cp linux/*.desktop build/linux/x64/release/bundle/
cp linux/cwtch.*.sh build/linux/x64/release/bundle/
cp linux/install-*.sh build/linux/x64/release/bundle/
cp linux/cwtch build/linux/x64/release/bundle/
cp README.md build/linux/x64/release/bundle/
cp linux/cwtch.png build/linux/x64/release/bundle/
cp linux/libCwtch.so build/linux/x64/release/bundle/lib/
cp linux/tor build/linux/x64/release/bundle/lib

View File

@ -0,0 +1,3 @@
set FILE_LOG=cwtch_debug_log.txt
set LOG_LEVEL=debug
start "cwtch" cwtch

View File

@ -0,0 +1,2 @@
set FILE_LOG=cwtch_info_log.txt
start "cwtch" cwtch