Would appreciate help creating a vulkan sdk formula


#1

I have been a homebrew user for about 5 years, and this is the first time I have felt the need to create a formula… but I think I need to help to make it happen.
I read through the Formula Cookbook pages, but I’m still fuzzy on how to go about this for the specific thing I want to add.

My goal is to create a tap for the Vulkan SDK for Mac, which is a next-generation graphics API designed by the Khronos Group (the same industry group that manages the OpenGL and OpenCL spec).

First, I apologize if I confuse the homebrew terminology. Basically, LunarG is releasing pre-compiled libraries for Mac at their site: https://vulkan.lunarg.com/sdk/home. The latest release for mac is:
https://vulkan.lunarg.com/sdk/home#sdk/downloadConfirm/1.1.77.0/mac/vulkansdk-macos-1.1.77.0.tar.gz

This release is already compiled and the docs say that it can be run on El Capitan and later. Since there is no compilation necessary, is “brew create …” the right way to get started with this?

In the autogenerated boilerplate created by brew create, there are sections for installation and testing. Do these sections apply when the code is already compiled?

Since there is no compilation, what do I need to do to get the files installed in the Cellar somewhere? Is there something automated, or do I need to put “system” commands into the formula? Would the name of the cellar follow the name of the forumla and version (or the name from the tarball file)?

Additionally, in order to properly run vulkan programs, a few environment variables have to be defined. Does homebrew support adding such environment variables, or are such variables just enumerated as “Caveats”?

As far as I can tell, just to run vulkan programs these variables must be defined at a minimum:
VULKAN_SDK
VK_ICD_FILENAMES

And to do development work, like compiling programs and linking them with the vulkan sdk libraries, the variables should also be defined:
VK_LAYER_PATH
DYLD_LIBRARY_PATH

Maybe the DYLD_LIBRARY_PATH doesn’t need to be defined if the installation puts symlinks to libvulkan.dylib that points to Cellar location of the file. I’m not sure what the right way of doing that is either.

Also, I noticed that when I ran “brew create”, it automatically generated a name for the tap (vulkansdk-macos.rb). What is the proper name to renaming that to “vulkansdk” or just “vulkan”.

I’d really appreciate help with someone with experience with creating these formulas.

Thanks!


(Sean Molenaar) #2

I think there’s 4 questions here if I read it correctly.

  1. How do I make a tap?
  2. How do I create a formula for the vulkan SDK?
  3. How do I set variables?
  4. How do I rename a formula?

1: Creating a tap is nothing more than just creating a git repository containing the “correct” file structure explained here. Once you have that set up you can add (new) formulae to it.

2: A formula for the vulkan API is difficult in terms of homebrew install it would seem. First issue there would be the prebuild binaries. This would mean that your formula isn’t supposed to be a “normal” formula, but rather a “cask” formula. These formula are ‘allowed’ to install applications and prebuilt binaries.

3: I’m afraid variables should be left to the user to define. You should just print them in the caveats of your formula.

4: You should just rename the file and the class inside it and you’re good to go.


#3

Thanks for your feedback! I will look at creating a cask for this.


#4

Well, I created a cask named vulkan-sdk which was recently deleted from the cask repo. A discussion about that is in this thread.

Maybe we can use this thread to collaborate on working on a vulkan-sdk formula.


(Sean Molenaar) #5

If the macOS build isn’t open source it won’t be accepted as a formula, you’ll either have to maintain it as a tap or fix the issues with the cask I guess.


(Sean Molenaar) #6

Reading the issue on the vulkan/lunar board I guess you could build it from source, it’ll just need some work. As for collaboration, usually that happens on the pull request people create for a formula.