On Fri, Dec 01, 2017 at 02:26:06PM +0000, Stuart Henderson wrote:
> : COMMENT = Faster Go re-implementation of sloccount for more
> languages
>
> just describe what it does rather than say things like "faster
> reimplementation" and "more". in particular it's quite useless to
> have a package comparing itself with something else that isn't in
> packages.
Fair points, I've updated COMMENTS and simply included SLOCCount's
description from https://www.dwheeler.com/sloccount/ (mostly matching
what benno@ used) in DESCR.
> : WANTLIB = c pthread
>
> loccount-1.1(textproc/loccount):
> Extra: c.92 pthread.25
>
> if you're adding WANTLIB in the hope that it triggers an update in a
> statically
> linked program, add a comment explaining why, otherwise it is likely to be
> removed
> in a WANTLIB sync.
Will "# statically linked" suffice?
> : MODULES = lang/go
>
> there doesn't seem much advantage to using the lang/go module when
> you're not using the go build scaffolding.
>
> : ALL_TARGET = ${HOMEPAGE:https://%=%}
>
> this is a bit obtuse, if you were actually using it, it would be simpler
> to just use the string.
>
> but you're not actually using it.
Yeah, I started with MODULES=lang/go basically and made it "work"...
> : WRKSRC = ${MODGO_WORKSPACE}/src/${ALL_TARGET}
> :
> : do-build:
> : make -C ${WRKSRC} loccount{,.1}
> :
> : do-test:
> : make -C ${WRKSRC} check
>
> normally ${MAKE_PROGRAM} rather than calling make directly, but seems
> simpler to get rid of the MODULES and have something like this instead
>
> BUILD_DEPENDS = textproc/asciidoc \
> lang/go
>
> ALL_TARGET = loccount loccount.1
>
> do-install:
> ${INSTALL_PROGRAM} ${WRKSRC}/loccount-$V-* ${PREFIX}/bin/loccount
> ${INSTALL_MAN} ${WRKSRC}/loccount.1 ${PREFIX}/man/man1/
>
... or not. This port is made around it's Makefile not the Go build
environment as seen in my MODULES approach; I went through this multiple
times now and ditching it in favor of BUILD_DEPENDS is indeed clearer.
How about this diff on top of my tarball?
The symlink in post-build makes the test work and avoids -${V}-* in
install.
Thanks a lot for your feedback!
---
textproc/loccount/Makefile | 19 ++++++++-----------
textproc/loccount/pkg/DESCR | 19 +++++++++++++++++++
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/textproc/loccount/Makefile b/textproc/loccount/Makefile
index 8a8319e83eb..a263287844a 100644
--- a/textproc/loccount/Makefile
+++ b/textproc/loccount/Makefile
@@ -1,6 +1,6 @@
# $OpenBSD: $
-COMMENT = Faster Go re-implementation of sloccount for more
languages
+COMMENT = Count lines of codes in many languages
V = 1.1
DISTNAME = loccount-${V}
@@ -16,20 +16,17 @@ MASTER_SITES = ${HOMEPAGE}/repository/
# BSD
PERMIT_PACKAGE_CDROM = Yes
+# statically linked
WANTLIB = c pthread
-MODULES = lang/go
+BUILD_DEPENDS = lang/go \
+ textproc/asciidoc
-BUILD_DEPENDS = textproc/asciidoc
+ALL_TARGET = loccount{,.1}
+TEST_TARGET = check
-ALL_TARGET = ${HOMEPAGE:https://%=%}
-WRKSRC = ${MODGO_WORKSPACE}/src/${ALL_TARGET}
-
-do-build:
- make -C ${WRKSRC} loccount{,.1}
-
-do-test:
- make -C ${WRKSRC} check
+post-build:
+ ln -sf ${WRKBUILD}/loccount{-${V}-*,}
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/loccount ${PREFIX}/bin/
diff --git a/textproc/loccount/pkg/DESCR b/textproc/loccount/pkg/DESCR
index 798b459ddb7..8f58a059091 100644
--- a/textproc/loccount/pkg/DESCR
+++ b/textproc/loccount/pkg/DESCR
@@ -6,3 +6,22 @@ implementation of the original.
The algorithms are largely unchanged and can be expected to produce identical
numbers for languages supported by both tools. Python is an exception;
loccount
corrects buggy counting of single-quote multiline literals in sloccount 2.26.
+
+
+SLOCCount includes a number of heuristics, so it can automatically detect file
+types, even those that don't use the "standard" extensions, and conversely, it
+can detect many files that have a standard extension but aren't really of that
+type. The SLOC counters have enough smarts to handle oddities of several
+languages. For example, SLOCCount examines assembly language files, determines
+the comment scheme, and then correctly counts the lines automatically. It also
+correctly handles language constructs that are often mishandled by other tools,
+such as Python's constant strings when used as comments and Perl's "perlpod"
+documentation.
+
+SLOCCount will even automatically estimate the effort, time, and money it would
+take to develop the software (if it was developed as traditional proprietary
+software). Without options, it will use the basic COCOMO model, which makes
+these estimates solely from the count of lines of code. You can get better
+estimates if you have more information about the project; see the SLOCCount
+documentation for information on how to control the estimation formulas used in
+SLOCCount.