Skip to content

Commit 02a5426

Browse files
committed
version 0.0.1 rockspec
1 parent a490902 commit 02a5426

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

rockspecs/lrtmidi-0.0.1-1.rockspec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package = "lrtmidi"
2+
version = "0.0.1-1"
3+
local versionNumber = version:gsub("^(.*)-.-$", "%1")
4+
source = {
5+
url = "https://github.com/osch/lua-lrtmidi/archive/v"..versionNumber..".zip",
6+
dir = "lua-lrtmidi-"..versionNumber,
7+
}
8+
description = {
9+
summary = "Lua binding for the RtMidi",
10+
homepage = "https://github.com/osch/lua-lrtmidi",
11+
license = "MIT",
12+
detailed = [[
13+
Lua binding for RtMidi ( http://www.music.mcgill.ca/~gary/rtmidi/ ).
14+
]],
15+
}
16+
dependencies = {
17+
"lua >= 5.1, <= 5.4",
18+
}
19+
build = {
20+
type = "builtin",
21+
modules = {
22+
lrtmidi = {
23+
libraries = {
24+
"rtmidi"
25+
},
26+
sources = {
27+
"src/main.cpp",
28+
"src/midibase.cpp",
29+
"src/midiin.cpp",
30+
"src/midiout.cpp",
31+
"src/async_util.cpp",
32+
"src/error.cpp",
33+
"src/lrtmidi_compat.c"
34+
},
35+
defines = { "LRTMIDI_VERSION="..versionNumber },
36+
},
37+
}
38+
}

rockspecs/setversion.lua

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/lua
2+
3+
os.setlocale("C")
4+
5+
local format = string.format
6+
local lfs = require("lfs")
7+
8+
local version = ...
9+
assert(version:match("^%d+%.%d+%.%d+$"), format("invalid version %q", version))
10+
11+
for fileName in lfs.dir(".") do
12+
local p1, v, p2 = fileName:match("^(lrtmidi%-)(%d+%.%d+%.%d+)(%-%d+%.rockspec)$")
13+
if p1 then
14+
local newName = p1..version..p2
15+
print(format("%-30s -> %s", fileName, newName))
16+
local out = {}
17+
local matched = false
18+
local inFile = io.open(fileName, "r")
19+
for line in inFile:lines() do
20+
local l1, l2 = line:match("^(%s*version%s*%=%s*\")%d+%.%d+%.%d+(%-%d+\"%s*)$")
21+
if l1 then
22+
assert(not matched)
23+
matched = true
24+
out[#out+1] = l1..version..l2
25+
else
26+
out[#out+1] = line
27+
end
28+
end
29+
out[#out+1] = ""
30+
inFile:close()
31+
assert(matched)
32+
local newFile, err = io.open(newName, "w")
33+
assert(newFile, err)
34+
newFile:write(table.concat(out, "\n"))
35+
newFile:close()
36+
if fileName ~= newName then
37+
os.remove(fileName)
38+
end
39+
end
40+
end

0 commit comments

Comments
 (0)