From 94001273ccaa8e083d3a38b4f08a1864f00679dd Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 29 Oct 2021 19:26:35 +1000 Subject: [PATCH] tweaks for Linux package --- qt/linux/README.dist | 12 ------------ qt/linux/README.md | 3 --- qt/package/build.py | 4 ++++ qt/package/lin/README.md | 25 +++++++++++++++++++++++++ qt/{linux => package/lin}/anki.1 | 0 qt/{linux => package/lin}/anki.desktop | 0 qt/{linux => package/lin}/anki.png | Bin qt/{linux => package/lin}/anki.xml | 0 qt/{linux => package/lin}/anki.xpm | 0 qt/{linux => package/lin}/install.sh | 4 +++- qt/{linux => package/lin}/uninstall.sh | 0 11 files changed, 32 insertions(+), 16 deletions(-) delete mode 100644 qt/linux/README.dist delete mode 100644 qt/linux/README.md create mode 100644 qt/package/lin/README.md rename qt/{linux => package/lin}/anki.1 (100%) rename qt/{linux => package/lin}/anki.desktop (100%) rename qt/{linux => package/lin}/anki.png (100%) rename qt/{linux => package/lin}/anki.xml (100%) rename qt/{linux => package/lin}/anki.xpm (100%) rename qt/{linux => package/lin}/install.sh (93%) rename qt/{linux => package/lin}/uninstall.sh (100%) diff --git a/qt/linux/README.dist b/qt/linux/README.dist deleted file mode 100644 index 7cecbdb5b..000000000 --- a/qt/linux/README.dist +++ /dev/null @@ -1,12 +0,0 @@ -To run, change to this folder in a terminal and run the following command: - -./bin/Anki - -- To install system wide, run 'sudo ./install.sh' -- To remove in the future, run 'sudo ./uninstall.sh' from the same folder. - -To play and record audio, mpv and lame must be installed. If mpv is not -installed or too old, Anki will try to fall back on using mplayer. - -If Anki fails to start, please run it from a terminal to see what errors it -outputs, and then post on our support site. diff --git a/qt/linux/README.md b/qt/linux/README.md deleted file mode 100644 index d19cac311..000000000 --- a/qt/linux/README.md +++ /dev/null @@ -1,3 +0,0 @@ -These files are distributed with the packaged Linux version, and may be useful -to Linux packagers. If you're building Anki yourself, please ignore these files, -and follow the instructions in docs/development.md instead. diff --git a/qt/package/build.py b/qt/package/build.py index 546d5dd33..73ef4c7e4 100644 --- a/qt/package/build.py +++ b/qt/package/build.py @@ -38,6 +38,7 @@ os.environ["CARGO_TARGET_DIR"] = str(cargo_target) # OS-specific things pyqt5_folder_name = "pyqt515" +is_lin = False if is_win: os.environ["TARGET"] = "x86_64-pc-windows-msvc" elif sys.platform.startswith("darwin"): @@ -50,6 +51,7 @@ elif sys.platform.startswith("darwin"): os.environ["TARGET"] = "x86_64-apple-darwin" os.environ["MACOSX_DEPLOYMENT_TARGET"] = "10.13" else: + is_lin = True if platform.machine() == "x86_64": os.environ["TARGET"] = "x86_64-unknown-linux-gnu" else: @@ -200,6 +202,8 @@ def merge_into_dist(output_folder: Path, pyqt_src_path: Path): ] if is_win: resources.append(adj_path_for_windows_rsync(Path("win")) + "/") + elif is_lin: + resources.append("lin/") subprocess.run( [ diff --git a/qt/package/lin/README.md b/qt/package/lin/README.md new file mode 100644 index 000000000..a3511f4ee --- /dev/null +++ b/qt/package/lin/README.md @@ -0,0 +1,25 @@ +# Installing Anki + +## Running directly + +To run without installing, change to this folder in a terminal, and run the +following command: + +./anki + +## Installing + +To install system wide, run 'sudo ./install.sh' + +To remove in the future, run 'sudo /usr/local/share/anki/uninstall.sh'. You should +do this before installing a newer version. + +## Audio + +To play and record audio, mpv and lame must be installed. If mpv is not +installed or too old, Anki will try to fall back on using mplayer. + +## Problems + +If Anki fails to start, please run it from a terminal to see what errors it +outputs, and then post on our support site. diff --git a/qt/linux/anki.1 b/qt/package/lin/anki.1 similarity index 100% rename from qt/linux/anki.1 rename to qt/package/lin/anki.1 diff --git a/qt/linux/anki.desktop b/qt/package/lin/anki.desktop similarity index 100% rename from qt/linux/anki.desktop rename to qt/package/lin/anki.desktop diff --git a/qt/linux/anki.png b/qt/package/lin/anki.png similarity index 100% rename from qt/linux/anki.png rename to qt/package/lin/anki.png diff --git a/qt/linux/anki.xml b/qt/package/lin/anki.xml similarity index 100% rename from qt/linux/anki.xml rename to qt/package/lin/anki.xml diff --git a/qt/linux/anki.xpm b/qt/package/lin/anki.xpm similarity index 100% rename from qt/linux/anki.xpm rename to qt/package/lin/anki.xpm diff --git a/qt/linux/install.sh b/qt/package/lin/install.sh similarity index 93% rename from qt/linux/install.sh rename to qt/package/lin/install.sh index 6544990f0..edb20b217 100755 --- a/qt/linux/install.sh +++ b/qt/package/lin/install.sh @@ -15,7 +15,7 @@ rm -rf "$PREFIX"/share/anki "$PREFIX"/bin/anki mkdir -p "$PREFIX"/share/anki cp -av * "$PREFIX"/share/anki/ mkdir -p "$PREFIX"/bin -ln -sf "$PREFIX"/share/anki/bin/Anki "$PREFIX"/bin/anki +ln -sf "$PREFIX"/share/anki/anki "$PREFIX"/bin/anki # fix a previous packaging issue where we created this as a file (test -f "$PREFIX"/share/applications && rm "$PREFIX"/share/applications)||true mkdir -p "$PREFIX"/share/pixmaps @@ -31,4 +31,6 @@ xdg-mime default anki.desktop application/x-colpkg xdg-mime default anki.desktop application/x-apkg xdg-mime default anki.desktop application/x-ankiaddon +rm install.sh + echo "Install complete. Type 'anki' to run." diff --git a/qt/linux/uninstall.sh b/qt/package/lin/uninstall.sh similarity index 100% rename from qt/linux/uninstall.sh rename to qt/package/lin/uninstall.sh