gr3.9 build process updates

This commit is contained in:
Max 2022-06-07 16:23:31 -04:00
parent b2ec8b376e
commit 86a609d743
7 changed files with 133 additions and 9 deletions

View File

@ -57,6 +57,8 @@ op25_dir = DEST_DIR + '/op25'
os.mkdir(op25_dir)
os.chdir(op25_dir)
SCRIPTS = SRC_DIR + '/scripts'
def edit_cmake(filename, mod, srcfiles):
lines = open(filename).read().rstrip().split('\n')
srcdefs = []
@ -131,30 +133,39 @@ for mod in sorted(MODS.keys()):
incl = '%s/include/%s' % (pfx, mod)
d_pfx = '%s/op25/gr-%s' % (DEST_DIR, mod)
d_lib = '%s/lib' % d_pfx
d_incl = '%s/include/%s' % (d_pfx, mod)
d_incl_alt1 = '%s/include/%s' % (d_pfx, mod)
d_incl_alt2 = '%s/include/gnuradio/%s' % (d_pfx, mod)
if os.path.isdir(d_incl_alt1):
d_incl = d_incl_alt1
elif os.path.isdir(d_incl_alt2):
d_incl = d_incl_alt2
sl = 'gnuradio/%s' % mod
os.symlink(sl, '%s/include/%s' % (d_pfx, mod))
else:
sys.stderr.write('neither %s nor %s found, aborting\n' % (d_incl_alt1, d_incl_alt2))
sys.exit(1)
for block in MODS[mod]:
include = '%s/%s.h' % (incl, block)
args = get_args_from_h(include)
t = 'sync' if block == 'fsk4_slicer_fb' else 'general'
t = 'sync' if block == 'fsk4_slicer_fb' or block == 'pcap_source_b' else 'general'
print ('add %s %s type %s directory %s args %s' % (mod, block, t, os.getcwd(), args))
m = ModToolAdd(blockname=block,block_type=t,lang='cpp',copyright='Steve Glass, OP25 Group', argument_list=args)
m.run()
assert os.path.isdir(d_incl)
os.system('/bin/bash %s/%s %s' % (SCRIPTS, 'do_sedm.sh', d_incl))
srcfiles = []
srcfiles += glob.glob('%s/lib/*.cc' % pfx)
srcfiles += glob.glob('%s/lib/*.cpp' % pfx)
srcfiles += glob.glob('%s/lib/*.c' % pfx)
srcfiles += glob.glob('%s/lib/*.h' % pfx)
hfiles = []
hfiles += glob.glob('%s/include/%s/*.h' % (pfx, mod))
assert os.path.isdir(d_lib)
assert os.path.isdir(d_incl)
for f in srcfiles:
shutil.copy(f, d_lib)
for f in hfiles:
shutil.copy(f, d_incl)
if mod == 'op25_repeater':
for d in 'imbe_vocoder ezpwd'.split():
@ -167,11 +178,19 @@ for mod in sorted(MODS.keys()):
edit_cmake('%s/CMakeLists.txt' % d_lib, mod, srcfiles)
os.system('/bin/bash %s/do_sed.sh' % (SRC_DIR))
os.system('/bin/bash %s/do_sed.sh' % (SCRIPTS))
f = '%s/CMakeLists.txt' % (d_pfx)
if mod == 'op25':
exe = '%s/do_sedb.sh %s' % (SCRIPTS, f)
elif mod == 'op25_repeater':
exe = '%s/do_sedc.sh %s' % (SCRIPTS, f)
os.system('/bin/bash %s %s' % (exe, f))
os.system('/bin/bash %s/do_sedp.sh %s' % (SCRIPTS, f))
os.system('/bin/bash %s/do_sedp2.sh %s' % (SCRIPTS, d_pfx))
for block in MODS[mod]:
print ('bind %s %s' % (mod, block))
m = ModToolGenBindings(block, addl_includes='', define_symbols='')
m = ModToolGenBindings(block, addl_includes='', define_symbols='', update_hash_only=False)
m.run()
os.chdir(op25_dir)

12
scripts/do_sed.sh Executable file
View File

@ -0,0 +1,12 @@
#! /bin/bash
srcs=`find lib include -name '*.c' -o -name '*.h' -o -name '*.cc'`
files=`grep -l 'boost.*shared_ptr' $srcs`
dir=`pwd`
for f in $files; do
echo editing file $f in $dir
sed -i 's%boost/shared_ptr.hpp%memory%' $f
sed -i 's%boost::shared_ptr%std::shared_ptr%' $f
done

