-
Notifications
You must be signed in to change notification settings - Fork 2
feat(tinymidi): add LLAR formula #153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| cmake_minimum_required(VERSION 3.15) | ||
| project(tinymidi LANGUAGES C) | ||
|
|
||
| add_library(tinymidi ${TINYMIDI_SRC_DIR}/rawmidi.c) | ||
|
|
||
| include(GNUInstallDirs) | ||
| install(FILES ${TINYMIDI_SRC_DIR}/include/rawmidi.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
| install( | ||
| TARGETS tinymidi | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| import ( | ||
| "os" | ||
| "path/filepath" | ||
| "slices" | ||
| "strings" | ||
| ) | ||
|
|
||
| const consumerSource = `#include <rawmidi.h> | ||
|
|
||
| int main(void) { | ||
| rawmidi_hw_print_info("/dev/midi"); | ||
| return 0; | ||
| } | ||
| ` | ||
|
|
||
| // Conan Center cci.20130325 pins krgn/tinymidi to this untagged commit. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Pin comment sits on This comment documents the commit/version pin, but it is attached to the |
||
| id "krgn/tinymidi" | ||
|
|
||
| fromVer "3162cf8faff04e26a8daa846618b90326f71b9d5" | ||
|
|
||
| defaults { | ||
| "shared": "OFF", | ||
| "fPIC": "ON", | ||
| } | ||
|
|
||
| filter => { | ||
| for name, values in target.options { | ||
| if name != "shared" && name != "fPIC" { | ||
| return false | ||
| } | ||
| for value in values { | ||
| if value != "ON" && value != "OFF" { | ||
| return false | ||
| } | ||
| } | ||
| } | ||
| for value in target.require["os"] { | ||
| if value != "linux" && value != "freebsd" { | ||
| return false | ||
| } | ||
| } | ||
|
Comment on lines
+37
to
+41
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] The Either way, add a one-line comment explaining why the OS set is restricted — this is a load-bearing constraint (Conan's recipe validates "Only Linux and FreeBSD are supported") and, unlike the sibling formulas, it currently has no rationale. |
||
| return true | ||
| } | ||
|
|
||
| onBuild ctx => { | ||
| installDir := ctx.outputDir | ||
|
|
||
| cmakeLists := ctx.Proj.readFile("3162cf8faff04e26a8daa846618b90326f71b9d5/CMakeLists.txt")! | ||
| os.writeFile(filepath.join(ctx.SourceDir, "CMakeLists.txt"), cmakeLists, 0o644)! | ||
|
|
||
| shared := slices.contains(target.options["shared"], "ON") | ||
| fPIC := slices.contains(target.options["fPIC"], "ON") | ||
| c := cmake.new(ctx.SourceDir, filepath.join(ctx.SourceDir, "_build"), installDir) | ||
| c.define "TINYMIDI_SRC_DIR", ctx.SourceDir | ||
| c.define "CMAKE_INSTALL_LIBDIR", "lib" | ||
| c.defineBool "BUILD_SHARED_LIBS", shared | ||
| c.defineBool "CMAKE_POSITION_INDEPENDENT_CODE", fPIC | ||
|
Comment on lines
+56
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Conan's recipe removes |
||
| c.configure | ||
| c.build | ||
| c.install | ||
|
|
||
| licenseDir := filepath.join(installDir, "licenses") | ||
| os.mkdirAll(licenseDir, 0o755)! | ||
| os.writeFile(filepath.join(licenseDir, "COPYING"), os.readFile(filepath.join(ctx.SourceDir, "COPYING"))!, 0o644)! | ||
|
|
||
| pcDir := filepath.join(installDir, "lib", "pkgconfig") | ||
| os.mkdirAll(pcDir, 0o755)! | ||
| pc := `prefix=$${pcfiledir}/../.. | ||
| includedir=$${prefix}/include | ||
| libdir=$${prefix}/lib | ||
|
|
||
| Name: tinymidi | ||
| Description: A small C library for doing MIDI on GNU/Linux | ||
| Version: 3162cf8faff04e26a8daa846618b90326f71b9d5 | ||
| Libs: -L$${libdir} -ltinymidi | ||
| Cflags: -I$${includedir} | ||
| ` | ||
| os.writeFile(filepath.join(pcDir, "tinymidi.pc"), []byte(pc), 0o644)! | ||
|
|
||
| pkgconfig.use installDir | ||
| ctx.setMetadata pkgconfig.lookup("tinymidi")! | ||
| } | ||
|
|
||
| onTest ctx => { | ||
| installDir := ctx.outputDir | ||
| testDir := os.mkdirTemp("", "tinymidi-consumer-")! | ||
| defer os.removeAll(testDir) | ||
| testSource := filepath.join(testDir, "consumer.c") | ||
| binary := filepath.join(testDir, "consumer") | ||
| os.writeFile(testSource, []byte(consumerSource), 0o644)! | ||
|
|
||
| pkgconfig.use installDir | ||
| args := []string{testSource} | ||
| args <- strings.fields(pkgconfig.lookup("tinymidi")!)... | ||
| args <- "-o", binary | ||
| cc! args... | ||
|
|
||
| if slices.contains(target.options["shared"], "ON") { | ||
| os.setenv("LD_LIBRARY_PATH", filepath.join(installDir, "lib"))! | ||
| os.setenv("DYLD_LIBRARY_PATH", filepath.join(installDir, "lib"))! | ||
|
Comment on lines
+99
to
+100
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3]
|
||
| } | ||
| exec! binary | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "path": "krgn/tinymidi", | ||
| "deps": {} | ||
| } | ||
|
Comment on lines
+1
to
+4
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] versions.json uses 2-space indentation; siblings use tabs All three sibling |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] onTest does not verify the library — device-call result is discarded
The consumer calls
rawmidi_hw_print_info("/dev/midi")but ignores its return value, andmainreturns0unconditionally. Upstream,rawmidi_hw_print_inforeturns-1when it cannot open the device, which is the normal case in a CI/container sandbox where/dev/mididoes not exist. As a resultonTestonly proves that the headers/library compile and link — the run is a no-op that always "passes."By contrast the cglm and json-c consumers call pure library functions that produce a deterministic, host-independent result. Consider either exercising a tinymidi API that does not require a hardware device, or, if
rawmidi_hw_print_infois the only reasonable entry point, treating compile+link as the real assertion and documenting that the run is best-effort.