Skip to content

Commit

Permalink
Merge pull request #12 from simonvanderveldt/install-norns-in-system-…
Browse files Browse the repository at this point in the history
…location

Install norns in system location
  • Loading branch information
simonvanderveldt authored Aug 30, 2019
2 parents 05cd17c + ca79898 commit 73adfef
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export JACK_NO_START_SERVER=1
export JACK_NO_AUDIO_RESERVATION=1
export NORNS_CONFIG="/usr/share/norns/lua/core/config.lua"
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[Manager]
DefaultEnvironment="JACK_NO_START_SERVER=1"
DefaultEnvironment=JACK_NO_START_SERVER=1 NORNS_CONFIG=/usr/share/norns/lua/core/config.lua
2 changes: 1 addition & 1 deletion package/dust/dust.hash
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Locally computed:
sha512 e73697bbf3f66302c3f33e72162de41e76aef24f41500f30949ff85621350cdc47868b414e7f359645cdb9244caa1dec129ba8c4798c6f7026f359b8b5ae150d dust-c10c62c24e88d1dc10c5eb3ed77f5b9b451fbe6c.tar.gz
sha512 f23fc37b8c6a40be226d5a587851dc8217db4484b082fe352e5c794d4a30357ef4ec64b37147811d4fd19c96f7d5f0e38accbabe505e775722029f57c5af60a0 norns-2.0.1-dust.tgz
12 changes: 6 additions & 6 deletions package/dust/dust.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
#
################################################################################

DUST_VERSION = c10c62c24e88d1dc10c5eb3ed77f5b9b451fbe6c
DUST_SITE = $(call github,monome,dust,$(DUST_VERSION))
DUST_VERSION = 2.0.1
DUST_SOURCE = norns-$(DUST_VERSION)-dust.tgz
DUST_SITE = https://monome.nyc3.digitaloceanspaces.com
DUST_LICENSE = GPL-3.0
DUST_LICENSE_FILES = LICENSE
DUST_DEPENDENCIES = norns

define DUST_INSTALL_TARGET_CMDS
mkdir -p $(TARGET_DIR)/root/dust
cp -a $(@D)/audio $(TARGET_DIR)/root/dust/audio
mkdir -p $(TARGET_DIR)/root/dust/data
mkdir -p $(TARGET_DIR)/root/dust/code
cp -a $(@D)/* $(TARGET_DIR)/root/dust
mkdir -p $(TARGET_DIR)/root/.config/SuperCollider
cp -a $(DUST_PKGDIR)/sclang_conf.yaml $(TARGET_DIR)/root/.config/SuperCollider/sclang_conf.yaml
endef

$(eval $(generic-package))
5 changes: 5 additions & 0 deletions package/dust/sclang_conf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
includePaths:
- ~/dust
excludePaths:
[]
postInlineWarnings: false
24 changes: 0 additions & 24 deletions package/norns/norns.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,4 @@ NORNS_INSTALL_STAGING = YES
NORNS_CONF_OPTS = --boost-includes=$(STAGING_DIR)/usr/include --boost-libs $(STAGING_DIR)/usr/lib
NORNS_DEPENDENCIES = avahi boost cairo libevdev liblo libmonome lua nanomsg supercollider

# TODO temp fix to copy required files to hardcoded locations
# These should be installed to system directories and defined in the wscript

define NORNS_POST_INSTALL_TARGET_USER
mkdir -p $(TARGET_DIR)/root/norns
cp -a $(@D)/resources ${TARGET_DIR}/root/norns/resources
cp -a $(@D)/lua ${TARGET_DIR}/root/norns/lua
mkdir -p $(TARGET_DIR)/root/norns/sc
cp -a $(@D)/sc/core ${TARGET_DIR}/root/norns/sc/
cp -a $(@D)/sc/engines ${TARGET_DIR}/root/norns/sc/
mkdir -p $(TARGET_DIR)/root/norns/sc/ugens
mkdir -p ${TARGET_DIR}/root/.local/share/SuperCollider/Extensions/
cp -a $(@D)/sc/norns-config.sc ${TARGET_DIR}/root/.local/share/SuperCollider/Extensions/
endef
NORNS_POST_INSTALL_TARGET_HOOKS += NORNS_POST_INSTALL_TARGET_USER

# define NORNS_POST_INSTALL_TARGET_EXTENSIONS
# mkdir -p $(TARGET_DIR)/usr/share/SuperCollider/Extensions
# for file in $$(find $(@D)/sc -name "*.sc"); do \
# cp $${file} $(TARGET_DIR)/usr/share/SuperCollider/Extensions/; \
# done
# endef
# NORNS_POST_INSTALL_TARGET_HOOKS += NORNS_POST_INSTALL_TARGET_EXTENSIONS

$(eval $(waf-package))
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 7a7e116b84b2a6aaeeb28098f6f90f89e54f187a Mon Sep 17 00:00:00 2001
From: Simon van der Veldt <[email protected]>
Date: Sun, 19 May 2019 22:21:52 +0200
Subject: [PATCH] sc/wscript: Install SC files to system-wide Supercollider
extension directory

---
sc/wscript | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/sc/wscript b/sc/wscript
index fe18b0e..9534ba5 100644
--- a/sc/wscript
+++ b/sc/wscript
@@ -1,4 +1,8 @@
-top = '..'
+def set_options(opt):
+ pass
+
+def configure(conf):
+ pass

def build_ugen(bld, target, source):
ugen = bld.shlib(features='c cxx',
@@ -34,3 +38,7 @@ def build(bld):
for u in ugens:
build_ugen(bld, u['target'], u['source'])
build_ugen_supernova(bld, u['target'], u['source'])
+
+ # Install SC files
+ bld.install_files('${PREFIX}/share/SuperCollider/Extensions/norns', bld.path.ant_glob('core/**/*'), relative_trick=True)
+ bld.install_files('${PREFIX}/share/SuperCollider/Extensions/norns', bld.path.ant_glob('engines/**/*'), relative_trick=True)
--
2.21.0
89 changes: 89 additions & 0 deletions package/norns/wscript-install-resources-in-system-location.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
From da328593c1aa599429f6de29f9b7f01143dbde5d Mon Sep 17 00:00:00 2001
From: Simon van der Veldt <[email protected]>
Date: Fri, 31 May 2019 23:24:19 +0200
Subject: [PATCH] wscript: Install resources in system location

