Check my Makefile

nalinux

New Member

Reaction score: 5
Messages: 7

Hello.
One of my hobbies is electronic.
So I use a Hantek 6022 digital scope, connected via usb, on my small HP Mini 110.
Works perfectly on FreeBSD with OpenHantek ( /usr/ports/misc/openhantek/ ).

This scope is DC only, but OpenHantek use its own firmware, and with a simple hardware modification it's possible to use also AC.
See https://github.com/OpenHantek/OpenHantek6022/blob/master/docs/HANTEK6022_AC_Modification.pdf

The compilation is based on cmake. The command line for compilation from source with this mod is
# cmake -D HANTEK_AC=1

So I modified the Makefile.
# diff Makefile Makefile.orig
22,26d21
< OPTIONS_DEFINE= HANTEK_AC
< HANTEK_AC_DESC= Allow AC input with a modified hardware.
< CONFIGURE_ENV= HANTEK_AC=1


Tested with version 3.1.2 OpenHantek, FreeBSD mini 12.1-RELEASE-p5 FreeBSD 12.1-RELEASE-p5 GENERIC amd64


Is this correct ?
If it is, I'll submit this to the maintener of this port.

Thanks.
 

Elazar

Well-Known Member

Reaction score: 127
Messages: 304

Yes, the best way is to propose this to the maintainer.

If he/she doesn't answer, become the maintainer yourself and create the patch in bugs.freebsd.org/bugzilla.
 

diizzy

Well-Known Member

Reaction score: 83
Messages: 302

I think it's a typo and should say
Code:
-DHANTEK_AC=1
instead although I haven't looked at the actual code.

If that's the case
Code:
CONFIGURE_ENV=  HANTEK_AC=1
should be:

Code:
.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MHANTEK_AC}
CMAKE_ARGS+=    -DHANTEK_AC=1
.endif
See (5.13.3.1) https://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/makefile-options.html for more information.

Also, if you're going to submit it as a patch bump PORTREVISION and at least run portlint -C (portlint is in ports) to do a basic compliant test.
EDIT: You don't need to bump PORTREVISION as this change wont change the binary by default however you still should run portlint -C :)
 
OP
nalinux

nalinux

New Member

Reaction score: 5
Messages: 7

Thanks a lot diizzy.
In fact, it worked with CONFIGURE_ENV, but your syntax makes more sense to my eyes.
Portlint helped me fixing minor syntax issues.
So I made a diff and sent it to the maintainer.
 
OP
nalinux

nalinux

New Member

Reaction score: 5
Messages: 7

It took less than 2 hours to have this patch approved and now in the port.
That was fast ! :)
It 's worth the time spent, even for a not so great in programmation like I am.
 
Top