Dear all I was able to get the new-driver script working with the new non-recursive build system with a few modifications.
I attach my patch below. Best Abhishek P.S. This is my first patch to libsigrok. >From aefd1c9b46275dc52d35114e16569acbdd2d57e7 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar <[email protected]> Date: Sat, 22 Mar 2014 12:10:10 +0530 Subject: [PATCH] Adapted new-driver to new build system --- source/new-driver | 57 +++++++++++-------------------------------------------- 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/source/new-driver b/source/new-driver index 2f8d5a0..79be2ae 100755 --- a/source/new-driver +++ b/source/new-driver @@ -40,9 +40,12 @@ fi """ TMPL_AUTOCONF_AC_CONFIG_FILES = "\t\t hardware/${short}/Makefile\n" TMPL_AUTOCONF_SUMMARY = 'echo " - ${summary}"\n' -TMPL_HWMAKE_SUBDIR = '\t${short}' + TMPL_HWMAKE_DRIVERLIB = """if HW_${upper} -libsigrokhardware_la_LIBADD += ${short}/libsigrok_hw_${lib}.la +libsigrok_la_SOURCES += \ + hardware/${short}/protocol.h \ + hardware/${short}/protocol.c \ + hardware/${short}/api.c endif """ @@ -56,7 +59,6 @@ TMPL_HWDRIVER_DIPTR = """\ &${lib}_driver_info, #endif """ -FILE_DRV_MAKEFILE = 'drv-Makefile.am' FILE_DRV_API = 'drv-api.c' FILE_DRV_PROTOCOL = 'drv-protocol.c' FILE_DRV_PROTOCOL_H = 'drv-protocol.h' @@ -119,29 +121,6 @@ def do_configure_ac(gitdir): raise Exception('AC_ARG_ENABLE markers not found in configure.ac') configure_ac = out - # add driver Makefile to AC_CONFIG_FILES - out = '' - state = 'copy' - for line in configure_ac.split('\n')[:-1]: - if state == 'copy': - if line.find("AC_CONFIG_FILES([Makefile") > -1: - state = 'acconf' - elif state == 'acconf': - m = re.match('\t\t hardware/([^/]+)/Makefile', line) - if m: - drv_short = m.group(1) - if drv_short.lower() > names['short']: - out += tmpl(TMPL_AUTOCONF_AC_CONFIG_FILES) - state = 'done' - else: - # new one at the end - out += tmpl(TMPL_AUTOCONF_AC_CONFIG_FILES) - state = 'done' - out += line + '\n' - if state != 'done': - raise Exception('AC_CONFIG_FILES marker not found in configure.ac') - configure_ac = out - # add summary line out = '' state = 'copy' @@ -208,25 +187,15 @@ def do_hwdriver(gitdir): def do_hwmake(gitdir): - path = gitdir + 'hardware/Makefile.am' + path = gitdir + 'Makefile.am' hwmake = open(path).read() - # add SUBDIRS entry + # add entry at correct place in Makefile out = '' state = 'copy' for line in hwmake.split('\n')[:-1]: if state == 'copy': - if line.find('SUBDIRS =') > -1: - state = 'subdirs' - elif state == 'subdirs': - m = re.match('\t([^ \\\]+\s*\\\)', line) - if m: - drv_short = m.group(1) - if drv_short.lower() > names['short']: - out += tmpl(TMPL_HWMAKE_SUBDIR) + ' \\\n' - state = 'driverlib' - else: - out += tmpl(TMPL_HWMAKE_SUBDIR) + ' \\\n' + if line.find('# Hardware drivers') > -1: state = 'driverlib' elif state == 'driverlib': m = re.match('if [A-Z]{2}_(.*)$', line) @@ -236,11 +205,8 @@ def do_hwmake(gitdir): out += tmpl(TMPL_HWMAKE_DRIVERLIB) state = 'done' out += line + '\n' - if state == 'driverlib': - # reached end of file, add it in here - out += tmpl(TMPL_HWMAKE_DRIVERLIB).strip() - elif state != 'done': - raise Exception('markers not found in hardware/Makefile.am') + if state != 'done': + raise Exception('markers not found in Makefile.am') hwmake = out open(path, 'w').write(hwmake) @@ -249,7 +215,6 @@ def do_hwmake(gitdir): def do_driverskel(gitdir): drvdir = gitdir + 'hardware/' + names['short'] os.mkdir(drvdir) - open(drvdir + '/Makefile.am', 'w').write(tmpl_file(FILE_DRV_MAKEFILE)) open(drvdir + '/api.c', 'w').write(tmpl_file(FILE_DRV_API)) open(drvdir + '/protocol.c', 'w').write(tmpl_file(FILE_DRV_PROTOCOL)) open(drvdir + '/protocol.h', 'w').write(tmpl_file(FILE_DRV_PROTOCOL_H)) @@ -259,7 +224,7 @@ def make_patch(gitdir): os.chdir(gitdir) command('git add hardware/' + names['short']) cmd = 'git commit -m "%s: Initial driver skeleton." ' % names['short'] - cmd += 'configure.ac hwdriver.c hardware/Makefile.am hardware/' + names['short'] + cmd += 'configure.ac Makefile.am hwdriver.c hardware/' + names['short'] command(cmd) cmd = "git format-patch HEAD~1" out, err = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE).communicate() -- 1.8.1.msysgit.1 ------------------------ Powered by BigRock.com ------------------------------------------------------------------------------ Learn Graph Databases - Download FREE O'Reilly Book "Graph Databases" is the definitive new guide to graph databases and their applications. Written by three acclaimed leaders in the field, this first edition is now available. Download your free book today! http://p.sf.net/sfu/13534_NeoTech _______________________________________________ sigrok-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/sigrok-devel