---
lua/core/config.lua | 5 +++--
matron/src/hardware/screen.c | 9 ++++-----
wscript | 6 +++++-
3 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/lua/core/config.lua b/lua/core/config.lua
index fc6b9d3..86458ae 100644
--- a/lua/core/config.lua
+++ b/lua/core/config.lua
@@ -3,13 +3,14 @@
-- add some stuff to package.path
-- this consists of search patterns lua will use for require('foo')

-local home = os.getenv('HOME')
-local norns = home..'/norns/lua'
+local norns = '/usr/share/norns/lua'
local sys = norns..'/?.lua;'
local core = norns..'/core/?.lua;'
local params = norns..'/core/params/?.lua;'
local lib = norns..'/lib/?.lua;'
local softcut = norns..'/softcut/?.lua;'
+
+local home = os.getenv('HOME')
local dust = home..'/dust/code/?.lua;'

package.path = sys..core..params..lib..softcut..dust..package.path
diff --git a/matron/src/hardware/screen.c b/matron/src/hardware/screen.c
index 7bf3ac4..b9d796a 100644
--- a/matron/src/hardware/screen.c
+++ b/matron/src/hardware/screen.c
@@ -139,10 +139,10 @@ handle_allocate_error:
void screen_display_png(const char *filename, double x, double y){
int img_w, img_h;
//fprintf(stderr, "loading: %s\n", filename);
-
+
image = cairo_image_surface_create_from_png (filename);
if(image == NULL) { return; }
-
+
img_w = cairo_image_surface_get_width (image);
img_h = cairo_image_surface_get_height (image);

@@ -246,13 +246,12 @@ void screen_init(void) {
for (int i=0; i<NUM_FONTS; ++i) {
fprintf(stderr, " %d: %s\n", i, font_path[i]);
}
-
+
char filename[256];

for(int i = 0; i < NUM_FONTS; i++) {
// FIXME should be path relative to norns/
- snprintf(filename, 256, "%s/norns/resources/%s", getenv(
- "HOME"), font_path[i]);
+ snprintf(filename, 256, "/usr/share/norns/resources/%s", font_path[i]);

status = FT_New_Face(value, filename, 0, &face[i]);
if(status != 0) {
diff --git a/wscript b/wscript
index 6b928f5..81e466b 100644
--- a/wscript
+++ b/wscript
@@ -36,7 +36,7 @@ def configure(conf):
conf.check_cfg(package='lua53', args=['--cflags', '--libs'])
conf.check_cfg(package='nanomsg', args=['--cflags', '--libs'])
conf.check_cfg(package='avahi-compat-libdns_sd', args=['--cflags', '--libs'])
- conf.check_cfg(package='sndfile', args=['--cflags', '--libs'])
+ conf.check_cfg(package='sndfile', args=['--cflags', '--libs'])

conf.check_cc(msg='Checking for libmonome',
define_name='HAVE_LIBMONOME',
@@ -66,3 +66,7 @@ def build(bld):
bld.recurse('ws-wrapper')
bld.recurse('sc')
bld.recurse('crone')
+
+ # Install resources
+ bld.install_files('${PREFIX}/share/norns', bld.path.ant_glob('resources/**/*'), relative_trick=True)
+ bld.install_files('${PREFIX}/share/norns', bld.path.ant_glob('lua/**/*'), relative_trick=True)
--
2.21.0

0 comments on commit 73adfef

Please sign in to comment.