jbclements / portaudio

Racket Bindings for PortAudio
Other
9 stars 7 forks source link

Support cross-VM installation #7

Open LiberalArtist opened 4 years ago

LiberalArtist commented 4 years ago

The bespoke C code is already VM independent, but it was being needlessly linked with mzdyn anyway, and the build libraries were going to VM-specific places rather than the VM-independent place (in the sense of (system-library-subpath #f)))).

Closes https://github.com/jbclements/portaudio/issues/6.

This works on x86_64 Mac OS. I still need to adjust the build process for i386 Mac OS and the both Linux variants. A complication is that raco ctool doesn't seem to have a flag to do the the equivalent of (parameterize ([current-use-mzdyn #f]) ...) (should it?).

LiberalArtist commented 4 years ago

I've tried building for i386-macosx, which seems not to be long for this world. It does build something, with these warnings:

ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd

I'll try the result with a Racket distribution for i386-macosx to see if it actually works. (I might even have an old Mac with an actual 32bit Intel chip, but only if I haven't gotten around to getting rid of it yet: Apple has long since ended support.)

LiberalArtist commented 4 years ago

I only got as far as using cc.rkt manually for the pre-built libraries. That still needs to happen for Windows and Mac OS, since they don't necessarily provide a C compiler, but I think The Right Thing would be to use pre-install-collection)) to have raco setup on Unix use it to compile the libraries as needed.

jbclements commented 4 years ago

Actually, I think I'm more a fan of building them manually for linux platforms as well; there's no guarantee that a user on a linux platform has a C compiler installed.

jbclements commented 4 years ago

Are you willing to trim this PR down to just include the cc.rkt file? I'm happy to do it myself, but then you won't get credit for it. If you care :).

LiberalArtist commented 4 years ago

Sorry it's taken me a while to get back to this. I've changed this to just add "cc.rkt", and I've added a bit of dynamic-require there to avoid creating a package dependency on dynext-lib, since you plan to use this manually. (I like getting packaged libraries for non-standard things on Unix-like systems, too.)