Creating a kos-port with multiple header directories

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
bogglez
Moderator
Moderator
Posts: 578
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Creating a kos-port with multiple header directories

Post by bogglez »

I wanted to create a port for a library which installs headers in two different directories, but the kos-port Makefile syntax only seems to allow a single directory.
How should I fix this?

Code: Select all

INSTALLED_HDRS = include/EGL/egl.h include/KHR/khrplatform.h
HDR_INSTDIR = # need EGL and KHR here
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5666
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Creating a kos-port with multiple header directories

Post by BlueCrab »

Well, that's the first time that's come up... There's not a way to do it in kos-ports as it stands now, besides splitting it into two ports.

Is there some reason that what you're doing shouldn't be split up into two ports? Usually one library doesn't take over two directories of header files, after all...

I mean, it could certainly be added (or a more general "post-install" script type thing could be added which would allow you to do what you want).
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Creating a kos-port with multiple header directories

Post by bogglez »

This is not a set of libraries that I have designed, but a standards consortium.. so yeah.
I think in the light of this the kos-ports Makefile syntax makes too many assumptions how libraries install.
I found two issues:

1. As mentioned, I can't install to multiple directories
Example: libEGL installs headers to EGL/ and KHR/

2. Multiple libraries cannot install to the same subdirectory
Example: libGL installs GL/gl.h, but freeglut installs GL/glut.h, too.

So in this second issue I mentioned I cannot install multiple headers because the files are not copied, but the directories are symlinked.
I think it would be better to copy the headers in the install step and delete directories when they're empty.
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
User avatar
bogglez
Moderator
Moderator
Posts: 578
Joined: Sun Apr 20, 2014 9:45 am
Has thanked: 0
Been thanked: 0

Re: Creating a kos-port with multiple header directories

Post by bogglez »

I took a look at the BSD ports system because I wasn't aware of its internals, but it seems to have such postinstall hooks, while it lacks the header installation stuff, so I think it's the way to go.

And I wonder whether there could be support for GNU-style make install? E.g. given a file like below, calling

Code: Select all

make install CC=kos-cc prefix=/opt/toolchains/dc/kos-ports/
should work. All the kos-port needs is meta data like dependencies, but no install instructions. This way the official Makefiles can be used.
The kos-port would only need to pass in CC etc. properly, since projects assume to be built without KOS.

Code: Select all

INSTALL=install
INSTALL_DATA=${INSTALL} -m 644
INSTALL_PROGRAM=$(INSTALL)

prefix=/usr/local
exec_prefix=$(prefix)
includedir=$(prefix)/include
libdir=$(exec_prefix)/lib

CC       = gcc
ARFLAGS  = rcs
CPPFLAGS = -DLIBGL15_FSAA
CFLAGS   = -Iinclude -std=gnu11 -Ofast

libGL.a: $(patsubst %.c,libGL.a(%.o),$(wildcard *.c))

clean:
        $(RM) $(wildcard *.o)

distclean:
        $(RM) $(wildcard *.o *.a)

installdirs:
        mkdir -p $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)/GL

install: libGL.a installdirs
        $(INSTALL_DATA) $(addprefix include/GL/,gl.h glu.h) $(DESTDIR)$(includedir)/GL
        $(INSTALL_DATA) libGL.a $(DESTDIR)$(libdir)

uninstall:
        $(RM) $(addprefix $(DESTDIR)$(includedir)/GL/,gl.h glu.h)
        rmdir $(DESTDIR)$(includedir)/GL
Wiki & tutorials: http://dcemulation.org/?title=Development
Wiki feedback: viewtopic.php?f=29&t=103940
My libgl playground (not for production): https://bitbucket.org/bogglez/libgl15
My lxdream fork (with small fixes): https://bitbucket.org/bogglez/lxdream
Post Reply