1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

graphics/hiptext: add new port

PR:		210404
Submitted by:	yuri@rawbw.com

hiptext is command line tool for rendering images and videos inside terminals.

https://github.com/jart/hiptext
This commit is contained in:
Jan Beich 2016-06-22 14:31:00 +00:00
parent 8b2430690c
commit 520a94dcfc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=417308
8 changed files with 132 additions and 0 deletions

View File

@ -333,6 +333,7 @@
SUBDIR += gwenview-kde4
SUBDIR += gx
SUBDIR += hdr_tools
SUBDIR += hiptext
SUBDIR += hobbes-icons-xpm
SUBDIR += hppsmtools
SUBDIR += hs-HGL

42
graphics/hiptext/Makefile Normal file
View File

@ -0,0 +1,42 @@
# Created by: Yuri Victorovich <yuri@rawbw.com>
# $FreeBSD$
PORTNAME= hiptext
PORTVERSION= 0.0.s20160621
CATEGORIES= graphics
MAINTAINER= yuri@rawbw.com
COMMENT= Tool for rendering images and videos inside terminals
BUILD_DEPENDS= ragel:devel/ragel
LIB_DEPENDS= libgflags.so:devel/gflags \
libglog.so:devel/glog \
libpng.so:graphics/png \
libswscale.so:multimedia/ffmpeg \
libfreetype.so:print/freetype2
TEST_DEPENDS= googletest>=1.7.0:devel/googletest
RUN_DEPENDS= ${LOCALBASE}/share/fonts/dejavu/DejaVuSans.ttf:x11-fonts/dejavu
USE_GITHUB= yes
GH_ACCOUNT= jart
GH_TAGNAME= f89b44f
USES= compiler:c++11-lib gmake jpeg localbase
CPPFLAGS+= -D_GLIBCXX_USE_C99 # XXX ports/193528
CPPFLAGS+= -I${LOCALBASE}/include/freetype2
MAKE_ENV= GTEST_DIR="${LOCALBASE}"
TEST_TARGET= check
PLIST_FILES= bin/hiptext
post-extract:
@${RM} -r ${WRKSRC}/gtest
post-patch:
@${REINPLACE_CMD} -e 's|"DejaVuSansMono.ttf"|"${LOCALBASE}/share/fonts/dejavu/DejaVuSansMono.ttf"|' \
${WRKSRC}/font.cc
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/hiptext ${STAGEDIR}${PREFIX}/bin
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1466564837
SHA256 (jart-hiptext-0.0.s20160621-f89b44f_GH0.tar.gz) = b07164083cb2912fdc7f19c46934c34eca3f5bfd7a34a5990c82b047b4bfa6d1
SIZE (jart-hiptext-0.0.s20160621-f89b44f_GH0.tar.gz) = 1566318

View File

