Browse Source

CLI args; meson cross files; noise-repellent now builds; split build

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.0
falkTX 5 years ago
parent
commit
54f6ca5188
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
9 changed files with 287 additions and 58 deletions
  1. +55
    -43
      bootstrap.sh
  2. +111
    -0
      build-plugin.sh
  3. +0
    -0
      plugins/noise-repellent.json
  4. +30
    -12
      setup/env.sh
  5. +33
    -2
      setup/functions.sh
  6. +19
    -0
      setup/meson/macos-old.ini
  7. +19
    -0
      setup/meson/win32.ini
  8. +19
    -0
      setup/meson/win64.ini
  9. +1
    -1
      setup/versions.sh

+ 55
- 43
bootstrap.sh View File

@@ -3,17 +3,57 @@
set -e

cd $(dirname ${0})
PAWPAW_ROOT="${PWD}"

# ---------------------------------------------------------------------------------------------------------------------

# TODO CLI args
target="${1}"

# NOTE all of these need to be defined. either 0 or 1
CROSS_COMPILING=1
if [ -z "${target}" ]; then
echo "usage: ${0} <target>"
exit 1
fi

# ---------------------------------------------------------------------------------------------------------------------

CROSS_COMPILING=0
MACOS=0
MACOS_OLD=0
WIN32=1
WIN64=1
WIN32=0
WIN64=0

case ${target} in
"macos")
MACOS=1
;;
"macos-old")
MACOS=1
MACOS_OLD=1
CROSS_COMPILING=1
;;
"win32")
WIN32=1
CROSS_COMPILING=1
;;
"win64")
WIN32=1
WIN64=1
CROSS_COMPILING=1
;;
"native")
echo "TODO"
exit 2
;;
default)
echo "Invalid target '${target}', possible values are:"
echo "\tmacos"
echo "\tmacos-old"
echo "\twin32"
echo "\twin64"
echo "\tnative"
exit 2
;;
esac

# ---------------------------------------------------------------------------------------------------------------------

@@ -92,43 +132,15 @@ download lv2 "${LV2_VERSION}" "http://lv2plug.in/spec" "tar.bz2"
build_waf lv2 "${LV2_VERSION}" "--lv2dir=${PAWPAW_PREFIX}/lib/lv2"

# ---------------------------------------------------------------------------------------------------------------------
# now the fun: plugins!

for p in $(ls plugins); do
name=$(jq -crM .name plugins/${p})
version=$(jq -crM .version plugins/${p})
buildtype=$(jq -crM .buildtype plugins/${p})
dlbaseurl=$(jq -crM .dlbaseurl plugins/${p})

# optional args
buildargs=$(echo -e $(jq -ecrM .buildargs plugins/${p} || echo '\n\n') | tail -n 1)
dlext=$(echo -e $(jq -ecrM .dlext plugins/${p} || echo '\n\n') | tail -n 1)
dlmethod=$(echo -e $(jq -ecrM .dlmethod plugins/${p} || echo '\n\n') | tail -n 1)

download "${name}" "${version}" "${dlbaseurl}" "${dlext}" "${dlmethod}"

# TODO patch_file support?

case ${buildtype} in
"autoconf")
build_autoconf "${name}" "${version}" "${buildargs}"
;;
"conf")
build_conf "${name}" "${version}" "${buildargs}"
;;
"cmake")
build_cmake "${name}" "${version}" "${buildargs}"
;;
"make")
build_make "${name}" "${version}" "${buildargs}"
;;
"meson")
build_meson "${name}" "${version}" "${buildargs}"
;;
"waf")
build_waf "${name}" "${version}" "${buildargs}"
;;
esac
done
# fftw

download fftw "${FFTW_VERSION}" "http://www.fftw.org"
build_autoconf fftw "${FFTW_VERSION}" "--enable-sse2 --disable-debug --disable-alloca --disable-fortran --with-our-malloc"

# ---------------------------------------------------------------------------------------------------------------------
# fftwf

copy_download fftw fftwf "${FFTW_VERSION}"
build_autoconf fftwf "${FFTW_VERSION}" "--enable-single --enable-sse2 --disable-debug --disable-alloca --disable-fortran --with-our-malloc"

# ---------------------------------------------------------------------------------------------------------------------

+ 111
- 0
build-plugin.sh View File

