PortMidi / portmidi

portmidi is a cross-platform MIDI input/output library
Other
116 stars 31 forks source link

Install pkg-config file on macos #24

Closed dbuenzli closed 2 years ago

dbuenzli commented 2 years ago

The latest version of portmidi has a pkg-config, it would be nice to install it in the macos install. See for example https://github.com/Homebrew/homebrew-core/pull/99370

ryandesign commented 2 years ago

To clarify: If you build on macOS using cmake and make and sudo make install, a pkg-config file will be installed just as it would be on any other platform. But if you build using make -f pm_mac/Makefile.osx and sudo make install, then you don't get a pkg-config file because although Makefile.osx runs cmake and make for you to configure and build, it has its own install target. It's unclear to me why it has its own install target rather than using the one cmake creates, and indeed it's unclear to me why Makefile.osx exists at all or why anyone would use it instead of using cmake directly.

rbdannenberg commented 2 years ago

I don't understand Makefile.osx either. If it is causing confusion, I have no objection to removing it. I don't use or test installers though, so my goal in that direction is just to include whatever other developers want to support their methodologies.

dbuenzli commented 2 years ago

I have no idea about portmidi's build system I did not make the package's definition. I only realized the pkg-config files did not install and provided an ad-hoc fix upstream.

Now I can't find concrete build instructions in the repo. Maybe it would be worth adding some to the readme so that we can simply move on to use that in the brew package.

rbdannenberg commented 2 years ago

I don't know conventions for packages and installers. Maybe I should add instructions for what I do, which is simply build static libraries and link them.

dbuenzli commented 2 years ago

Now I can't find concrete build instructions in the repo.

I meant install instructions.

rbdannenberg commented 2 years ago

dbuenzli, do you have anything to do with Homebrew? I just opened a discussion there. Also, elsewhere I wrote the following: I started a discussion on Homebrew, so we'll see if anyone answers. If you submit a "fix to install the pkg-config file" it should also add a discussion of why anyone would use Makefile.osx and what it does. If it does nothing different from cmake, then it should be replace by a simple invocation of cmake, make, etc. Cmake already has a bunch of install code that I don't understand (nor do I really want to), which is OK as long as it's there because someone wants it bad enough to write it, use it, and fix it. On the other hand, Makefile.osx seems to be a left-over from many years ago, and probably is only used by Homebrew because it was there by mistake. If it's a mistake, let's don't propagate it.

Comments?

dbuenzli commented 2 years ago

dbuenzli, do you have anything to do with Homebrew?

No. I just patched the package because it was not installing the pkg-config files.

Comments?

It would be nice to get upstream instructions on how this software is supposed to be installed on macos.

On the other hand, Makefile.osx seems to be a left-over from many years ago, and probably is only used by Homebrew because it was there by mistake. If it's a mistake, let's don't propagate it.

Of course if the stock cmake stuff works, that's what we should go with for. If someone understands these things and provides precise instructions I'm willing to submit the changes to homebrew but I don't have the time to understand portmidi's build system (and I'm not familiar with cmake).

rbdannenberg commented 2 years ago

I just added this to README.md. Please let me know if it works for you and if it is clear enough -- maybe I should have written separate instructions for Windows, Linux, OS X:

cd portmidi # start in the top-level portmidi directory ccmake . # set any options interactively, type c to configure

type g to generate a Makefile or IDE project

         # type q to quit
         # (alternatively, run the CMake GUI and use
         #  Configure and Generate buttons to build IDE project)

make # compile sources and build PortMidi library

(alternatively, open project file with your IDE)

sudo make install # if you want to install to your system

dbuenzli commented 2 years ago

ccmake . # set any options interactively, type c to configure

That doesn't work for package managers how do you configure non interactively ?

rbdannenberg commented 2 years ago

I think

cmake . make sudo make install will work. You can pass options to cmake rather than set them interactively as in ccmake. cmake --build (with no arguments) will give a brief synopsis of command line syntax and options.

Be-ing commented 2 years ago

I don't understand Makefile.osx either. If it is causing confusion, I have no objection to removing it. I don't use or test installers though, so my goal in that direction is just to include whatever other developers want to support their methodologies.

I suggest to remove Makefile.osx.

@dbuenzli It's a standard CMake build process. Packaging it in Homebrew should be the same as any other CMake library.

dbuenzli commented 2 years ago

@Be-ing as I mentioned I'm not familiar with cmake. Since it seems so hard for people familliar with cmake to give me a simple sequence of instructions or point the documentation that explains that, I'll simply let someone else do it.

In any case it seems the issue is invalid so I'm going to close this.

Be-ing commented 2 years ago

@rbdannenberg gave instructions above, though I'm not sure why those aren't in the README. Regardless, package managers often have their own macros and conventions for using build systems, so I'd suggest looking at how other CMake libraries are packaged in Homebrew.

dbuenzli commented 2 years ago

Oups my bad, sorry! It seems I missed that notification.

rbdannenberg commented 2 years ago

I'm not a package maintainer and I use CMake interactively, but I'll assume the instructions above are OK and add them to the README before too long unless I hear corrections or recommendations. Thanks.

dbuenzli commented 2 years ago

As far as I can tell they work thanks.

For the people interested in the homebrew aspect I opened https://github.com/Homebrew/homebrew-core/pull/102963 to use the standard cmake build procedure. We'll see what the maintainers do with it.

Thanks all.