Issues with config.h

Robert Kennedy amtor at hotmail.com
Fri Aug 5 22:17:29 UTC 2022


Ryan,

Many thanks for the great feedback on my Portfile for M2VDownsizer.  That is exactly what I was looking for!

My portfile already had PortGroup           makefile 1.0 so there was no need to add it.

But since there was no details on the PortGroup in the Macports Guide, I looked at the Tcl code for this PortGroup on the Macports website and discovered that I did not need use_configure       no in my Portfile since that is the default.

Attached is my Portfile incorporating your suggestions and with the use_confiigure removed.

In particular, I deleted:
use_configure       no
worksrcdir          ${name}

And added:
dist_subdir         ${name}/${version}

See attached.

The Portfile works great.

Thank again!

Rob





________________________________
From: Ryan Schmidt <ryandesign at macports.org>
Sent: August 5, 2022 4:29 PM
To: Robert Kennedy <amtor at hotmail.com>
Cc: Joshua Root <jmr at macports.org>; MacPorts Developers <macports-dev at lists.macports.org>
Subject: Re: Issues with config.h



On Aug 4, 2022, at 08:36, Robert Kennedy wrote:

> e.g.
> ./config.h:29:9: warning: 'HAVE_STDINT_H' macro redefined
> #define HAVE_STDINT_H
>         ^
> ./config.h:42:9: note: previous definition is here
> #define HAVE_STDINT_H 1

The config.h file clearly does define HAVE_STDINT_H (empty) on line 29 and then redefines it (with a value) on line 42, which is clearly wrong. Remove line 29 and maybe the problem goes away.

The problem does seem to stem from the fact that config.h is getting included twice. For example one place that seems to happen is in mpeg2enc/fdctref.c which first includes mpeg2enc.h (which itself includes config.h) and then includes config.h again. The developer needs to decide whether it is valid to include config.h multiple times. If so, config.h needs to be written so that multiple inclusion works. Include guards are one way to do that. Otherwise, the developer needs to ensure that config.h only gets included once. Since the project is archived and the developer apparently no longer develops it, you get to decide.


On Aug 4, 2022, at 12:30, Robert Kennedy wrote:

> You will not be able to build the project without the Makefile and all the Patches that I created.

You're right. This does make it a bit difficult to help.


> If you have any ideas on why the "macro redefined" warnings only appear when the Project is being built by Macports without the "Includes guard" patch, please let me know.

MacPorts sets many environment variables and flags and also applies certain protections like sandboxing. MacPorts also builds in parallel by default. These might account for such differences in behavior.


> And of course, please provide any feedback on the Portfile since I am a newbie when it comes to writing Portfiles.

Since you are using "use_configure no", consider using the makefile portgroup; read it to find out how to use it.

You can delete the worksrcdir line since the value you've set it to is the default.

Since your distfile is unversioned, follow https://trac.macports.org/wiki/PortfileRecipes#unversioned-distfiles


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220805/96fa548c/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Portfile
Type: application/octet-stream
Size: 2827 bytes
Desc: Portfile
URL: <http://lists.macports.org/pipermail/macports-dev/attachments/20220805/96fa548c/attachment.obj>


More information about the macports-dev mailing list