@@ -0,0 +1,111 @@
#!/bin/bash

set -e

cd $(dirname ${0})
PAWPAW_ROOT="${PWD}"

# ---------------------------------------------------------------------------------------------------------------------

target="${1}"
plugin="${2}"

if [ -z "${target}" ] || [ -z "${plugin}" ]; then
echo "usage: ${0} <target> <plugin>"
exit 1
fi

# TODO check that bootstrap.sh has been run

# ---------------------------------------------------------------------------------------------------------------------

CROSS_COMPILING=0
MACOS=0
MACOS_OLD=0
WIN32=0
WIN64=0

case ${target} in
"macos")
MACOS=1
;;
"macos-old")
MACOS=1
MACOS_OLD=1
CROSS_COMPILING=1
;;
"win32")
WIN32=1
CROSS_COMPILING=1
;;
"win64")
WIN32=1
WIN64=1
CROSS_COMPILING=1
;;
"native")
echo "TODO"
exit 2
;;
default)
echo "Invalid target '${target}', possible values are:"
echo "\tmacos"
echo "\tmacos-old"
echo "\twin32"
echo "\twin64"
echo "\tnative"
exit 2
;;
esac

# ---------------------------------------------------------------------------------------------------------------------

source setup/env.sh
source setup/functions.sh
source setup/versions.sh

# ---------------------------------------------------------------------------------------------------------------------

pfile="${PAWPAW_ROOT}/plugins/${plugin}.json"

if [ ! -e "${pfile}" ]; then
echo "Requested plugin file '${pfile}' does not exist"
exit 2
fi

name=$(jq -crM .name ${pfile})
version=$(jq -crM .version ${pfile})
buildtype=$(jq -crM .buildtype ${pfile})
dlbaseurl=$(jq -crM .dlbaseurl ${pfile})

# optional args
buildargs=$(echo -e $(jq -ecrM .buildargs ${pfile} || echo '\n\n') | tail -n 1)
dlext=$(echo -e $(jq -ecrM .dlext ${pfile} || echo '\n\n') | tail -n 1)
dlmethod=$(echo -e $(jq -ecrM .dlmethod ${pfile} || echo '\n\n') | tail -n 1)

download "${name}" "${version}" "${dlbaseurl}" "${dlext}" "${dlmethod}"

# TODO patch_file support?

case ${buildtype} in
"autoconf")
build_autoconf "${name}" "${version}" "${buildargs}"
;;
"conf")
build_conf "${name}" "${version}" "${buildargs}"
;;
"cmake")
build_cmake "${name}" "${version}" "${buildargs}"
;;
"make")
build_make "${name}" "${version}" "${buildargs}"
;;
"meson")
build_meson "${name}" "${version}" "${buildargs}"
;;
"waf")
build_waf "${name}" "${version}" "${buildargs}"
;;
esac

# ---------------------------------------------------------------------------------------------------------------------

plugins-todo/noise-repellent.json → plugins/noise-repellent.json View File


+ 30
- 12
setup/env.sh View File

@@ -1,33 +1,45 @@
#!/bin/bash

# ---------------------------------------------------------------------------------------------------------------------
# pawpaw setup

PAWPAW_DIR="$(realpath ~/PawPawBuilds)"
PAWPAW_BUILDDIR="${PAWPAW_DIR}/builds"
PAWPAW_DOWNLOADDIR="${PAWPAW_DIR}/downloads"
PAWPAW_PREFIX="${PAWPAW_DIR}/target"
PAWPAW_TMPDIR="/tmp"

# ---------------------------------------------------------------------------------------------------------------------
# OS setup

if [ "${MACOS}" -eq 1 ]; then
CMAKE_SYSTEM_NAME="Darwin"
if [ "${MACOS_OLD}" -eq 1 ]; then
PAWPAW_TARGET="macos-old"
else
PAWPAW_TARGET="macos"
fi
elif [ "${WIN32}" -eq 1 ]; then
CMAKE_SYSTEM_NAME="Windows"
if [ "${WIN64}" -eq 1 ]; then
PAWPAW_TARGET="win64"
else
PAWPAW_TARGET="win32"
fi
else
PAWPAW_TARGET="native"
fi

# ---------------------------------------------------------------------------------------------------------------------
# PawPaw setup

