Skip to content

Commit

Permalink
Add build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
cecilios committed Mar 8, 2020
1 parent e6c37df commit 092731f
Show file tree
Hide file tree
Showing 3 changed files with 152 additions and 0 deletions.
52 changes: 52 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.1)

# project name
project(fonts-lenmus-bravura)

# install folder
set(INSTALL_DIR "/usr/share/fonts/truetype/")

#install Bravura font
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/src/Bravura.otf
DESTINATION ${INSTALL_DIR}
)

# configure CPack for Debian packages
set(CPACK_MONOLITHIC_INSTALL 1)
set(CPACK_DEB_COMPONENT_INSTALL 0)

set(CPACK_PACKAGE_VENDOR "LenMus")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Cecilio Salmeron <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "https://github.com/lenmus/bravura")
set(CPACK_STRIP_FILES ON) #remove debug information, if any, from binaries
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Bravura music font to render music scores")
set(CPACK_PACKAGE_DESCRIPTION
"Bravura music font to render music scores
Bravura is a Unicode typeface designed by Steinberg. It is compliant with
the Standard Music Font Layout (SMuFL), a community-driven standard for how
music symbols should be laid out in the Unicode Private Use Area (PUA) in
the Basic Multilingual Plane (BMP) for compatibility between different
scoring applications.
.
More information about Steinberg's scoring application can be found at:
http://www.steinberg.net/
.
The latest version of the SMuFL specification can be found at:
https://w3c.github.io/smufl/gitbook/
")
set(CPACK_DEBIAN_PACKAGE_NAME "fonts-lenmus-bravura")
set(CPACK_DEBIAN_PACKAGE_VERSION "1.18-0")
set(CPACK_DEBIAN_PACKAGE_SECTION "fonts")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "all")
string(CONCAT CPACK_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}"
"_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION})

# Must be after the last CPACK macro
include(CPack)

message(" ")
message("CMakeLists.txt processed. Generation starts:")
100 changes: 100 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#! /bin/bash
#------------------------------------------------------------------------------
# Building the fonts-lenmus-bravura.deb package
# This script MUST BE RUN from <root>/scripts/ folder
#
# usage:
# ./build.sh
#------------------------------------------------------------------------------


#------------------------------------------------------------------------------
# Display the help message
function DisplayHelp()
{
echo "Usage: ./bulid.sh [option]*"
echo ""
echo "Options:"
echo " -h --help Print this help text."
echo ""
}

#------------------------------------------------------------------------------
# main line starts here

E_SUCCESS=0 # success
E_NOARGS=65 # no arguments
E_BADPATH=66 # not running from lenmus/scripts
E_BADARGS=67 # bad arguments
E_BUIL_ERROR=68

enhanced="\e[7m"
reset="\e[0m"

#get current directory and check we are running from <root>/scripts.
#For this I just check that "src" folder exists
scripts_path="${PWD}"
root_path=$(dirname "${PWD}")
if [[ ! -e "${root_path}/src" ]]; then
echo "Error: not running from <root>/scripts"
exit $E_BADPATH
fi

#parse command line parameters
# See: https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash
#
while [[ $# -gt 0 ]]
do
key="$1"

case $key in
-h|--help)
DisplayHelp
exit 1
;;
*) # unknown option
DisplayHelp
exit 1
;;
esac
done

#path for building
build_path="${root_path}/zz_build"
sources="${root_path}"

#create or clear build folder
if [[ ! -e ${build_path} ]]; then
#create build folder
echo -e "${enhanced}Creating build folder${reset}"
mkdir ${build_path}
echo "-- Build folder created"
echo ""
elif [[ ! -d ${build_path} ]]; then
#path exists but it is not a folder
echo "Folder for building (${build_path}) already exists but is not a directory!"
echo "Build aborted"
exit $E_BUIL_ERROR
else
# clear build folders
echo -e "${enhanced}Removing last build${reset}"
cd "${build_path}" || exit $E_BADPATH
rm * -rf
echo "-- Build folder now empty"
echo ""
fi

# create makefile
cd "${build_path}"
echo -e "${enhanced}Creating makefile${reset}"
cmake -G "Unix Makefiles" ${sources} || exit 1
echo ""

#prepare package:
echo -e "${enhanced}Creating package${reset}"
cd "${build_path}" || exit $E_BADPATH
make package || exit 1
echo "-- Done"

exit $E_SUCCESS

File renamed without changes.

0 comments on commit 092731f

Please sign in to comment.