#609 Proposal for different use of $(DESTDIR)



I'm currently porting iverilog to OpenBSD and had major issues with the current build system concerning location of files.
After many different approaches (first including manual patches to _every_ Makefile.in) I feel to have fonud a clean solution (which I guess will work for other OSes as well):

.for f in Makefile.in cadpli/Makefile.in driver-vpi/Makefile.in \ driver/Makefile.in ivlpp/Makefile.in libveriuser/Makefile.in \ tgt-edif/Makefile.in tgt-fpga/Makefile.in tgt-null/Makefile.in \ tgt-pal/Makefile.in tgt-stub/Makefile.in tgt-verilog/Makefile.in \ tgt-vvp/Makefile.in vpi/Makefile.in vpip/Makefile.in vvp/Makefile.in
@perl -pi -e 's|[@]mandir@|${WRKINST}${PREFIX}/man|g' ${WRKSRC}/${f}
@perl -pi -e 's|\$$\(DESTDIR\)||g' ${WRKSRC}/${f}
@perl -pi -e 's|([@]prefix@)|\$$(DESTDIR)\1|g' ${WRKSRC}/${f}

In plain text:
Remove $(DESTDIR) everywhere and just add it to prefix (prefix = $(DESTDIR)@prefix@).

If there are no issues with other systems using this approach I'd be happy to remove above workaround from my port :)
I do think it is also "better" because you only have $(DESTDIR) in one place than in dozens.



  • Cary R.

    Cary R. - 2008-12-29

    Is this for the stable branch (0.8) or the development branch (0.9)? Also what flags, etc. are you passing to configure and where are you expecting the various files to go?

  • Nobody/Anonymous

    This is verilog 0.8.7.

    The final layout of files is: (all under /usr/local/)

    As flags I'm just using --disable-suffix.
    But the OpenBSD ports process works this way:
    Everything is build inside obj/ports/iverilog-0.8.7/verilog-0.8.7 and for install step
    prefix/DESTDIR is set to
    After install step all files found under that directory will be packaged up.
    Most of the time it works "out of the box" for software using configure.

  • Cary R.

    Cary R. - 2008-12-29

    I'll let Steve take a look at this since I don't build packages for redistribution. One thing I will say is make sure you know exactly why you are disabling the suffix and the future ramifications of doing this. Look at the mailing lists where we have discussed this in detail. I'm marking this as a 0.8 task, but we will need to verify that we do not also need to do something for the 0.9 release.

  • Cary R.

    Cary R. - 2008-12-29
    • milestone: --> v0.8
  • Stephen Williams

    First, I really discourage using --disable-suffix for 0.8.7 packages. I also suggest that you call verilog 0.8.7 packages verilog08 instead. The reason for the rename is so that verilog 0.9 packages will install without "replacing" verilog-0.8.7. We put a lot of thought into this transition, so please do it that way unless you have a good reason. (If you have that good reason, please post it to the iverilog-devel mailing list.)

    As for $(DESTDIR), there is also a reason that $(DESTDIR) is different from, and higher level then, the $(prefix). The $(prefix) is the final installation location where the product will go. Some parts of Icarus Verilog will have that path compiled in. The $(DESTDIR) only affects the install targets and is for forcing the Makefiles to install to a staging directory. This works perfectly fine for people who build rpms. Folding $(DESTDIR) into $(prefix) is not better because you run the risk of confusing your installation.

    Can you be more specific about what your actual problem is? Perhaps we can come up with a more elegant solution for you.

  • Nobody/Anonymous

    I guess to have overlooked something concerning the upcoming 0.9 version, does it need the older version installed?
    Because OpenBSD only keeps one version of the same port around, thus conflicts will be no problems since 0.8.7 will be entirely removed before 0.9 is installed.

    For make build DESTDIR='' and for make fake/install it is DESTDIR='fake-root-dir/', thus the correct path will be compiled into the binary. I actually had the issue of wrong paths getting compiled in when setting PREFIX to the fake root (which seems to be expected), another issue is that --mandir for some reason does not influence its Makefile value.


  • Cary R.

    Cary R. - 2008-12-30

    Please, please, read our discussions on the mailing lists. Basically we want to keep both available for a while. V0.8 supports rudimentary synthesis, but this is broken in V0.9 and is not planned to get fixed until V0.10 or later. We do not know exactly how many people are using this, but we don't want to just break synthesis when we release V0.9. V0.9 is a much better simulator and we don't want to wait for synthesis before releasing it since the main focus for Icarus is simulation. All this necessitated the need for a suffix so that we can have V0.8 for synthesis and legacy simulation and V0.9 as the new simulator.

    I do use --mandir in V0.9 so this could be a problem in V0.8. I do not have a dedicated V0.8 archive on the machine I have with me so Steve can look into this or I will once I get access to my other machine,

  • Werner Hoch

    Werner Hoch - 2009-01-02

    Hope it's ok to use this bug to add a problem with the DESTDIR variable and the make install command.

    I'm trying to create a rpm package of verilog 0.8.7 for openSUSE distributions.

    currently make install fails with the DESTDIR variable set.
    verilog/verilog-0.8.7> make DESTDIR=XX install
    ./mkinstalldirs XX/usr/local/bin XX/usr/local/include/iverilog-0.8 XX/usr/local/lib/ivl-0.8 \ XX/usr/local/lib/ivl-0.8/include XX/usr/local/share/man XX/usr/local/share/man/man1
    /usr/bin/install -c ./ivl XX/usr/local/lib/ivl-0.8/ivl
    /usr/bin/install -c -m 644 ./ivl_target.h /usr/local/include/iverilog-0.8/ivl_target.h
    /usr/bin/install: cannot create regular file `/usr/local/include/iverilog-0.8/ivl_target.h': No such file or directory
    make: *** [/usr/local/include/iverilog-0.8/ivl_target.h] Error 1


  • Werner Hoch

    Werner Hoch - 2009-01-02

    I've made a patch that adds the $(DESTDIR) too the install sections in the Makefile.in files where it's been missing.

    I'll send the patch to the -devel mailing list. Don't find the button, where I can attach something to that tracker item.


  • Cary R.

    Cary R. - 2009-01-02


    Patches are normally added to the patch tracker (tracker->patches). It appears that only privileged users and the original author can add files to an existing report.

  • Stephen Williams

    Werner's patch is applied to git v0_8-branch. I didn't realize so many $(DESTDIR) instances were missing:-(

    WRT --mandir: the Makefile.in has the line "mandir = @mandir@", and is does get substituted when the Makefile is generated. So that should work. It seems to have worked when I made trial rpm packages. Also, the DESTDIR patch adds some missing $(DESTDIR) references that may affect this issue.

    WRT iverilog 0.8 vs 0.9: The 0.9 series (which is not released yet) does *not* depend on the presence of any 0.8 files. But we want to allow users to install *both* on a system. We want the later (0.9) version to be what users normally see, but we hope that package builders will make a verilog08 package that installs 0.8.7 with the suffix enabled so that there are no file conflicts between versions. We want the legacy package renamed to verilog08 exactly so that when verilog-0.9.x is released, an update will *not* touch the existing 08 files.

  • Cary R.

    Cary R. - 2009-01-03

    Thinking ahead, are any parts of Werner's patch also needed in development?

  • Cary R.

    Cary R. - 2009-01-06

    Does this patch solve the reported problem and can we close this report?

  • Cary R.

    Cary R. - 2009-01-13

    It has been over a week with out a reply so I'm going to assume that the patch solved the problem and this can be safely closed.

  • Cary R.

    Cary R. - 2009-01-13
    • status: open --> closed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks