Page MenuHomeFreeBSD

audio/virtual_oss_sndio: New port
Needs ReviewPublic

Authored by christos on Wed, Sep 3, 7:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Sep 28, 11:40 AM
Unknown Object (File)
Sun, Sep 21, 2:49 PM
Unknown Object (File)
Sun, Sep 21, 12:28 PM
Unknown Object (File)
Sun, Sep 21, 9:00 AM
Unknown Object (File)
Sun, Sep 21, 6:52 AM
Unknown Object (File)
Sun, Sep 21, 6:32 AM
Unknown Object (File)
Sun, Sep 21, 6:28 AM
Unknown Object (File)
Tue, Sep 16, 1:35 AM
Subscribers

Details

Summary

Although src commit FILLME ("virtual_oss: Port to base") includes the
sndio backend, we do not hook it to the src build, because it depends on
the third party library libsndio, so we build it as a port instead.

The port simply builds the files from src, which is not ideal, as this
means that the src repo needs to be present in the system in order for
the port to build, but this way we can avoid version mismatches and
ifdef hell as the project progresses.

Note that this is an extension for the base system virtual_oss, and not
audio/virtual_oss.

Sponsored by: The FreeBSD Foundation

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 66798
Build 63681: arc lint + arc unit

Event Timeline

christos created this revision.
fuz requested changes to this revision.Wed, Sep 3, 7:18 PM

Please adjust the layout of the Makefile in accordance with Porter's handbook. You can use the portfmt utility for that. Please also check the portlint warning.

Please extend pkg-descr to at least three lines.

This revision now requires changes to proceed.Wed, Sep 3, 7:18 PM

Fix portlint errors and warnings.

I suppose it is right not to hook this into audio/Makefile since this depends on /usr/src existing.

Oh it should always be hooked into the category makefile. You can do something like this:

.if !exists(${SRC_BASE}/lib/virtual_oss/sndio)
IGNORE= virtual_oss not present in base

after including <bsd.port.pre.mk> to have the port only be available on systems where virtual_oss is in base.

Please extend pkg-descr further. The point of three lines is not to have you put in empty lines and boilerplate, but rather to have you describe what the port does in detail. Explain what the port does and why a user would want to install this port.

Rewrite according to @arrowd's rewrite of D52366. Also improve pkg-descr.

This gives me:

% make -C audio/virtual_oss_backend_sndio check-plist
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: lib/voss_sndio.so
Error: Orphaned: @dir lib/virtual_oss
===> Checking for items in pkg-plist which are not in STAGEDIR
Error: Missing: lib/virtual_oss/voss_sndio.so
===> Error: Plist issues found.
*** Error code 1

I guess, you need

MAKE_ENV+=	LIBDIR=${PREFIX}/lib/virtual_oss

?

christos@pleb$ make -C audio/virtual_oss_backend_sndio check-plist
===>  License BSD2CLAUSE accepted by the user
===>   virtual_oss_backend_sndio-1403000 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by virtual_oss_backend_sndio-1403000 for building
===>  Extracting for virtual_oss_backend_sndio-1403000
===>  Patching for virtual_oss_backend_sndio-1403000
===>   virtual_oss_backend_sndio-1403000 depends on shared library: libsndio.so - found (/usr/local/lib/libsndio.so)
===>  Configuring for virtual_oss_backend_sndio-1403000
===>  Building for virtual_oss_backend_sndio-1403000
[Creating objdir /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio...]
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/sndio.pico
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/voss_sndio.so
Building shared library voss_sndio.so
===>  Staging for virtual_oss_backend_sndio-1403000
/bin/mkdir -p /usr/ports/audio/virtual_oss_backend_sndio/work/stage/usr/local/lib/virtual_oss
===>   Generating temporary packing list
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/_libinstall
====> Compressing man pages (compress-man)
====> Checking for pkg-plist issues (check-plist)
===> Parsing plist
===> Checking for items in STAGEDIR missing from pkg-plist
===> Checking for items in pkg-plist which are not in STAGEDIR
===> No pkg-plist issues found (check-plist)

For me setting MAKE_ENV+= LIBDIR=${PREFIX}/lib/virtual_oss breaks the build:

[Creating objdir /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio...]
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/sndio.pico
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/voss_sndio.so
Building shared library voss_sndio.so
===>  Staging for virtual_oss_backend_sndio-1403000
/bin/mkdir -p /usr/ports/audio/virtual_oss_backend_sndio/work/stage/usr/local/lib/virtual_oss
===>   Generating temporary packing list
Building /usr/ports/audio/virtual_oss_backend_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio/_libinstall
install: /usr/ports/audio/virtual_oss_backend_sndio/work/stage/usr/local/lib/virtual_oss/virtual_oss: No such file or directory
*** Error code 71

Why do you have 1403000 in the port's version? I thought the necessary base changes aren't even merged to main yet?

Why do you have 1403000 in the port's version? I thought the necessary base changes aren't even merged to main yet?

They are not, this is just my dev environment, but you need to have D52308 applied in /usr/src in order for this to build.

Why do you have 1403000 in the port's version? I thought the necessary base changes aren't even merged to main yet?

They are not, this is just my dev environment, but you need to have D52308 applied in /usr/src in order for this to build.

Yes, I do have it applied, but on top of main. Which is why in my build the port's version starts with 15. Could it be that you applied D52308 onto stable/14?

Why do you have 1403000 in the port's version? I thought the necessary base changes aren't even merged to main yet?

They are not, this is just my dev environment, but you need to have D52308 applied in /usr/src in order for this to build.

Yes, I do have it applied, but on top of main. Which is why in my build the port's version starts with 15. Could it be that you applied D52308 onto stable/14?

I also have it on top of main, but my machine actually runs 14.3-RELEASE.

Ah, sorry for the confusion, the OSVERSION value comes from /usr/local/include/sys/param.h. All right, I'll try to figure out why this doesn't build for me.

Your logs look less verbose than mine for some reason. For example, in my logs I do see the actual command that is used to install the library:

===>   Generating temporary packing list
install  -s -o 1001 -g 1001 -m 444  -C -S  voss_sndio.so /usr/local/poudriere/ports/default/audio/virtual_oss_backend_sndio/work/stage/usr/local/lib/

I don't have anything fancy in /etc/make.conf or /etc/src.conf, though.

Anyways, I dive into bsd.lib.mk and it clearly installs directly into LIBDIR. I have no idea how it works for you.

Your logs look less verbose than mine for some reason. For example, in my logs I do see the actual command that is used to install the library:

===>   Generating temporary packing list
install  -s -o 1001 -g 1001 -m 444  -C -S  voss_sndio.so /usr/local/poudriere/ports/default/audio/virtual_oss_backend_sndio/work/stage/usr/local/lib/

I don't have anything fancy in /etc/make.conf or /etc/src.conf, though.

I'm actually trying to figure out the same thing, don't know what causes this, I also do not have anything fancy in the conf files.

Anyways, I dive into bsd.lib.mk and it clearly installs directly into LIBDIR. I have no idea how it works for you.

Not sure either. I suppose something is wrong on my end, but not sure what.

christos retitled this revision from audio/virtual_oss_backend_sndio: New port to audio/virtual_oss_sndio: New port.Mon, Sep 8, 4:44 PM

I tried building this in Poudriere to rule out environmental differencies and git this:

===>  Building for virtual_oss_sndio-1500053
--- sndio.pico ---
cc -fpic -DPIC   -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -fno-common -I/usr/src/usr.sbin/virtual_oss/virtual_oss  -I/usr/local/include   -MD  -MF.depend.sndio.pico -MTsndio.pico -std=gnu17 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch  -Qunused-arguments      -c /usr/src/lib/virtual_oss/sndio/sndio.c -o sndio.pico
In file included from /usr/src/lib/virtual_oss/sndio/sndio.c:36:
/usr/src/usr.sbin/virtual_oss/virtual_oss/int.h:33:10: fatal error: 'samplerate.h' file not found
   33 | #include <samplerate.h>
      |          ^~~~~~~~~~~~~~
1 error generated.
*** [sndio.pico] Error code 1

I took the freshest revision of D52308, of course.

I tried building this in Poudriere to rule out environmental differencies and git this:

===>  Building for virtual_oss_sndio-1500053
--- sndio.pico ---
cc -fpic -DPIC   -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -fno-common -I/usr/src/usr.sbin/virtual_oss/virtual_oss  -I/usr/local/include   -MD  -MF.depend.sndio.pico -MTsndio.pico -std=gnu17 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch  -Qunused-arguments      -c /usr/src/lib/virtual_oss/sndio/sndio.c -o sndio.pico
In file included from /usr/src/lib/virtual_oss/sndio/sndio.c:36:
/usr/src/usr.sbin/virtual_oss/virtual_oss/int.h:33:10: fatal error: 'samplerate.h' file not found
   33 | #include <samplerate.h>
      |          ^~~~~~~~~~~~~~
1 error generated.
*** [sndio.pico] Error code 1

I took the freshest revision of D52308, of course.

Hmm, I suspect it needs a LIBADD=samplerate like the other backends. Please re-apply D52308 and let me know if it works now.

Is it feasible to use the latest virtual_oss for all os releases? Simply using base src does not solve the problem. The official packages are built on the oldest supported release, e.g. right now 14.2-release builds packages for 14.2, 14.3, and 14-stable. Besides, setting DISTVERSION directly to OSVERSION reduces the update flexibility: the port will be only updated when OSVERSION is increased and has to be updated regardless the actual changes in virtual_oss.

