From 07b062b11e52d576ab8cba56b3b53172846fcdfe Mon Sep 17 00:00:00 2001 From: Nicola Vitale Date: Mon, 9 Jun 2014 03:43:35 +0000 Subject: [PATCH] google-translate-cli is a 100-line AWK program to let you use Google Translate without a web browser, i.e., from the terminal. WWW: http://www.soimort.org/google-translate-cli/ --- textproc/Makefile | 1 + textproc/google-translate-cli/Makefile | 70 +++++++++++++++++++++++++ textproc/google-translate-cli/distinfo | 2 + textproc/google-translate-cli/pkg-descr | 4 ++ textproc/google-translate-cli/pkg-plist | 7 +++ 5 files changed, 84 insertions(+) create mode 100644 textproc/google-translate-cli/Makefile create mode 100644 textproc/google-translate-cli/distinfo create mode 100644 textproc/google-translate-cli/pkg-descr create mode 100644 textproc/google-translate-cli/pkg-plist diff --git a/textproc/Makefile b/textproc/Makefile index 96ef4b25b7aa..6b239e88bfdb 100644 --- a/textproc/Makefile +++ b/textproc/Makefile @@ -200,6 +200,7 @@ SUBDIR += go.text SUBDIR += goldendict SUBDIR += google-ctemplate + SUBDIR += google-translate-cli SUBDIR += gpp SUBDIR += grap SUBDIR += grc-aspell diff --git a/textproc/google-translate-cli/Makefile b/textproc/google-translate-cli/Makefile new file mode 100644 index 000000000000..933bb22542ab --- /dev/null +++ b/textproc/google-translate-cli/Makefile @@ -0,0 +1,70 @@ +# Created by: Nicola Vitale +# $FreeBSD$ + +PORTNAME= google-translate-cli +PORTVERSION= 0.0.1 +#PORTREVISION= 0 +CATEGORIES= textproc + +MAINTAINER= nivit@FreeBSD.org +COMMENT= Google Translate to serve as a command line tool + +LICENSE= BW +LICENSE_NAME= Beerware +LICENSE_TEXT= http://www.sax.de/~joerg/beerware-license.txt +LICENSE_PERMS= no-dist-mirror no-dist-sell no-pkg-mirror no-pkg-sell auto-accept + +RUN_DEPENDS= gawk:${PORTSDIR}/lang/gawk + +# same binary file bin/translate +CONFLICTS_INSTALL= translate-* + +GH_ACCOUNT= soimort +GH_COMMIT= 2f59fc6 +GH_TAGNAME= ${GH_COMMIT} +gawk_CMD= ${SETENV} -S gawk +gawk_OLD_CMD= /usr/bin/gawk + +MARKDOWN_CMD= ${LOCALBASE}/bin/markdown + +OPTIONS_DEFINE= DOCS + +SHEBANG_FILES= ${WRKSRC}/translate.awk +SHEBANG_LANG= gawk + +USE_GITHUB= yes +USES= shebangfix + +.include + +post-patch: + @${REINPLACE_CMD} -e 's,^gawk,${LOCALBASE}/bin/&,1' \ + -e 's,translate.awk,${DATADIR}/&,1' ${WRKSRC}/translate + +.if !${PORT_OPTIONS:MDOCS} +NO_BUILD= yes +.else +BUILD_DEPENDS+= markdown:${PORTSDIR}/textproc/discount + +do-build: + @(cd ${WRKSRC} && \ + ${MARKDOWN_CMD} README.md > README.tmp && \ + echo "${COMMENT}" | \ + ${CAT} - ${WRKSRC}/README.tmp $(${ECHO_CMD} "") > README.html) + +post-install: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.html ${STAGEDIR}${DOCSDIR} +.endif + +do-install: + @${MKDIR} ${STAGEDIR}${DATADIR} + ${INSTALL_SCRIPT} ${WRKSRC}/translate ${STAGEDIR}${DATADIR} + ${INSTALL_DATA} ${WRKSRC}/translate.awk ${STAGEDIR}${DATADIR} + ${LN} -sf ${DATADIR}/translate ${STAGEDIR}${PREFIX}/bin/translate + ${LN} -sf ${DATADIR}/translate ${STAGEDIR}${PREFIX}/bin/trs + +regression-test test: build + @(cd ${WRKSRC} ; ${MAKE} test) + +.include diff --git a/textproc/google-translate-cli/distinfo b/textproc/google-translate-cli/distinfo new file mode 100644 index 000000000000..ff2d6fdadadb --- /dev/null +++ b/textproc/google-translate-cli/distinfo @@ -0,0 +1,2 @@ +SHA256 (google-translate-cli-0.0.1.tar.gz) = ba778fadbbd91f93b431bfc769b6ea537931cd5475f2c811b024b4fe7dc70a02 +SIZE (google-translate-cli-0.0.1.tar.gz) = 4741 diff --git a/textproc/google-translate-cli/pkg-descr b/textproc/google-translate-cli/pkg-descr new file mode 100644 index 000000000000..efa95a2810c9 --- /dev/null +++ b/textproc/google-translate-cli/pkg-descr @@ -0,0 +1,4 @@ +google-translate-cli is a 100-line AWK program to let you use Google Translate +without a web browser, i.e., from the terminal. + +WWW: http://www.soimort.org/google-translate-cli/ diff --git a/textproc/google-translate-cli/pkg-plist b/textproc/google-translate-cli/pkg-plist new file mode 100644 index 000000000000..170abdfa934c --- /dev/null +++ b/textproc/google-translate-cli/pkg-plist @@ -0,0 +1,7 @@ +bin/translate +bin/trs +%%PORTDOCS%%%%DOCSDIR%%/README.html +%%DATADIR%%/translate +%%DATADIR%%/translate.awk +@dirrmtry %%DATADIR%% +%%PORTDOCS%%@dirrmtry %%DOCSDIR%%