Switch build system to waf.
parent
371337a0d7
commit
0e4c0ddf10
|
@ -8,3 +8,6 @@ __pycache__/
|
|||
/.venv
|
||||
/website/_build/
|
||||
/website/_serve/
|
||||
/.waf*
|
||||
/.lock-waf*
|
||||
/venv/
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
-/build
|
||||
-/venv
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
VERSION = '6.8.0'
|
||||
DOWNLOAD_URL = 'https://github.com/csound/csound/archive/6.08.0.zip'
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class CSoundMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'csound')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def zip_path(self):
|
||||
return os.path.join(self.build_base, 'csound.zip')
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src')
|
||||
|
||||
@property
|
||||
def make_dir(self):
|
||||
return os.path.join(self.build_base, 'cs6make')
|
||||
|
||||
|
||||
class BuildCSound(CSoundMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_zip(self.zip_path)
|
||||
self._unpack_zip(self.zip_path, self.src_dir)
|
||||
self._cmake(self.src_dir, self.make_dir)
|
||||
self._make(self.make_dir)
|
||||
|
||||
def _download_zip(self, zip_path):
|
||||
if os.path.exists(zip_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(zip_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(zip_path + '.partial', zip_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_zip(self, zip_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with zipfile.ZipFile(zip_path) as fp:
|
||||
for path in fp.namelist():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _cmake(self, src_dir, make_dir):
|
||||
if os.path.exists(os.path.join(make_dir, 'Makefile')):
|
||||
return
|
||||
|
||||
if not os.path.isdir(make_dir):
|
||||
os.makedirs(make_dir)
|
||||
|
||||
print("Running cmake...")
|
||||
subprocess.run(
|
||||
['cmake',
|
||||
'-DBUILD_PYTHON_INTERFACE=0',
|
||||
'-DCMAKE_INSTALL_PREFIX=' + os.getenv('VIRTUAL_ENV'),
|
||||
os.path.abspath(src_dir)
|
||||
],
|
||||
cwd=make_dir,
|
||||
check=True)
|
||||
|
||||
def _make(self, make_dir):
|
||||
if os.path.exists(os.path.join(make_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running make...")
|
||||
subprocess.run(
|
||||
['make', '-j8'],
|
||||
cwd=make_dir,
|
||||
check=True)
|
||||
open(os.path.join(make_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallCSound(CSoundMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.csound-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running make install...")
|
||||
subprocess.run(
|
||||
['make', 'install'],
|
||||
cwd=self.make_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_csound', None))
|
||||
install.sub_commands.insert(0, ('install_csound', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'csound',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_csound': BuildCSound,
|
||||
'install_csound': InstallCSound,
|
||||
},
|
||||
)
|
|
@ -1,169 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
VERSION = '2.15.11'
|
||||
DOWNLOAD_URL = 'https://github.com/grame-cncm/faust/archive/%s.zip' % VERSION
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class FaustMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'faust')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def zip_path(self):
|
||||
return os.path.join(self.build_base, 'faust-%s.zip' % VERSION)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src-%s' % VERSION)
|
||||
|
||||
|
||||
class BuildFaust(FaustMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_zip(self.zip_path)
|
||||
self._unpack_zip(self.zip_path, self.src_dir)
|
||||
self._make(self.src_dir)
|
||||
|
||||
def _download_zip(self, zip_path):
|
||||
if os.path.exists(zip_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(zip_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(zip_path + '.partial', zip_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_zip(self, zip_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with zipfile.ZipFile(zip_path) as fp:
|
||||
for path in fp.namelist():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _make(self, make_dir):
|
||||
if os.path.exists(os.path.join(make_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running make...")
|
||||
subprocess.run(
|
||||
['make',
|
||||
'-j8',
|
||||
'PREFIX=' + os.getenv('VIRTUAL_ENV'),
|
||||
'compiler'],
|
||||
cwd=make_dir,
|
||||
check=True)
|
||||
open(os.path.join(make_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallFaust(FaustMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.faust-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running make install...")
|
||||
subprocess.run(
|
||||
['make',
|
||||
'PREFIX=' + os.getenv('VIRTUAL_ENV'),
|
||||
'install'],
|
||||
cwd=self.src_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_faust', None))
|
||||
install.sub_commands.insert(0, ('install_faust', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'faust',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_faust': BuildFaust,
|
||||
'install_faust': InstallFaust,
|
||||
},
|
||||
)
|
|
@ -1,158 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
VERSION = '0.20190330'
|
||||
COMMIT_ID = '64a57f5693573ed73409f16c0d7ba420cde6111e'
|
||||
DOWNLOAD_URL = 'https://github.com/grame-cncm/faustlibraries/archive/%s.zip' % COMMIT_ID
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class FaustLibrariesMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'faustlibraries')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def zip_path(self):
|
||||
return os.path.join(self.build_base, 'faustlibraries-%s.zip' % VERSION)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src-%s' % VERSION)
|
||||
|
||||
|
||||
class BuildFaustLibraries(FaustLibrariesMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_zip(self.zip_path)
|
||||
self._unpack_zip(self.zip_path, self.src_dir)
|
||||
|
||||
def _download_zip(self, zip_path):
|
||||
if os.path.exists(zip_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(zip_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(zip_path + '.partial', zip_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_zip(self, zip_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with zipfile.ZipFile(zip_path) as fp:
|
||||
for path in fp.namelist():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
|
||||
class InstallFaustLibraries(FaustLibrariesMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.faustlibraries-%s-installed' % VERSION)
|
||||
|
||||
@property
|
||||
def install_dir(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), 'share', 'faustlibraries')
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Copy files...")
|
||||
if os.path.isdir(self.install_dir):
|
||||
shutil.rmtree(self.install_dir)
|
||||
shutil.copytree(self.src_dir, self.install_dir)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_faustlibraries', None))
|
||||
install.sub_commands.insert(0, ('install_faustlibraries', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'faustlibraries',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_faustlibraries': BuildFaustLibraries,
|
||||
'install_faustlibraries': InstallFaustLibraries,
|
||||
},
|
||||
)
|
|
@ -1,219 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import tarfile
|
||||
import zipfile
|
||||
|
||||
# VERSION = '0.24.0'
|
||||
# FILENAME = 'lilv-%s.tar.bz2' % VERSION
|
||||
# DOWNLOAD_URL = 'http://git.drobilla.net/cgit.cgi/lilv.git/snapshot/%s' % FILENAME
|
||||
|
||||
VERSION = '0.24.3-git'
|
||||
FILENAME = 'master.zip'
|
||||
DOWNLOAD_URL = 'https://github.com/odahoda/lilv/archive/%s' % FILENAME
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class LilvMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'lilv')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def archive_path(self):
|
||||
return os.path.join(self.build_base, FILENAME)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src')
|
||||
|
||||
|
||||
class BuildLilv(LilvMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_archive(self.archive_path)
|
||||
self._unpack_archive(self.archive_path, self.src_dir)
|
||||
self._configure(self.src_dir)
|
||||
self._build(self.src_dir)
|
||||
|
||||
def _download_archive(self, archive_path):
|
||||
if os.path.exists(archive_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(archive_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(archive_path + '.partial', archive_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
# def _unpack_archive(self, archive_path, src_dir):
|
||||
# if os.path.isdir(src_dir):
|
||||
# return
|
||||
|
||||
# print("Extracting...")
|
||||
|
||||
# base_dir = None
|
||||
# with tarfile.open(archive_path, 'r:bz2') as fp:
|
||||
# for path in fp.getnames():
|
||||
# while path:
|
||||
# path, b = os.path.split(path)
|
||||
# if not path:
|
||||
# if base_dir is None:
|
||||
# base_dir = b
|
||||
# elif b != base_dir:
|
||||
# raise RuntimeError(
|
||||
# "No common base dir (%s)" % b)
|
||||
|
||||
# fp.extractall(self.build_base)
|
||||
|
||||
# os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
# print("Extracted to %s" % src_dir)
|
||||
# return src_dir
|
||||
|
||||
def _unpack_archive(self, archive_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with zipfile.ZipFile(archive_path, 'r') as fp:
|
||||
for path in fp.namelist():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.chmod(os.path.join(self.build_base, base_dir, 'waf'), 0o755)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _configure(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.configure.complete')):
|
||||
return
|
||||
|
||||
print("Running waf configure...")
|
||||
subprocess.run(
|
||||
['./waf',
|
||||
'configure',
|
||||
'--prefix=%s' % os.getenv('VIRTUAL_ENV'),
|
||||
'--bindings',
|
||||
'--no-utils',
|
||||
'--no-bash-completion',
|
||||
'--test',
|
||||
],
|
||||
cwd=src_dir,
|
||||
env=dict(
|
||||
os.environ,
|
||||
PKG_CONFIG_PATH=os.path.join(os.getenv('VIRTUAL_ENV'), 'lib', 'pkgconfig')),
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.configure.complete'), 'w').close()
|
||||
|
||||
def _build(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running waf build...")
|
||||
subprocess.run(
|
||||
['./waf', 'build'],
|
||||
cwd=src_dir,
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallLilv(LilvMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.lilv-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running waf install...")
|
||||
subprocess.run(
|
||||
['./waf', 'install'],
|
||||
cwd=self.src_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_lilv', None))
|
||||
install.sub_commands.insert(0, ('install_lilv', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'lilv',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_lilv': BuildLilv,
|
||||
'install_lilv': InstallLilv,
|
||||
},
|
||||
requires=['lv2'],
|
||||
)
|
|
@ -1,181 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import tarfile
|
||||
|
||||
VERSION = '1.14.0'
|
||||
FILENAME = 'lv2-%s.tar.xz' % VERSION
|
||||
DOWNLOAD_URL = 'http://lv2plug.in/git/cgit.cgi/lv2.git/snapshot/%s' % FILENAME
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class Lv2Mixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'lv2')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def archive_path(self):
|
||||
return os.path.join(self.build_base, FILENAME)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src')
|
||||
|
||||
|
||||
class BuildLv2(Lv2Mixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_archive(self.archive_path)
|
||||
self._unpack_archive(self.archive_path, self.src_dir)
|
||||
self._configure(self.src_dir)
|
||||
self._make(self.src_dir)
|
||||
|
||||
def _download_archive(self, archive_path):
|
||||
if os.path.exists(archive_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(archive_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(archive_path + '.partial', archive_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_archive(self, archive_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with tarfile.open(archive_path, 'r:xz') as fp:
|
||||
for path in fp.getnames():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _configure(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.configure.complete')):
|
||||
return
|
||||
|
||||
print("Running waf...")
|
||||
subprocess.run(
|
||||
['./waf',
|
||||
'configure',
|
||||
'--prefix=%s' % os.getenv('VIRTUAL_ENV')
|
||||
],
|
||||
cwd=src_dir,
|
||||
check=True)
|
||||
|
||||
open(os.path.join(src_dir, '.configure.complete'), 'w').close()
|
||||
|
||||
def _make(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running make...")
|
||||
subprocess.run(
|
||||
['./waf'],
|
||||
cwd=src_dir,
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallLv2(Lv2Mixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.lv2-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running make install...")
|
||||
subprocess.run(
|
||||
['./waf', 'install'],
|
||||
cwd=self.src_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_lv2', None))
|
||||
install.sub_commands.insert(0, ('install_lv2', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'lv2',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_lv2': BuildLv2,
|
||||
'install_lv2': InstallLv2,
|
||||
},
|
||||
)
|
|
@ -1,191 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import zipfile
|
||||
|
||||
VERSION = '3.7.1'
|
||||
FILENAME = 'v%s.zip' % VERSION
|
||||
DOWNLOAD_URL = 'https://github.com/google/protobuf/archive/%s' % FILENAME
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class ProtocMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'protoc')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def archive_path(self):
|
||||
return os.path.join(self.build_base, FILENAME)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src')
|
||||
|
||||
|
||||
class BuildProtoc(ProtocMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_archive(self.archive_path)
|
||||
self._unpack_archive(self.archive_path, self.src_dir)
|
||||
self._configure(self.src_dir)
|
||||
self._build(self.src_dir)
|
||||
|
||||
def _download_archive(self, archive_path):
|
||||
if os.path.exists(archive_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(archive_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(archive_path + '.partial', archive_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_archive(self, archive_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with zipfile.ZipFile(archive_path, 'r') as fp:
|
||||
for path in fp.namelist():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _configure(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.configure.complete')):
|
||||
return
|
||||
|
||||
print("Running autogen...")
|
||||
subprocess.run(
|
||||
['bash', 'autogen.sh'],
|
||||
cwd=src_dir,
|
||||
env=dict(
|
||||
os.environ,
|
||||
PKG_CONFIG_PATH=os.path.join(os.getenv('VIRTUAL_ENV'), 'lib', 'pkgconfig')),
|
||||
check=True)
|
||||
|
||||
print("Running configure...")
|
||||
subprocess.run(
|
||||
['./configure',
|
||||
'--prefix=%s' % os.getenv('VIRTUAL_ENV'),
|
||||
],
|
||||
cwd=src_dir,
|
||||
env=dict(
|
||||
os.environ,
|
||||
PKG_CONFIG_PATH=os.path.join(os.getenv('VIRTUAL_ENV'), 'lib', 'pkgconfig')),
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.configure.complete'), 'w').close()
|
||||
|
||||
def _build(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running make...")
|
||||
subprocess.run(
|
||||
['make', '-j8'],
|
||||
cwd=src_dir,
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallProtoc(ProtocMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.protoc-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running make install...")
|
||||
subprocess.run(
|
||||
['make', 'install'],
|
||||
cwd=self.src_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_protoc', None))
|
||||
install.sub_commands.insert(0, ('install_protoc', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'protoc',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_protoc': BuildProtoc,
|
||||
'install_protoc': InstallProtoc,
|
||||
},
|
||||
)
|
|
@ -1,184 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
from distutils import core
|
||||
from distutils.command.build import build
|
||||
from distutils.command.install import install
|
||||
import urllib.request
|
||||
import os
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import tarfile
|
||||
|
||||
VERSION = '0.10.0'
|
||||
FILENAME = 'suil-%s.tar.bz2' % VERSION
|
||||
DOWNLOAD_URL = 'http://git.drobilla.net/cgit.cgi/suil.git/snapshot/%s' % FILENAME
|
||||
|
||||
assert os.getenv('VIRTUAL_ENV'), "Not running in a virtualenv."
|
||||
|
||||
|
||||
class SuilMixin(object):
|
||||
user_options = [
|
||||
('build-base=', 'b',
|
||||
"base directory for build library"),
|
||||
]
|
||||
|
||||
def initialize_options(self):
|
||||
self.build_base = os.path.join(os.getenv('VIRTUAL_ENV'), 'build', 'suil')
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
def archive_path(self):
|
||||
return os.path.join(self.build_base, FILENAME)
|
||||
|
||||
@property
|
||||
def src_dir(self):
|
||||
return os.path.join(self.build_base, 'src')
|
||||
|
||||
|
||||
class BuildSuil(SuilMixin, core.Command):
|
||||
def run(self):
|
||||
if not os.path.isdir(self.build_base):
|
||||
os.makedirs(self.build_base)
|
||||
|
||||
self._download_archive(self.archive_path)
|
||||
self._unpack_archive(self.archive_path, self.src_dir)
|
||||
self._configure(self.src_dir)
|
||||
self._build(self.src_dir)
|
||||
|
||||
def _download_archive(self, archive_path):
|
||||
if os.path.exists(archive_path):
|
||||
return
|
||||
|
||||
total_bytes = 0
|
||||
with urllib.request.urlopen(DOWNLOAD_URL) as fp_in:
|
||||
with open(archive_path + '.partial', 'wb') as fp_out:
|
||||
last_report = time.time()
|
||||
try:
|
||||
while True:
|
||||
dat = fp_in.read(10240)
|
||||
if not dat:
|
||||
break
|
||||
fp_out.write(dat)
|
||||
total_bytes += len(dat)
|
||||
if time.time() - last_report > 1:
|
||||
sys.stderr.write(
|
||||
'Downloading %s: %d bytes\r'
|
||||
% (DOWNLOAD_URL, total_bytes))
|
||||
sys.stderr.flush()
|
||||
last_report = time.time()
|
||||
finally:
|
||||
sys.stderr.write('\033[K')
|
||||
sys.stderr.flush()
|
||||
|
||||
os.rename(archive_path + '.partial', archive_path)
|
||||
print('Downloaded %s: %d bytes' % (DOWNLOAD_URL, total_bytes))
|
||||
|
||||
def _unpack_archive(self, archive_path, src_dir):
|
||||
if os.path.isdir(src_dir):
|
||||
return
|
||||
|
||||
print("Extracting...")
|
||||
|
||||
base_dir = None
|
||||
with tarfile.open(archive_path, 'r:bz2') as fp:
|
||||
for path in fp.getnames():
|
||||
while path:
|
||||
path, b = os.path.split(path)
|
||||
if not path:
|
||||
if base_dir is None:
|
||||
base_dir = b
|
||||
elif b != base_dir:
|
||||
raise RuntimeError(
|
||||
"No common base dir (%s)" % b)
|
||||
|
||||
fp.extractall(self.build_base)
|
||||
|
||||
os.rename(os.path.join(self.build_base, base_dir), src_dir)
|
||||
print("Extracted to %s" % src_dir)
|
||||
return src_dir
|
||||
|
||||
def _configure(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.configure.complete')):
|
||||
return
|
||||
|
||||
print("Running waf configure...")
|
||||
subprocess.run(
|
||||
['./waf',
|
||||
'configure',
|
||||
'--prefix=%s' % os.getenv('VIRTUAL_ENV'),
|
||||
],
|
||||
cwd=src_dir,
|
||||
env=dict(
|
||||
os.environ,
|
||||
PKG_CONFIG_PATH=os.path.join(os.getenv('VIRTUAL_ENV'), 'lib', 'pkgconfig')),
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.configure.complete'), 'w').close()
|
||||
|
||||
def _build(self, src_dir):
|
||||
if os.path.exists(os.path.join(src_dir, '.build.complete')):
|
||||
return
|
||||
|
||||
print("Running waf build...")
|
||||
subprocess.run(
|
||||
['./waf', 'build'],
|
||||
cwd=src_dir,
|
||||
check=True)
|
||||
open(os.path.join(src_dir, '.build.complete'), 'w').close()
|
||||
|
||||
|
||||
class InstallSuil(SuilMixin, core.Command):
|
||||
@property
|
||||
def sentinel_path(self):
|
||||
return os.path.join(
|
||||
os.getenv('VIRTUAL_ENV'), '.suil-%s-installed' % VERSION)
|
||||
|
||||
def run(self):
|
||||
if os.path.exists(self.sentinel_path):
|
||||
return
|
||||
|
||||
print("Running waf install...")
|
||||
subprocess.run(
|
||||
['./waf', 'install'],
|
||||
cwd=self.src_dir,
|
||||
check=True)
|
||||
open(self.sentinel_path, 'w').close()
|
||||
|
||||
def get_outputs(self):
|
||||
return [self.sentinel_path]
|
||||
|
||||
|
||||
build.sub_commands.append(('build_suil', None))
|
||||
install.sub_commands.insert(0, ('install_suil', None))
|
||||
|
||||
|
||||
core.setup(
|
||||
name = 'suil',
|
||||
version = VERSION,
|
||||
cmdclass = {
|
||||
'build_suil': BuildSuil,
|
||||
'install_suil': InstallSuil,
|
||||
},
|
||||
requires=['lv2'],
|
||||
)
|
170
CMakeLists.txt
170
CMakeLists.txt
|
@ -1,170 +0,0 @@
|
|||
# @begin:license
|
||||
#
|
||||
# Copyright (c) 2015-2019, Benjamin Niemann <pink@odahoda.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
# @end:license
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project (noisicaä)
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)
|
||||
|
||||
find_package(Cython REQUIRED)
|
||||
|
||||
if("$ENV{VIRTUAL_ENV}" STREQUAL "")
|
||||
message(FATAL_ERROR "Not running in a virtual env.")
|
||||
endif("$ENV{VIRTUAL_ENV}" STREQUAL "")
|
||||
|
||||
find_package(PythonLibs REQUIRED)
|
||||
include_directories(${PYTHON_INCLUDE_DIRS})
|
||||
|
||||
set(ENV{PKG_CONFIG_PATH} $ENV{VIRTUAL_ENV}/lib/pkgconfig)
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(LIBSRATOM REQUIRED sratom-0)
|
||||
pkg_check_modules(LIBLILV REQUIRED lilv-0)
|
||||
pkg_check_modules(LIBSUIL REQUIRED suil-0>=0.10.0)
|
||||
pkg_check_modules(LIBSNDFILE REQUIRED sndfile)
|
||||
pkg_check_modules(LIBFLUIDSYNTH REQUIRED fluidsynth>=1.1.6)
|
||||
pkg_check_modules(LIBAVUTIL REQUIRED libavutil)
|
||||
pkg_check_modules(LIBSWRESAMPLE REQUIRED libswresample)
|
||||
pkg_check_modules(LIBPROTOBUF REQUIRED protobuf>=3.7)
|
||||
pkg_check_modules(LIBPORTAUDIO REQUIRED portaudio-2.0>=19)
|
||||
pkg_check_modules(LIBUNWIND REQUIRED libunwind-generic>=1.1)
|
||||
|
||||
find_package(Qt4 4.8 REQUIRED QtGui)
|
||||
find_package(GTK2 2.24 REQUIRED gtk)
|
||||
|
||||
set(LIBCSOUND_INCLUDE_DIRS)
|
||||
set(LIBCSOUND_LIBRARIES csound64)
|
||||
|
||||
add_compile_options(-O2 -g -std=c++11)
|
||||
include_directories(${CMAKE_SOURCE_DIR})
|
||||
include_directories(${CMAKE_BINARY_DIR})
|
||||
include_directories($ENV{VIRTUAL_ENV}/include)
|
||||
link_directories($ENV{VIRTUAL_ENV}/lib)
|
||||
|
||||
macro(install_files target)
|
||||
foreach(src ${ARGN})
|
||||
add_custom_command(
|
||||
OUTPUT ${src}
|
||||
COMMAND ln -sf ${CMAKE_CURRENT_LIST_DIR}/${src} ${src}
|
||||
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${src}
|
||||
)
|
||||
endforeach(src)
|
||||
add_custom_target(${target} ALL DEPENDS ${ARGN})
|
||||
endmacro(install_files)
|
||||
|
||||
macro(install_svg target)
|
||||
foreach(src ${ARGN})
|
||||
add_custom_command(
|
||||
OUTPUT ${src}
|
||||
COMMAND PYTHONPATH=${CMAKE_SOURCE_DIR} python -m noisidev.process_svg -o ${src} ${CMAKE_CURRENT_LIST_DIR}/${src}
|
||||
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${src}
|
||||
)
|
||||
endforeach(src)
|
||||
add_custom_target(${target} ALL DEPENDS ${ARGN})
|
||||
endmacro(install_svg)
|
||||
|
||||
macro(add_python_package)
|
||||
foreach(src __init__.py ${ARGN})
|
||||
add_custom_command(
|
||||
OUTPUT ${src}
|
||||
COMMAND cp -f ${CMAKE_CURRENT_LIST_DIR}/${src} ${src}
|
||||
DEPENDS ${CMAKE_CURRENT_LIST_DIR}/${src}
|
||||
)
|
||||
endforeach(src)
|
||||
file(RELATIVE_PATH pkg_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR})
|
||||
string(REGEX REPLACE "/" "." pkg_target ${pkg_path})
|
||||
add_custom_target("pkg-${pkg_target}" ALL DEPENDS __init__.py ${ARGN})
|
||||
endmacro(add_python_package)
|
||||
|
||||
macro(add_cython_module mod lang)
|
||||
file(RELATIVE_PATH pkg_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR})
|
||||
string(REGEX REPLACE "/" "." pkg_target ${pkg_path})
|
||||
add_cython_target(${mod} ${mod}.pyx ${lang} PY3)
|
||||
add_library(${pkg_target}.${mod} MODULE ${${mod}})
|
||||
set_target_properties(${pkg_target}.${mod} PROPERTIES PREFIX "" OUTPUT_NAME ${mod})
|
||||
set(${mod}.so ${pkg_target}.${mod})
|
||||
endmacro(add_cython_module)
|
||||
|
||||
macro(py_proto src)
|
||||
string(REGEX REPLACE "\\.proto$" "" base ${src})
|
||||
file(RELATIVE_PATH pkg_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_LIST_DIR})
|
||||
add_custom_command(
|
||||
OUTPUT ${base}_pb2.py
|
||||
COMMAND LD_LIBRARY_PATH=$ENV{VIRTUAL_ENV}/lib $ENV{VIRTUAL_ENV}/bin/protoc --python_out=${CMAKE_BINARY_DIR} --mypy_out=${CMAKE_BINARY_DIR} --proto_path=${CMAKE_SOURCE_DIR} --proto_path=${CMAKE_BINARY_DIR} ${pkg_path}/${src}
|
||||
DEPENDS ${src}
|
||||
)
|
||||
string(REGEX REPLACE "/" "." pkg_target ${pkg_path})
|
||||