32
scripts/do_sedb.sh Executable file
View File

@ -0,0 +1,32 @@
#! /bin/bash
me=$0
f=$1
echo "$me processing $f"
sed -i -f - $f << EOF
/^# Make sure our local CMake Modules path comes first/i\
########################################################################\n\
# Find boost\n\
########################################################################\n\
if(UNIX AND EXISTS "/usr/lib64")\n\
list(APPEND BOOST_LIBRARYDIR "/usr/lib64") #fedora 64-bit fix\n\
endif(UNIX AND EXISTS "/usr/lib64")\n\
set(Boost_ADDITIONAL_VERSIONS\n\
"1.35.0" "1.35" "1.36.0" "1.36" "1.37.0" "1.37" "1.38.0" "1.38" "1.39.0" "1.39"\n\
"1.40.0" "1.40" "1.41.0" "1.41" "1.42.0" "1.42" "1.43.0" "1.43" "1.44.0" "1.44"\n\
"1.45.0" "1.45" "1.46.0" "1.46" "1.47.0" "1.47" "1.48.0" "1.48" "1.49.0" "1.49"\n\
"1.50.0" "1.50" "1.51.0" "1.51" "1.52.0" "1.52" "1.53.0" "1.53" "1.54.0" "1.54"\n\
"1.55.0" "1.55" "1.56.0" "1.56" "1.57.0" "1.57" "1.58.0" "1.58" "1.59.0" "1.59"\n\
"1.60.0" "1.60" "1.61.0" "1.61" "1.62.0" "1.62" "1.63.0" "1.63" "1.64.0" "1.64"\n\
"1.65.0" "1.65" "1.66.0" "1.66" "1.67.0" "1.67" "1.68.0" "1.68" "1.69.0" "1.69"\n\
"1.74.0" "1.74"\n\
)\n\
find_package(Boost "1.35" COMPONENTS filesystem system)\n\
\n\
if(NOT Boost_FOUND)\n\
message(FATAL_ERROR "Boost required to compile op25")\n\
endif()\n\
EOF

6
scripts/do_sedc.sh Executable file
View File

@ -0,0 +1,6 @@
#! /bin/bash
me=$0
f=$1
echo "$me editing file $f"
sed -i '/^find_package(Gnuradio .*REQUIRED)/s/)/ COMPONENTS blocks fft filter)/' $f

15
scripts/do_sedm.sh Executable file
View File

@ -0,0 +1,15 @@
#! /bin/bash
me=$0
dir=$1
files=`grep -l msg_queue ${dir}/*.h`
echo "$me processing directory $dir, files $files"
for f in $files; do
echo processing $f
sed -i -f - $f << EOF
/include.*block.h/a\
#include <gnuradio/msg_queue.h>
EOF
done

27
scripts/do_sedp.sh Executable file
View File

@ -0,0 +1,27 @@
#! /bin/bash
me=$0
f=$1
echo "$me processing $f"
sed -i -f - $f << EOF
/Set the version information here/i\
###############################################################\n\
# Determine where to install python libs\n\
###############################################################\n\
execute_process(COMMAND python3 -c "\n\
import os\n\
import sys\n\
pfx = '/usr/local'\n\
path=os.path.join(pfx, 'lib', 'python%d.%d' % sys.version_info[:2], 'dist-packages')\n\
if os.path.isdir(path) and path in sys.path:\n\
print(path)\n\
sys.exit(0)\n\
p=[path for path in sys.path if path.startswith(pfx)][0]\n\
print(p)\n\
" OUTPUT_VARIABLE OP25_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE\n\
)\n\
MESSAGE(STATUS "OP25_PYTHON_DIR has been set to \\\"\${OP25_PYTHON_DIR}\\\".")\n\
EOF

13
scripts/do_sedp2.sh Executable file
View File

@ -0,0 +1,13 @@
#! /bin/bash
me=$0
dir=$1
files=`grep -lr GR_PYTHON_DIR ${dir}`
echo "$me processing directory $dir, files $files"
for f in $files; do
echo editing $f
sed -i '/GR_PYTHON_DIR/s%GR_PYTHON_DIR}/gnuradio%OP25_PYTHON_DIR}%' $f
done