audio/virtual_oss_sndio/Makefile
25 ↗(On Diff #161734)

Strictly speaking, here should be PREFIX, not LOCALBASE.

Is it feasible to use the latest virtual_oss for all os releases? Simply using base src does not solve the problem. The official packages are built on the oldest supported release, e.g. right now 14.2-release builds packages for 14.2, 14.3, and 14-stable.

You're right, but we already have a solution for this. kmod ports are built separately from others for each supported release we have. And they also have OSVERSION in their PORTVERSIONs. These oss ports, although, not a kernel modules, should follow the same scheme.

I finally set up a proper jail for poudriere and carried out the build. This is what I'm getting with poud testport:

===>  Building for virtual_oss_sndio-1600000
[Creating objdir /wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio...]
--- .depend ---
echo voss_sndio.so: /wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/libsamplerate/libsamplerate_pie.a >> .depend
--- sndio.pico ---
cc -fpic -DPIC   -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -fno-common -I/usr/src/usr.sbin/virtual_oss/virtual_oss  -I/usr/src/contrib/libsamplerate  -I/usr/local/include   -MD  -MF.depend.sndio.pico -MTsndio.pico -std=gnu17 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch  -Qunused-arguments      -c /usr/src/lib/virtual_oss/sndio/sndio.c -o sndio.pico

--- voss_sndio.so ---
Building shared library voss_sndio.so
cc   -L/usr/local/lib -lsndio -Wl,-zrelro    -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o voss_sndio.so -Wl,-soname,voss_sndio.so sndio.pico -L/wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/libsamplerate -lsamplerate_pie 
ld: error: unable to find library -lsamplerate_pie
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [voss_sndio.so] Error code 1

And they also have OSVERSION in their PORTVERSIONs. These oss ports, although, not a kernel modules, should follow the same scheme.

kmod ports use versioned tarballs at least. This port takes OSVERSION from installed /usr/include/sys/param.h, assuming installed system and sources are synced. It could be the way to go, but to me this seems as error-prone approach.
Could you consider creating tarballs from the base src to use them as distfiles for these ports?

I finally set up a proper jail for poudriere and carried out the build. This is what I'm getting with poud testport:

===>  Building for virtual_oss_sndio-1600000
[Creating objdir /wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/virtual_oss/sndio...]
--- .depend ---
echo voss_sndio.so: /wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/libsamplerate/libsamplerate_pie.a >> .depend
--- sndio.pico ---
cc -fpic -DPIC   -O2 -pipe  -fstack-protector-strong -fno-strict-aliasing  -fno-common -I/usr/src/usr.sbin/virtual_oss/virtual_oss  -I/usr/src/contrib/libsamplerate  -I/usr/local/include   -MD  -MF.depend.sndio.pico -MTsndio.pico -std=gnu17 -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wold-style-definition -Wno-pointer-sign -Wdate-time -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Wno-error=unused-but-set-parameter -Wno-error=cast-function-type-mismatch  -Qunused-arguments      -c /usr/src/lib/virtual_oss/sndio/sndio.c -o sndio.pico

--- voss_sndio.so ---
Building shared library voss_sndio.so
cc   -L/usr/local/lib -lsndio -Wl,-zrelro    -fstack-protector-strong -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o voss_sndio.so -Wl,-soname,voss_sndio.so sndio.pico -L/wrkdirs/usr/ports/audio/virtual_oss_sndio/work/usr/src/amd64.amd64/lib/libsamplerate -lsamplerate_pie 
ld: error: unable to find library -lsamplerate_pie
cc: error: linker command failed with exit code 1 (use -v to see invocation)
*** [voss_sndio.so] Error code 1

Have you applied D52310?

And they also have OSVERSION in their PORTVERSIONs. These oss ports, although, not a kernel modules, should follow the same scheme.

kmod ports use versioned tarballs at least. This port takes OSVERSION from installed /usr/include/sys/param.h, assuming installed system and sources are synced. It could be the way to go, but to me this seems as error-prone approach.
Could you consider creating tarballs from the base src to use them as distfiles for these ports?

I am actually a bit confused with this. If I understand correctly, with the current approach the port is only built if /usr/src exists in the system building it. In that case, I'm not sure if we need to ship tarballs, because if virtual_oss is not part of base (i.e., any version before 15.0), then the port won't build in the first place, because the sources needed to build it won't exist. Also, if a user somehow ends up installing those ports as binaries, what will happen is:

  • In the case of this port and D52426, nothing will happen at all, since those are extensions of the base system virtual_oss.
  • In the case of D52366, it will work fine on any version.
audio/virtual_oss_sndio/Makefile
17 ↗(On Diff #161734)

@arrowd Is this still a problem for you if it's not defined to ${PREFIX}/lib/virtual_oss?

Have you applied D52310?

Yes, I got past that error.

I am actually a bit confused with this. If I understand correctly, with the current approach the port is only built if /usr/src exists in the system building it.

The problem @makc is talking about is that we build packages for 14.3 in the 14.2 jail. This is how our package infrastructure works. This means that all these ports will take source from 14.2, but packages will be installed into 14.3.

But I'd postpone solving this problem until we deal with complation issues.

I am actually a bit confused with this. If I understand correctly, with the current approach the port is only built if /usr/src exists in the system building it.

The problem @makc is talking about is that we build packages for 14.3 in the 14.2 jail. This is how our package infrastructure works. This means that all these ports will take source from 14.2, but packages will be installed into 14.3.

Right, so in the future if a 15.0 jail build the port for 15.1, the port will have 15.0 as its version. I understand. Isn't there a way to avoid creating and maintaining tarballs?

The machinery that is used for building kmods wouldn't work for us. I talked to bapt and it turned out that kmod ports are built using cross-compilation. It works for them, because they have almost zero dependencies, but it won't work for virtual_oss ports.

I don't quite get what tarballs we're talking about. We can still take sources from /usr/src, but we have to maintain the ABI so that ports build from 15.0 sources would work with 15.1+ base system.

The machinery that is used for building kmods wouldn't work for us. I talked to bapt and it turned out that kmod ports are built using cross-compilation. It works for them, because they have almost zero dependencies, but it won't work for virtual_oss ports.

I don't quite get what tarballs we're talking about. We can still take sources from /usr/src, but we have to maintain the ABI so that ports build from 15.0 sources would work with 15.1+ base system.

Since virtual_oss in base is new, and is not really critical or massively complex software, I think just MFC'ing changes accordingly to keep the ports stable even if they are built for a different version, is reasonable.

audio/virtual_oss_sndio/Makefile
17 ↗(On Diff #161734)

@arrowd Bump comment above.

Sorry, ENOTIME. I will try to go over all the oss stuff this Sunday.

Sorry, ENOTIME. I will try to go over all the oss stuff this Sunday.

No worries, thank you. :-)