@ -0,0 +1,28 @@
--- Makefile.orig 2016-06-21 21:09:17 UTC
+++ Makefile
@@ -48,7 +48,7 @@ check: test
./test --alsologtostderr --gtest_color=yes
clean:
- $(RM) test hiptext $(wildcard *.o *.d *.S $(GTEST_DIR)/*.o) cpplint.py
+ $(RM) test hiptext $(wildcard *.o *.d *.S) cpplint.py
install: hiptext
install --mode=0755 hiptext $(PREFIX)/bin
@@ -78,12 +78,11 @@ pixel_parse.o: CXXFLAGS := $(filter-out
font.%: CXXFLAGS += $(shell freetype-config --cflags)
# google-test integration magic.
-GTEST_DIR ?= gtest
-TESTS = $(GTEST_DIR)/src/gtest-all.o $(GTEST_DIR)/src/gtest_main.o \
- $(patsubst %.cc,%.o,$(wildcard *_test.cc))
-$(TESTS): CXXFLAGS += -I$(GTEST_DIR)/include -I$(GTEST_DIR) -pthread
+GTEST_DIR ?= $(PREFIX)
+TESTS = $(patsubst %.cc,%.o,$(wildcard *_test.cc))
+$(TESTS): CXXFLAGS += -I$(GTEST_DIR)/include -pthread
$(filter gtest%,$(TESTS)): CXXFLAGS := $(filter-out -MD -Wall,$(CXXFLAGS))
-test: $(TESTS) $(SOURCES) ; $(LINK.cc) $^ $(LDLIBS) -lpthread -o $@
+test: $(TESTS) $(SOURCES) ; $(LINK.cc) $^ $(LDLIBS) -lpthread -L$(GTEST_DIR)/lib -lgtest -lgtest_main -o $@
# Recompile sources when headers change.
CXXFLAGS += -MD

View File

@ -0,0 +1,11 @@
--- artiste.cc.orig 2016-06-21 21:09:17 UTC
+++ artiste.cc
@@ -166,7 +166,7 @@ void Artiste::PrintMovie(Movie movie) {
ComputeDimensions(RatioOf(movie.width(), movie.height()));
movie.PrepareRGB(width_, height_);
HideCursor();
- sighandler_t old_handler = signal(SIGINT, OnCtrlC);
+ sig_t old_handler = signal(SIGINT, OnCtrlC);
for (auto graphic : movie) {
if (g_done) {
break;

View File

@ -0,0 +1,15 @@
--- hiptext.cc.orig 2016-06-21 21:09:17 UTC
+++ hiptext.cc
@@ -197,9 +197,9 @@ inline string GetExtension(const string&
int main(int argc, char** argv) {
// if (!isatty(1))
// FLAGS_color = false;
- google::SetUsageMessage("hiptext [FLAGS]");
- google::SetVersionString("0.1");
- google::ParseCommandLineFlags(&argc, &argv, true);
+ gflags::SetUsageMessage("hiptext [FLAGS]");
+ gflags::SetVersionString("0.1");
+ gflags::ParseCommandLineFlags(&argc, &argv, true);
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
const char* lang = std::getenv("LANG");

View File

@ -0,0 +1,29 @@
--- movie.cc.orig 2016-06-21 21:09:17 UTC
+++ movie.cc
@@ -53,7 +53,7 @@ void Movie::PrepareRGB(int width, int he
// Prepare context for scaling and converting to RGB.
sws_ = sws_getContext(context_->width, context_->height, context_->pix_fmt,
- width_, height_, PIX_FMT_RGB24, SWS_FAST_BILINEAR,
+ width_, height_, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR,
nullptr, nullptr, nullptr);
CHECK(codec_ = avcodec_find_decoder(context_->codec_id))
<< "Unsupported codec.\n";
@@ -61,13 +61,13 @@ void Movie::PrepareRGB(int width, int he
<< "Could not open codec.\n";
// Allocate Raw + RGB frame buffers.
- CHECK(frame_ = avcodec_alloc_frame());
- CHECK(frame_rgb_ = avcodec_alloc_frame());
- int rgb_bytes = avpicture_get_size(PIX_FMT_RGB24, width_, height_);
+ CHECK(frame_ = av_frame_alloc());
+ CHECK(frame_rgb_ = av_frame_alloc());
+ int rgb_bytes = avpicture_get_size(AV_PIX_FMT_RGB24, width_, height_);
buffer_ = static_cast<uint8_t*>(av_malloc(rgb_bytes));
LOG(INFO) << "RGB Buffer: " << rgb_bytes << " bytes.";
int prep = avpicture_fill(reinterpret_cast<AVPicture*>(frame_rgb_),
- buffer_, PIX_FMT_RGB24, width_, height_);
+ buffer_, AV_PIX_FMT_RGB24, width_, height_);
CHECK_GE(prep, 0) << "Failed to prepare RGB buffer.";
LOG(INFO) << "RGB dimensions: " << width_ << "x" << height_;
}

View File

@ -0,0 +1,3 @@
hiptext is command line tool for rendering images and videos inside terminals.
WWW: https://github.com/jart/hiptext