PAWPAW_DIR="$(realpath ~/PawPawBuilds)"
PAWPAW_DOWNLOADDIR="${PAWPAW_DIR}/downloads"
PAWPAW_BUILDDIR="${PAWPAW_DIR}/builds/${PAWPAW_TARGET}"
PAWPAW_PREFIX="${PAWPAW_DIR}/targets/${PAWPAW_TARGET}"
PAWPAW_TMPDIR="/tmp"

# ---------------------------------------------------------------------------------------------------------------------
# build environment

## build flags

BUILD_FLAGS="-O2 -pipe -I${PAWPAW_PREFIX}/include"
BUILD_FLAGS="${BUILD_FLAGS} -mtune=generic -msse -msse2 -mfpmath=sse"
# -ffast-math
BUILD_FLAGS="${BUILD_FLAGS} -mtune=generic -msse -msse2 -mfpmath=sse -ffast-math"
BUILD_FLAGS="${BUILD_FLAGS} -fPIC -DPIC -DNDEBUG"
BUILD_FLAGS="${BUILD_FLAGS} -fdata-sections -ffunction-sections -fno-common -fvisibility=hidden"

if [ "${MACOS}" -eq 1 ]; then
if [ "${MACOS_OLD}" -eq 1 ]; then
BUILD_FLAGS="${BUILD_FLAGS} -mmacosx-version-min=10.5"
@@ -36,14 +48,18 @@ if [ "${MACOS}" -eq 1 ]; then
fi
elif [ "${WIN32}" -eq 1 ]; then
BUILD_FLAGS="${BUILD_FLAGS} -DPTW32_STATIC_LIB -mstackrealign"
# -DWIN32_LEAN_AND_MEAN
fi
# -DFLUIDSYNTH_NOT_A_DLL

TARGET_CFLAGS="${BUILD_FLAGS}"
TARGET_CXXFLAGS="${BUILD_FLAGS} -fvisibility-inlines-hidden"

## link flags

LINK_FLAGS="-fdata-sections -ffunction-sections -L${PAWPAW_PREFIX}/lib"
LINK_FLAGS="-L${PAWPAW_PREFIX}/lib"
LINK_FLAGS="${LINK_FLAGS} -fdata-sections -ffunction-sections"

if [ "${MACOS}" -eq 1 ]; then
LINK_FLAGS="${LINK_FLAGS} -Wl,-dead_strip -Wl,-dead_strip_dylibs"
if [ "${MACOS_OLD}" -ne 1 ]; then
@@ -55,6 +71,7 @@ else
LINK_FLAGS="${LINK_FLAGS} -static"
fi
fi

TARGET_LDFLAGS="${LINK_FLAGS}"

## toolchain
@@ -69,6 +86,7 @@ elif [ "${WIN32}" -eq 1 ]; then
TOOLCHAIN_PREFIX="i686-w64-mingw32"
TOOLCHAIN_PREFIX_="${TOOLCHAIN_PREFIX}-"
fi

TARGET_AR="${TOOLCHAIN_PREFIX_}ar"
TARGET_CC="${TOOLCHAIN_PREFIX_}gcc"
TARGET_CXX="${TOOLCHAIN_PREFIX_}g++"


+ 33
- 2
setup/functions.sh View File

@@ -42,6 +42,25 @@ function download() {
fi
}

function copy_download() {
local name1="${1}"
local name2="${2}"
local version="${3}"
local dlext="${4}"

if [ -z "${dlext}" ]; then
dlext="tar.gz"
fi

local dlfile1="${PAWPAW_DOWNLOADDIR}/${name1}-${version}.${dlext}"
local dlfolder2="${PAWPAW_BUILDDIR}/${name2}-${version}"

if [ ! -d "${dlfolder2}" ]; then
mkdir "${dlfolder2}"
tar -xf "${dlfile1}" -C "${dlfolder2}" --strip-components=1
fi
}

# ---------------------------------------------------------------------------------------------------------------------

