tentative x-platform cmd and lv2

This commit is contained in:
Stefano D'Angelo 2024-01-30 09:56:00 +01:00
parent 008f0371d3
commit 03813fe631
4 changed files with 60 additions and 45 deletions

View File

@ -1,12 +1,25 @@
include vars.mk
PHONY_TARGETS = all clean
ifeq ($(OS), Windows_NT)
EXE_SUFFIX = .exe
else
EXE_SUFFIX =
PHONY_TARGETS += install
PREFIX = /usr/local
BINDIR = ${PREFIX}/bin
endif
CC = gcc
CFLAGS = -I${TINYWAV_DIR} -I${MIDI_PARSER_DIR}/include -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
all: build/${BUNDLE_NAME}
PROGRAM = ${BUNDLE_NAME}${EXE_SUFFIX}
build/${BUNDLE_NAME}: src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
all: build/${PROGRAM}
build/${PROGRAM}: src/main.c ${TINYWAV_DIR}/tinywav.c ${MIDI_PARSER_DIR}/src/midi-parser.c | build
${CC} $^ -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS_EXTRA}
build:
@ -15,4 +28,10 @@ build:
clean:
rm -fr build
.PHONY: all clean
ifneq ($(OS), Windows_NT)
install: all
mkdir -p -m 0755 ${BINDIR}
install -m 0755 build/${PROGRAM} ${BINDIR}
endif
.PHONY: ${PHONY_TARGETS}

View File

@ -1,5 +1,25 @@
include vars.mk
ifeq ($(OS), Windows_NT)
DLL_SUFFIX = .dll
COMMONPROGRAMFILES = $(shell echo '${COMMONPROGRAMFILES}' | sed 's:\\:/:g')
APPDATA = $(shell echo '${APPDATA}' | sed 's:\\:/:g')
LV2DIR = ${COMMONPROGRAMFILES}/LV2
LV2DIR_USER = ${APPDATA}/LV2
else
UNAME_S = $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
DLL_SUFFIX = .dylib
LV2DIR = /Library/Audio/Plug-Ins/LV2
LV2DIR_USER = ${HOME}/Library/Audio/Plug-Ins/LV2
else
DLL_SUFFIX = .so
PREFIX = /usr/local
LV2DIR = ${PREFIX}/lib/lv2
LV2DIR_USER = ${HOME}/.lv2
endif
endif
CC = gcc
CFLAGS = -fPIC -Wall -Wpedantic -Wextra -Wno-unused-parameter
@ -7,14 +27,14 @@ LDFLAGS = -shared
BUNDLE_DIR = ${BUNDLE_NAME}.lv2
SO_FILE = ${BUNDLE_NAME}.so
DLL_FILE = ${BUNDLE_NAME}${DLL_SUFFIX}
all: build/${BUNDLE_DIR}/manifest.ttl build/${BUNDLE_DIR}/${SO_FILE}
all: build/${BUNDLE_DIR}/manifest.ttl build/${BUNDLE_DIR}/${DLL_FILE}
build/${BUNDLE_DIR}/manifest.ttl: data/manifest.ttl | build/${BUNDLE_DIR}
cp $^ $@
build/${BUNDLE_DIR}/manifest.ttl: data/manifest.ttl.in | build/${BUNDLE_DIR}
cat $^ | sed s/@DLL_SUFFIX@/${DLL_SUFFIX}/g > $@
build/${BUNDLE_DIR}/${SO_FILE}: src/lv2.c | build/${BUNDLE_DIR}
build/${BUNDLE_DIR}/${DLL_FILE}: src/lv2.c | build/${BUNDLE_DIR}
${CC} $^ -o $@ ${CFLAGS} ${CFLAGS_EXTRA} ${LDFLAGS} ${LDFLAGS_EXTRA}
build/${BUNDLE_DIR}:
@ -23,4 +43,14 @@ build/${BUNDLE_DIR}:
clean:
rm -fr build
.PHONY: all clean
install: all
mkdir -p -m 0755 ${LV2DIR}/${BUNDLE_DIR}
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl ${LV2DIR}/${BUNDLE_DIR}
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} ${LV2DIR}/${BUNDLE_DIR}
install-user: all
mkdir -p -m 0755 ${LV2DIR_USER}/${BUNDLE_DIR}
install -m 0644 build/${BUNDLE_DIR}/manifest.ttl ${LV2DIR_USER}/${BUNDLE_DIR}
install -m 0755 build/${BUNDLE_DIR}/${DLL_FILE} ${LV2DIR_USER}/${BUNDLE_DIR}
.PHONY: all clean install install-user

View File

@ -10,7 +10,7 @@
{{?it.lv2.project}}
lv2:project {{=it.tibia.lv2.ttlURI(it.lv2.project)}} ;
{{?}}
lv2:binary <{{=it.product.bundleName}}.so> ;
lv2:binary <{{=it.product.bundleName}}@DLL_SUFFIX@> ;
doap:name "{{=it.product.name}}" ;
doap:maintainer [
a foaf:Organization ;

View File

@ -89,40 +89,6 @@ module.exports = function (data, api) {
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, audioPorts);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, midiPorts);
/*
var audioBuses = data.product.buses.filter(x => x.type == "audio");
var ports = [];
var bi = 0;
for (; bi < audioBuses.length; bi++) {
var b = audioBuses[bi];
if (b.channels == "mono") {
var e = { type: "audio", direction: b.direction, name: b.name, sidechain: b.sidechain, cv: b.cv, optional: b.optional, busIndex: bi };
e.symbol = data.lv2.busSymbols[bi];
ports.push(e);
} else {
var e = { type: "audio", direction: b.direction, name: b.name + " Left", shortName: b.shortName + " L", sidechain: b.sidechain, cv: b.cv, busIndex: bi };
e.symbol = data.lv2.busSymbols[bi] + "_L";
data.tibia.lv2.ports.push(e);
var e = { type: "audio", direction: b.direction, name: b.name + " Right", shortName: b.shortName + " R", sidechain: b.sidechain, cv: b.cv, busIndex: bi };
e.symbol = data.lv2.busSymbols[bi] + "_R";
ports.push(e);
}
}
ports.sort((a, b) => a.direction != b.direction ? (a.direction == "input" ? -1 : 1) : 0);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, ports);
var midiBuses = data.product.buses.filter(x => x.type == "midi");
var ports = [];
for (var i = 0; i < midiBuses.length; i++, bi++) {
var b = midiBuses[i];
var e = { type: "midi", direction: b.direction, name: b.name, sidechain: b.sidechain, control: b.control, optional: b.optional, busIndex: bi };
e.symbol = data.lv2.busSymbols[bi];
ports.push(e);
}
ports.sort((a, b) => a.direction != b.direction ? (a.direction == "input" ? -1 : 1) : 0);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, ports);
*/
var ports = [];
for (var i = 0; i < data.product.parameters.length; i++) {
var p = data.product.parameters[i];
@ -135,7 +101,7 @@ module.exports = function (data, api) {
ports.sort((a, b) => a.direction != b.direction ? (a.direction == "input" ? -1 : 1) : 0);
data.tibia.lv2.ports.push.apply(data.tibia.lv2.ports, ports);
api.generateFileFromTemplateFile(`data${sep}manifest.ttl`, `data${sep}manifest.ttl`, data);
api.generateFileFromTemplateFile(`data${sep}manifest.ttl.in`, `data${sep}manifest.ttl.in`, data);
api.copyFile(`src${sep}lv2.c`, `src${sep}lv2.c`);
api.generateFileFromTemplateFile(`src${sep}data.h`, `src${sep}data.h`, data);
};