Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}
`
Comment on lines +8 to +14

Copy link
Copy Markdown
Contributor

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, and main returns 0 unconditionally. Upstream, rawmidi_hw_print_info returns -1 when it cannot open the device, which is the normal case in a CI/container sandbox where /dev/midi does not exist. As a result onTest only 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_info is the only reasonable entry point, treating compile+link as the real assertion and documenting that the run is best-effort.


// Conan Center cci.20130325 pins krgn/tinymidi to this untagged commit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Pin comment sits on id, not on the line that encodes the pin

This comment documents the commit/version pin, but it is attached to the id line rather than the fromVer "3162cf8…" line (line 19), which is what actually encodes the pinned commit. Consider moving it above fromVer. Reflecting the human-readable date the cci.20130325 label carries would also help, since the raw hash does not convey it.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] freebsd accepted by filter, but code path is Linux/ALSA-specific

The filter accepts both linux and freebsd, but tinymidi's rawmidi.c uses Linux kernel UAPI ioctls (SNDRV_RAWMIDI_IOCTL_*) and the /dev/midi device path — Linux ALSA constructs. A FreeBSD build would likely fail to compile/link. Please confirm upstream actually builds on FreeBSD (the Conan recipe this mirrors is the source of truth); otherwise drop freebsd.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] fPIC / shared diverge from Conan contract without a note

Conan's recipe removes fPIC when shared=True (self.options.rm_safe("fPIC")), because position-independent code is implied/meaningless for a shared build. This formula passes BUILD_SHARED_LIBS and CMAKE_POSITION_INDEPENDENT_CODE independently, so shared=ON, fPIC=OFF is silently allowed — a divergence from the recipe it claims to mirror. A one-line comment noting that fPIC is irrelevant when shared=ON (as Conan enforces) would prevent confusion. The sibling json-c documents exactly this kind of shared/fPIC rationale.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] DYLD_LIBRARY_PATH is dead code; env vars mutated without restore

DYLD_LIBRARY_PATH is macOS-specific, but the filter restricts the OS to linux/freebsd, so this line never has any effect — consider removing it for clarity. Additionally, both env vars are set on the process and never restored; if the runner reuses the process across formulas/targets, a leaked LD_LIBRARY_PATH could influence a later step's dynamic loading. Scoping these to the child exec (per-command env) or restoring the prior values afterward would be safer. Values are derived from the trusted installDir, so there is no injection risk — this is purely about cleanliness/isolation.

}
exec! binary
}
4 changes: 4 additions & 0 deletions krgn/tinymidi/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"path": "krgn/tinymidi",
"deps": {}
}
Comment on lines +1 to +4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The 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 versions.json files (recp/cglm, json-c/json-c, madler/zlib) use tab indentation; this file uses 2 spaces. Convert to tabs for repo consistency.

Loading