function _prebuild() {
@@ -95,11 +114,15 @@ function build_autoconf() {

local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"

if [ "${CROSS_COMPILING}" -eq 1 ]; then
extraconfrules="--host=${TOOLCHAIN_PREFIX} ${extraconfrules}"
fi

_prebuild "${pkgdir}"

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
./configure --enable-static --disable-shared --prefix="${PAWPAW_PREFIX}" --host=${TOOLCHAIN_PREFIX} ${extraconfrules}
./configure --enable-static --disable-shared --prefix="${PAWPAW_PREFIX}" ${extraconfrules}
touch .stamp_configured
popd
fi
@@ -161,13 +184,17 @@ function build_cmake() {

local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"

if [ "${CROSS_COMPILING}" -eq 1 ]; then
extraconfrules="-DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME} ${extraconfrules}"
fi

_prebuild "${pkgdir}"

if [ ! -f "${pkgdir}/.stamp_configured" ]; then
pushd "${pkgdir}"
# FIXME put this as a patch file
sed -i -e 's/ -Wl,--no-undefined//' CMakeLists.txt
cmake -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX="${PAWPAW_PREFIX}" -DCMAKE_SYSTEM_NAME="${CMAKE_SYSTEM_NAME}" ${extraconfrules}
cmake -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_INSTALL_PREFIX="${PAWPAW_PREFIX}" ${extraconfrules}
touch .stamp_configured
popd
fi
@@ -224,6 +251,10 @@ function build_meson() {

local pkgdir="${PAWPAW_BUILDDIR}/${name}-${version}"

if [ "${CROSS_COMPILING}" -eq 1 ]; then
extraconfrules="--cross-file ${PAWPAW_ROOT}/setup/meson/${PAWPAW_TARGET}.ini ${extraconfrules}"
fi

_prebuild "${pkgdir}"

if [ ! -f "${pkgdir}/.stamp_configured" ]; then


+ 19
- 0
setup/meson/macos-old.ini View File

@@ -0,0 +1,19 @@
[properties]
needs_exe_wrapper = true

[binaries]
name = 'macos-old'
c = 'i686-apple-darwin10-gcc'
cpp = 'i686-apple-darwin10-g++'
ar = 'i686-apple-darwin10-gcc-ar'
nm = 'i686-apple-darwin10-gcc-nm'
ld = 'i686-apple-darwin10-ld'
strip = 'i686-apple-darwin10-strip'
pkgconfig = 'pkg-config'
# exe_wrapper = 'darwine'

[host_machine]
system = 'macos'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

+ 19
- 0
setup/meson/win32.ini View File

@@ -0,0 +1,19 @@
[properties]
sys_root = '/home/falktx/xlv2-builds/target'
pkg_config_libdir = '/home/falktx/xlv2-builds/target/lib/pkgconfig'

[binaries]
name = 'darwin'
c = 'i686-apple-darwin10-gcc'
cpp = 'i686-apple-darwin10-g++'
ar = 'i686-apple-darwin10-gcc-ar'
nm = 'i686-apple-darwin10-gcc-nm'
ld = 'i686-apple-darwin10-ld'
strip = 'i686-apple-darwin10-strip'
pkgconfig = '/home/falktx/xlv2-builds/target/bin/pkg-config'

[host_machine]
system = 'darwin'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

+ 19
- 0
setup/meson/win64.ini View File

@@ -0,0 +1,19 @@
[properties]
needs_exe_wrapper = true

[binaries]
name = 'win64'
c = 'x86_64-w64-mingw32-gcc'
cpp = 'x86_64-w64-mingw32-g++'
ar = 'x86_64-w64-mingw32-gcc-ar'
nm = 'x86_64-w64-mingw32-gcc-nm'
ld = 'x86_64-w64-mingw32-ld'
strip = 'x86_64-w64-mingw32-strip'
pkgconfig = 'pkg-config'
exe_wrapper = 'wine64'

[host_machine]
system = 'windows'
cpu_family = 'x86_64'
cpu = 'x86_64'
endian = 'little'

+ 1
- 1
setup/versions.sh View File

@@ -9,12 +9,12 @@ LIBVORBIS_VERSION=1.3.6
FLAC_VERSION=1.3.2
LIBSNDFILE_VERSION=1.0.28
LV2_VERSION=1.18.0
FFTW_VERSION=3.3.8

# GLIB_VERSION=2.44.1
# GLIB_MVERSION=2.44
# FLUIDSYNTH_VERSION=1.1.11
# MXML_VERSION=2.12
# FFTW3_VERSION=3.3.8
# PYTHON_VERSION=3.7.4
# PYLIBLO_VERSION=0.9.2
# CXFREEZE_VERSION=6.1

Loading…
Cancel
Save