Solved make extract extracts two files to the same location

arnov

New Member

Reaction score: 3
Messages: 15

Hello,

I am new to porting and trying to create a port for opencv 4 (basically because I need it myself). I managed to download several archives needed for this, but two of them (a 64 bit and a 32 bit version of ippicv) extract files to the same location in work. Is there a way to make them extract to two different directories?

Thanks,

Arno
 

uzsolt

Well-Known Member

Reaction score: 50
Messages: 269

Do you need two versions really? I think an i386 needs only the 32bit, the x86_64 needs only 64bit version. You can use ${ARCH} variable in Makefile to test the architecture.

PR 234147
 
OP
OP
A

arnov

New Member

Reaction score: 3
Messages: 15

During the build phase you indeed need only one of them. If I have understood it correctly you only have access to the network during the fetch phase. So my plan was to gather all necessary files for all possible options. With your tip I tried to fetch either the 64 bit or the 32 bit depending on ${ARCH}:

Makefile:
PORTNAME= opencv4
DISTVERSION= 4.0.1
CATEGORIES= graphics

USE_GITHUB= yes
GH_ACCOUNT= opencv
GH_PROJECT= opencv ade:adem
GH_TAGNAME= 4.0.1 v0.1.1d:adem
GH_SUBDIR= ext/ade:adem

MASTER_SITES= https://raw.githubusercontent.com/opencv/opencv_3rdparty/32e315a5b106a7b89dbed51c28f8120a48b368b4/ippicv/


.if ${ARCH} == amd64
DISTFILES= ippicv_2019_lnx_intel64_general_20180723.tgz
.elif ${ARCH} == i386
DISTFILES= ippicv_2019_lnx_ia32_general_20180723.tgz
.endif

.
.
.
.include <bsd.port.mk>
However I get and error:

make makesum
make: "/usr/home/arno/opencv4/Makefile" line 15: Malformed conditional (${ARCH} == amd64)
make: Fatal errors encountered -- cannot continue


Which seems to indicate ${ARCH} does not exist. As a Windows programmer I have little experience with makefiles. I have tried to search for examples, and grepped through sources in /usr/ports/Mk, where this exact same statement is used. Can you point me in the right direction on how to fix this?
 

uzsolt

Well-Known Member

Reaction score: 50
Messages: 269

You should put the .include <bsd.port.mk> line before .if ${ARCH}....
 

Hiroo Ono

Member

Reaction score: 6
Messages: 29

Hello.
Related to PR 234147, I am working on updating the port to 3.4.5.
It is a little bit off topic (should I make a new thread, maybe?), but I want to be in accord with you.
To update the port, I think there are some choices:
  1. make graphics/opencv to opencv 4.0 port and forget about 3.4.x. This is against what is said in PR 234147, but easiest way. However, some ports dependent on opencv may get broken if they use obsolete feature.
  2. Copy current graphics/opencv to graphics/opencv3 (graphics/opencv will be opencv 4.0.x line.) Choosing which port to use will be an option in the ports Makefile. So someone will have to add options to the ports that depends on opencv.
  3. Same as the second, but make the choice by FLAVOURS. In this case, I have to write Mk/Uses/opencv.mk and persuade portmgr to adopt it. Changes to Makefile of the dependent ports will be also needed, but a little easier.
How do yo think?
 
OP
OP
A

arnov

New Member

Reaction score: 3
Messages: 15

Hello,

I started the port because I needed some functionality which did not function properly in the current version. Then I wanted to update it to 3.4.5, but since I am new to porting I found it rather complex. Since there is also a 4.0.1 version I decided to skip the 3.x branch completely. Because there are significant differences between the 4. and the 3 branch I started from scratch by following the porters handbook, and learn along the way. My idea was to create a new independent graphics/opencv4 port. I realize having two versions of a library package could give some difficulties, but I assumed there are solutions for that. As I said, I am learning along the way. I now have a building version, and I am trying to get rid of some warnings in the CMake detection process. After that I will create a list of dependencies, and try to build on a clean system (i386 and amd64).

As for your question:
  1. This will indeed possibly break existing ports, and require updating those ports. This may even be impossible if the original sources of such a port are no longer maintained.
  2. Possible but will indeed require changes to existing ports.
  3. I was not aware of this possibility.
How about creating graphics/opencv4 and let the port maintainers decide for themselves what they need? If the original sources require a 4.x branch after an update they will have to switch anyway.
 

Hiroo Ono

Member

Reaction score: 6
Messages: 29

Thank you for your reply.

I discussed with some others at a users' meeting in Tokyo. As there is incompatibities between 3.4.x and 4.0.x (no C API in 4.0.x and so on), if it is possible, two separate ports as you wrote are preferable.

My idea was to create a new independent graphics/opencv4 port. I realize having two versions of a library package could give some difficulties, but I assumed there are solutions for that.
Currently, opencv 3.4.1 installs in:
  • /usr/local/bin
  • /usr/local/include
  • /usr/local/lib
  • /usr/local/share/OpenCV/
  • /usr/local/share/examples/opencv

We should then separete these to, for example:
  • /usr/local/bin/opencv4
  • /usr/local/bin/opencv3
  • /usr/local/include/opencv4
  • /usr/local/include/opencv3
  • /usr/local/lib/opencv4
  • /usr/local/lib/opencv3
  • /usr/local/share/OpenCV/opencv4
  • /usr/local/share/OpenCV/opencv3
  • /usr/local/share/examples/opencv4
  • /usr/local/share/examples/opencv3

I will look for cmake commands or variables related to setting these paths.

How about creating graphics/opencv4 and let the port maintainers decide for themselves what they need? If the original sources require a 4.x branch after an update they will have to switch anyway.
I think your suggestion is good. However, we should cooperate on separating the install directory as above.
I passed the weekend struggling with graphics/ogre3d port that opencv-contrib/modules/ovis depends on. Little advance in the opencv3 port. I am in a state of toggling every option and seeing if it builds and making pkg-plist.
 
Top