Update brew and snap
This commit is contained in:
parent
9004bb3f47
commit
1b89356729
4 changed files with 57 additions and 60 deletions
51
README.md
51
README.md
|
@ -20,9 +20,11 @@ See the difference by disabling this optimization using the `-0` option. Or just
|
|||
- 2020-04-09: @aaronliu0130 has added homebrew support.
|
||||
- 2020-07-05: @cxwx has fixed homebrew support.
|
||||
- 2021-05-21: @aaronliu0130 has added Apple Clang support.
|
||||
- 2021-02-02: @aaronliu0130 added homebrew support from homebrew-core.
|
||||
|
||||
## Installation
|
||||
|
||||
### Build from source (Linux)
|
||||
### Build from source
|
||||
|
||||
sudo apt install imagemagick || yum install ImageMagick
|
||||
git clone https://github.com/stefanhaustein/TerminalImageViewer.git
|
||||
|
@ -30,22 +32,27 @@ See the difference by disabling this optimization using the `-0` option. Or just
|
|||
make
|
||||
sudo make install
|
||||
|
||||
### Homebrew (MacOS)
|
||||
### Homebrew
|
||||
|
||||
Option 1:
|
||||
|
||||
```
|
||||
brew install tiv
|
||||
```
|
||||
|
||||
Option 2(deprecated):
|
||||
|
||||
```
|
||||
brew tap stefanhaustein/TerminalImageViewer https://github.com/stefanhaustein/TerminalImageViewer
|
||||
brew install tiv
|
||||
```
|
||||
Option 2(deprecated, for macOS Mojave and below):
|
||||
|
||||
Option 3(deprecated, for macOS Mojave and below):
|
||||
|
||||
```
|
||||
brew tap stefanhaustein/TerminalImageViewer https://github.com/stefanhaustein/TerminalImageViewer
|
||||
brew install terminalimageviewer
|
||||
```
|
||||
Option 3(deprecated):
|
||||
```
|
||||
brew install https://raw.githubusercontent.com/stefanhaustein/TerminalImageViewer/master/terminalimageviewer.rb
|
||||
```
|
||||
|
||||
### Snap (outdated)
|
||||
|
||||
|
@ -59,27 +66,26 @@ The shell will expand wildcards. By default, thumbnails and file names will be d
|
|||
|
||||
## Packages / Contributions
|
||||
|
||||
- megamaced has created a RPM for SUSE:
|
||||
https://build.opensuse.org/package/show/home:megamaced/terminalimageviewer
|
||||
- bperel has created a Docker image:
|
||||
https://hub.docker.com/r/bperel/terminalimageviewer
|
||||
- teresaejunior has created a snapcraft.yaml file, which can build a Snap package with `sudo docker run -it --rm -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft sh -c 'apt-get update && snapcraft'`, and then installed with `sudo snap install --dangerous ./*.snap`.
|
||||
- aaronliu0130 has added brew support.
|
||||
- megamaced has created a RPM for SUSE:
|
||||
<https://build.opensuse.org/package/show/home:megamaced/terminalimageviewer>
|
||||
- bperel has created a Docker image:
|
||||
<https://hub.docker.com/r/bperel/terminalimageviewer>
|
||||
- teresaejunior has created a snapcraft.yaml file, which can build a Snap package with `sudo docker run -it --rm -v "$PWD:$PWD" -w "$PWD" snapcore/snapcraft sh -c 'apt-get update && snapcraft'`, and then installed with `sudo snap install --dangerous ./*.snap`.
|
||||
- aaronliu0130 has added brew support.
|
||||
|
||||
I am happy to accept useful contributions under the Apache 2.0 licencse, but...
|
||||
|
||||
- Before investing in larger contributions, please use an issue to discuss this
|
||||
- Pull requests should be as "atomic" as possible. I won't accept any pull request doing multiple things at once.
|
||||
- This library currently only depends on ImageMagic as an image processing library and I'd prefer to keep it that way.
|
||||
- Support for additional platforms, CPUs or similar will require somebody who is happy to help with maintenance, in particular, if I don't have access to it.
|
||||
- Before investing in larger contributions, please use an issue to discuss this
|
||||
- Pull requests should be as "atomic" as possible. I won't accept any pull request doing multiple things at once.
|
||||
- This library currently only depends on ImageMagic as an image processing library and I'd prefer to keep it that way.
|
||||
- Support for additional platforms, CPUs or similar will require somebody who is happy to help with maintenance, in particular, if I don't have access to it.
|
||||
|
||||
## Common problems
|
||||
|
||||
- On some linux platforms, an extra flag seems to be required: `make LDLIBS=-lstdc++fs` (but it also breaks MacOs), see https://github.com/stefanhaustein/TerminalImageViewer/issues/103
|
||||
- If you see strange horizontal lines, the characters don't fully fill the character cell. Remove additional line spacing in your terminal app
|
||||
- Wrong colors? Try -256 to use a 256 color palette instead of 24 bit colors
|
||||
- Strange characters? Try -0 or install an use full unicode font (e.g. inconsolata or firacode)
|
||||
|
||||
- On some linux platforms, an extra flag seems to be required: `make LDLIBS=-lstdc++fs` (but it also breaks MacOs), see <https://github.com/stefanhaustein/TerminalImageViewer/issues/103>
|
||||
- If you see strange horizontal lines, the characters don't fully fill the character cell. Remove additional line spacing in your terminal app
|
||||
- Wrong colors? Try -256 to use a 256 color palette instead of 24 bit colors
|
||||
- Strange characters? Try -0 or install an use full unicode font (e.g. inconsolata or firacode)
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -94,4 +100,3 @@ If multiple images match the filename spec, thumbnails are shown.
|
|||
The top image was generated with the character optimization disabled via the `-0` option.
|
||||
|
||||
![Comparison](https://i.imgur.com/OzdCeh6.png)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
name: tiv
|
||||
version: "v1.0.0"
|
||||
version: "v1.1.1"
|
||||
summary: Terminal Image Viewer
|
||||
description: |
|
||||
tiv is a small C++ program to display images in a (modern) terminal using
|
||||
|
@ -17,7 +17,7 @@ parts:
|
|||
tiv:
|
||||
plugin: make
|
||||
source-type: tar
|
||||
source: https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.0.0.tar.gz
|
||||
source: https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.1.1.tar.gz
|
||||
source-subdir: src/main/cpp
|
||||
build-packages:
|
||||
- g++
|
||||
|
@ -29,7 +29,7 @@ parts:
|
|||
install $SNAPCRAFT_PART_BUILD/tiv $SNAPCRAFT_PART_INSTALL/usr/bin/
|
||||
imagemagick:
|
||||
plugin: autotools
|
||||
source: https://www.imagemagick.org/download/releases/ImageMagick-7.0.7-39.tar.xz
|
||||
source: https://www.imagemagick.org/download/releases/ImageMagick-7.1.0-22.tar.xz
|
||||
source-type: tar
|
||||
configflags:
|
||||
- --enable-hdri=yes
|
||||
|
|
|
@ -1,40 +1,27 @@
|
|||
class Terminalimageviewer < Formula
|
||||
desc "Display images in a terminal using block graphic characters"
|
||||
homepage "https://github.com/stefanhaustein/TerminalImageViewer"
|
||||
url "https://github.com/stefanhaustein/TerminalImageViewer/archive/v1.1.0.tar.gz"
|
||||
sha256 "727ddaa048643cb0a13e23bc308415060d99d8b1853883ad339ad7b952050d61"
|
||||
head "https://github.com/stefanhaustein/TerminalImageViewer.git"
|
||||
uses_from_macos "curl" => :test
|
||||
depends_on "gcc" => :build unless OS.linux?
|
||||
url "https://github.com/stefanhaustein/TerminalImageViewer/archive/refs/tags/v1.1.1.tar.gz"
|
||||
sha256 "9a5f5c8688ef8db0e88dfcea6a1ae30da32268a7ab7972ff0de71955a75af0db"
|
||||
license "Apache-2.0"
|
||||
head "https://github.com/stefanhaustein/TerminalImageViewer.git", branch: "master"
|
||||
|
||||
depends_on "imagemagick"
|
||||
|
||||
def install
|
||||
odie "This formula is for macOS 10.14-, please use tiv from homebrew-core instead!" if OS.linux?
|
||||
cd "src/main/cpp" do
|
||||
system "make"
|
||||
if OS.mac?
|
||||
# No expermimental/filesystem.h on mac.
|
||||
system "/usr/local/bin/g++-#{Formula["gcc"].version_suffix}", "-std=c++17",
|
||||
"-Wall",
|
||||
"-fpermissive",
|
||||
"-fexceptions",
|
||||
"-O2", "-c",
|
||||
"-L/usr/local/opt/gcc/lib/gcc/11/",
|
||||
"tiv.cpp", "-o", "tiv.o"
|
||||
system "/usr/local/bin/g++-#{Formula["gcc"].version_suffix}", "tiv.o", "-o", "tiv",
|
||||
"-L/usr/local/opt/gcc/lib/gcc/11/", "-pthread", "-s"
|
||||
else
|
||||
system "make"
|
||||
end
|
||||
system "/usr/local/bin/g++-#{Formula["gcc"].version_suffix}", "-std=c++17", "-Wall", "-fpermissive",
|
||||
"-fexceptions", "-O2", "-c", "-L/usr/local/opt/gcc/lib/gcc/#{Formula["gcc"].version_suffix}/", "tiv.cpp",
|
||||
"-o", "tiv.o"
|
||||
system "/usr/local/bin/g++-#{Formula["gcc"].version_suffix}", "tiv.o", "-o", "tiv",
|
||||
"-L/usr/local/opt/gcc/lib/gcc/#{Formula["gcc"].version_suffix}/", "-pthread", "-s"
|
||||
bin.install "tiv"
|
||||
end
|
||||
end
|
||||
|
||||
test do
|
||||
# Downloads a public domain test file from wikimedia commons and displays it.
|
||||
# NOTE: Test will fail. Will fix when I get to my mac.
|
||||
system "curl -o \"test.png\" https://upload.wikimedia.org/wikipedia/commons/2/24/Cornell_box.png"
|
||||
assert_equal "[48;2;0;0;0m[38;2;0;0;0m▄[38;2;26;15;8m▄[38;2;39;28;16m▄[38;2;42;29;17m▄[38;2;41;29;17m▄[38;2;43;30;17m▄[38;2;44;30;17m▄[38;2;43;30;17m▄[38;2;44;31;18m▄[38;2;45;31;18m▄[38;2;46;32;18m▄▄[38;2;46;33;19m▄▄▄[38;2;47;34;19m▄▄[38;2;49;35;20m▄[38;2;49;36;20m▄[38;2;47;35;20m▄[38;2;48;35;20m▄[38;2;49;36;21m▄[38;2;49;37;21m▄▄[38;2;50;38;22m▄[38;2;51;39;22m▄[38;2;50;38;22m▄[38;2;49;37;21m▄[38;2;49;38;22m▄[38;2;50;39;22m▄[38;2;49;38;22m▄▄[38;2;50;39;22m▄[38;2;49;39;22m▄[38;2;50;39;22m▄[38;2;51;40;23m▄[38;2;49;39;22m▄[38;2;50;40;23m▄[38;2;49;39;22m▄[38;2;50;40;23m▄▄▄[38;2;49;40;23m▄[38;2;51;41;23m▄[38;2;49;40;23m▄▄[38;2;49;40;22m▄[38;2;48;40;22m▄[38;2;49;40;23m▄[38;2;49;40;22m▄[38;2;49;40;23m▄[38;2;47;39;22m▄▄▄▄[38;2;46;39;21m▄[38;2;45;38;21m▄[38;2;46;38;21m▄[38;2;45;37;21m▄[38;2;43;36;20m▄[38;2;44;38;20m▄[38;2;42;36;20m▄[38;2;42;35;19m▄▄[38;2;41;35;19m▄▄[38;2;40;34;18m▄[38;2;39;33;18m▄[38;2;40;34;18m▄▄[38;2;38;32;18m▄[38;2;38;32;17m▄[38;2;37;31;17m▄[38;2;22;21;10m▄[38;2;0;0;0m▄[0m
|
||||
",
|
||||
shell_output("#{bin}/tiv -0 -w 400 -h 400 test.png").strip
|
||||
assert_equal "\e[48;2;0;0;255m\e[38;2;0;0;255m \e[0m",
|
||||
shell_output("#{bin}/tiv #{test_fixtures("test.png")}").strip
|
||||
end
|
||||
end
|
11
tiv.rb
11
tiv.rb
|
@ -5,9 +5,14 @@ class Tiv < Formula
|
|||
sha256 "9a5f5c8688ef8db0e88dfcea6a1ae30da32268a7ab7972ff0de71955a75af0db"
|
||||
license "Apache-2.0"
|
||||
head "https://github.com/stefanhaustein/TerminalImageViewer.git", branch: "master"
|
||||
|
||||
depends_on "imagemagick"
|
||||
|
||||
uses_from_macos "curl" => :test
|
||||
on_linux do
|
||||
depends_on "gcc"
|
||||
end
|
||||
|
||||
fails_with gcc: "5"
|
||||
|
||||
def install
|
||||
cd "src/main/cpp" do
|
||||
|
@ -17,7 +22,7 @@ class Tiv < Formula
|
|||
end
|
||||
|
||||
test do
|
||||
assert_equal "\e[48;2;0;0;255m\e[38;2;0;0;255m \e[0m",
|
||||
shell_output("#{bin}/tiv #{test_fixtures("test.png")}").strip
|
||||
assert_equal "\e[48;2;0;0;255m\e[38;2;0;0;255m \e[0m",
|
||||
shell_output("#{bin}/tiv #{test_fixtures("test.png")}").strip
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue