Add 'pd-lib-builder/' from commit '54d5c99c63612e5d740a00b716db482c4a60b08c'
git-subtree-dir: pd-lib-builder
git-subtree-mainline: bab1f03354
git-subtree-split: 54d5c99c63612e5d740a00b716db482c4a60b08c
This commit is contained in:
commit
a0054f016f
4 changed files with 1715 additions and 0 deletions
97
pd-lib-builder/CHANGELOG.txt
Normal file
97
pd-lib-builder/CHANGELOG.txt
Normal file
|
|
@ -0,0 +1,97 @@
|
||||||
|
Changelog for Makefile.pdlibbuilder.
|
||||||
|
|
||||||
|
v0.5.1, dated 2018-03-15
|
||||||
|
Fixes and improvements for Windows builds:
|
||||||
|
- properly evaluate variables 'PDDIR' and 'PDBINDIR' to find pd.dll
|
||||||
|
- define default path of 32 bit Pd on 64 bit Windows
|
||||||
|
- link C++ externals with standard C libs on Windows, they don't load otherwise
|
||||||
|
- strip installed Windows binaries by default
|
||||||
|
(issues #34, #39, #41, #42 respectively)
|
||||||
|
Warning for all platforms: variable 'PD_PATH' is no longer supported, use the
|
||||||
|
equivalent 'PDDIR'.
|
||||||
|
|
||||||
|
v0.5.0, dated 2018-01-23
|
||||||
|
Implement target architecture detection for Windows builds,
|
||||||
|
and set appropriate options for 32 and 64 bit (used to be for 32 bit only).
|
||||||
|
(feature, issue #37 #38, merge commit 215bf3e)
|
||||||
|
|
||||||
|
v0.4.4, dated 2016-11-22
|
||||||
|
Use variable 'system' when evaluating 'for{Linux,Darwin,Windows}'
|
||||||
|
(bugfix, issue #31, commit 2c14110)
|
||||||
|
|
||||||
|
v0.4.3, dated 2016-11-02
|
||||||
|
Replace flags '-fpic' by 'fPIC'.
|
||||||
|
(bugfix, issue #29, commit 426b38b)
|
||||||
|
|
||||||
|
v0.4.2, dated 2016-10-30
|
||||||
|
Fix issue where incorrect message about m_pd.h is given.
|
||||||
|
(bugfix, commit 2e13d8f)
|
||||||
|
|
||||||
|
v0.4.1, dated 2016-10-27
|
||||||
|
Respect cflag for minimum OSX version when defined by lib makefile.
|
||||||
|
(bugfix, pull request #22, commit 48c4127)
|
||||||
|
|
||||||
|
v0.4.0, dated 2016-10-14
|
||||||
|
Introduced path variables PDDIR, PDINCLUDEDIR, PDBINDIR, PDLIBDIR which can
|
||||||
|
also be defined in environment.
|
||||||
|
(feature, issue #27, commit b0dab72)
|
||||||
|
|
||||||
|
v0.3.1, dated 2016-10-13
|
||||||
|
Fix bug where pd.dll wouldn't be found.
|
||||||
|
(bugfix, commit a0c87be)
|
||||||
|
|
||||||
|
v0.3.0, dated 2016-10-09
|
||||||
|
Variable 'PD_PATH' introduced for pd-extended / pd-l2ork compatibility.
|
||||||
|
(feature, issue #26, commit 41e9743)
|
||||||
|
|
||||||
|
v0.2.8, dated 2016-10-09
|
||||||
|
Allow installed files to contain weird characters (notably '$').
|
||||||
|
(bugfix, pull request #20, commit 5b920b1)
|
||||||
|
|
||||||
|
v0.2.7, dated 2016-10-04
|
||||||
|
Remove all default pd search paths except vanilla's.
|
||||||
|
(discussion, issue #25, commit a6a89dc)
|
||||||
|
|
||||||
|
v0.2.6, dated 2016-09-20
|
||||||
|
Redefined dependency checking so it won't stall rebuilds on OSX.
|
||||||
|
(bugfix, issue #16, commit 9fd1795)
|
||||||
|
|
||||||
|
v0.2.5, dated 2016-06-26
|
||||||
|
Fixed dependency checking for object files in other directories.
|
||||||
|
(bugfix, commit f06e550)
|
||||||
|
|
||||||
|
v0.2.4, dated 2016-06-25
|
||||||
|
Fixed regression bug that disabled all dependency checking.
|
||||||
|
(bugfix, commit 1d7bb5e)
|
||||||
|
|
||||||
|
v0.2.3, dated 2016-03-29
|
||||||
|
Disabled dependency checking for OSX <= 10.5 because it stalled rebuilds.
|
||||||
|
(bugfix, issue #16, commit eb614fd)
|
||||||
|
|
||||||
|
v0.2.2, dated 2016-03-28
|
||||||
|
Removed target 'pre' because it forced rebuild of everything in 'all'.
|
||||||
|
(bugfix, issue #17, commit c989c8e)
|
||||||
|
|
||||||
|
v0.2.1, dated 2015-12-27
|
||||||
|
Implement / respect 'CPPFLAGS','CFLAGS'and 'LDFLAGS'.
|
||||||
|
(bugfix, issue #5, commit 98f3582)
|
||||||
|
|
||||||
|
v0.2.0, dated 2015-12-19
|
||||||
|
Added per-platform multiline defines 'forLinux', 'forDarwin', 'forWindows'.
|
||||||
|
(feature, pull request #9, commit 3946ea5)
|
||||||
|
|
||||||
|
v0.1.0, dated 2015-12-08
|
||||||
|
Added targets 'pre' and 'post' to automatically run before and after 'all'.
|
||||||
|
(feature, pull request #4, commit a5678ac)
|
||||||
|
|
||||||
|
v0.0.2, dated 2015-12-06
|
||||||
|
Improved methods for searching pd paths.
|
||||||
|
(bugfix, commit ed37e6b)
|
||||||
|
|
||||||
|
v0.0.1, dated 2015-10-31
|
||||||
|
Fixed expansion of variable 'lib.version'.
|
||||||
|
(bugfix, issue #1, commit 974b617)
|
||||||
|
|
||||||
|
v0.0.0, dated 2015-06-24
|
||||||
|
Initial version.
|
||||||
|
(commit 16517a2)
|
||||||
1294
pd-lib-builder/Makefile.pdlibbuilder
Normal file
1294
pd-lib-builder/Makefile.pdlibbuilder
Normal file
File diff suppressed because it is too large
Load diff
113
pd-lib-builder/README.md
Normal file
113
pd-lib-builder/README.md
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
|
||||||
|
|
||||||
|
### Makefile.pdlibbuilder ###
|
||||||
|
|
||||||
|
Helper makefile for Pure Data external libraries.
|
||||||
|
Written by Katja Vetter March-June 2015 for the public domain. No warranties.
|
||||||
|
Inspired by Hans Christoph Steiner's Makefile Template and Stephan Beal's
|
||||||
|
ShakeNMake.
|
||||||
|
|
||||||
|
GNU make version >= 3.81 required.
|
||||||
|
|
||||||
|
|
||||||
|
### characteristics ###
|
||||||
|
|
||||||
|
|
||||||
|
* defines build settings based on autodetected OS and architecture
|
||||||
|
* defines rules to build Pd class- or lib executables from C or C++ sources
|
||||||
|
* defines rules for libdir installation
|
||||||
|
* defines convenience targets for developer and user
|
||||||
|
* evaluates implicit dependencies for non-clean builds
|
||||||
|
|
||||||
|
|
||||||
|
### basic usage ###
|
||||||
|
|
||||||
|
|
||||||
|
In your Makefile, define your Pd lib name and class files, and include
|
||||||
|
Makefile.pdlibbuilder at the end of the Makefile. Like so:
|
||||||
|
|
||||||
|
|
||||||
|
# Makefile for mylib
|
||||||
|
|
||||||
|
lib.name = mylib
|
||||||
|
|
||||||
|
class.sources = myclass1.c myclass2.c
|
||||||
|
|
||||||
|
datafiles = myclass1-help.pd myclass2-help.pd README.txt LICENSE.txt
|
||||||
|
|
||||||
|
include Makefile.pdlibbuilder
|
||||||
|
|
||||||
|
|
||||||
|
For files in class.sources it is assumed that class name == source file
|
||||||
|
basename. The default target builds all classes as individual executables
|
||||||
|
with Pd's default extension for the platform. For anything more than the
|
||||||
|
most basic usage, read the documentation sections in Makefile.pdlibbuilder.
|
||||||
|
|
||||||
|
|
||||||
|
### paths ###
|
||||||
|
|
||||||
|
|
||||||
|
Makefile.pdlibbuilder >= v0.4.0 supports pd path variables which can be
|
||||||
|
defined not only as make command argument but also in the environment, to
|
||||||
|
override platform-dependent defaults:
|
||||||
|
|
||||||
|
PDDIR:
|
||||||
|
Root directory of 'portable' pd package. When defined, PDINCLUDEDIR and
|
||||||
|
PDBINDIR will be evaluated as $(PDDIR)/src and $(PDDIR)/bin.
|
||||||
|
|
||||||
|
PDINCLUDEDIR:
|
||||||
|
Directory where Pd API m_pd.h should be found, and other Pd header files.
|
||||||
|
Overrides the default search path.
|
||||||
|
|
||||||
|
PDBINDIR:
|
||||||
|
Directory where pd.dll should be found for linking (Windows only). Overrides
|
||||||
|
the default search path.
|
||||||
|
|
||||||
|
PDLIBDIR:
|
||||||
|
Root directory for installation of Pd library directories. Overrides the
|
||||||
|
default install location.
|
||||||
|
|
||||||
|
|
||||||
|
### documentation ###
|
||||||
|
|
||||||
|
|
||||||
|
This README.md provides only basic information. A large comment section inside
|
||||||
|
Makefile.pdlibbuilder lists and explains the available user variables, default
|
||||||
|
paths, and targets. The internal documentation reflects the exact functionality
|
||||||
|
of the particular version. A tips&tricks page is in the works.
|
||||||
|
|
||||||
|
|
||||||
|
### versioning ###
|
||||||
|
|
||||||
|
|
||||||
|
The project is versioned in MAJOR.MINOR.BUGFIX format (see http://semver.org),
|
||||||
|
and maintained at https://github.com/pure-data/pd-lib-builder. Pd lib developers
|
||||||
|
are invited to regulary check for updates, and to contribute and discuss
|
||||||
|
improvements here. If you really need to distribute a personalized version with
|
||||||
|
your library, rename Makefile.pdlibbuilder to avoid confusion.
|
||||||
|
|
||||||
|
|
||||||
|
### examples ###
|
||||||
|
|
||||||
|
|
||||||
|
Here are a few projects using the Makefile.pdlibbuilder approach:
|
||||||
|
|
||||||
|
https://github.com/pure-data/helloworld
|
||||||
|
|
||||||
|
https://github.com/electrickery/pd-cyclone (stable)
|
||||||
|
|
||||||
|
https://github.com/porres/pd-cyclone (experimental)
|
||||||
|
|
||||||
|
https://git.iem.at/pd/iemguts
|
||||||
|
|
||||||
|
https://git.iem.at/pd/iemnet
|
||||||
|
|
||||||
|
https://git.iem.at/pd/iem_ambi
|
||||||
|
|
||||||
|
https://git.iem.at/pd/mediasettings
|
||||||
|
|
||||||
|
https://git.iem.at/pd-gui/punish
|
||||||
|
|
||||||
|
https://github.com/residuum/PuRestJson
|
||||||
|
|
||||||
|
More examples will be referenced here when they are available.
|
||||||
211
pd-lib-builder/tips-tricks.md
Normal file
211
pd-lib-builder/tips-tricks.md
Normal file
|
|
@ -0,0 +1,211 @@
|
||||||
|
pd-lib-builder cheatsheet
|
||||||
|
=========================
|
||||||
|
|
||||||
|
# Creating special builds
|
||||||
|
|
||||||
|
## cross-compiling W32 binaries from linux
|
||||||
|
|
||||||
|
I'm using the following to cross-compile W32 binaries on my Debian/64bit system,
|
||||||
|
using `mingw-w64`.
|
||||||
|
|
||||||
|
Assuming you have unzipped a W32 package for Pd into `${WINPDPATH}`, run:
|
||||||
|
|
||||||
|
make system=Windows pdbinpath="${WINPDPATH}/bin/" pdincludepath="${WINPDPATH}/src/" CC=i686-w64-mingw32-gcc
|
||||||
|
|
||||||
|
(if the project uses C++, you might also need to set `CXX=i686-w64-mingw32-g++`)
|
||||||
|
|
||||||
|
## building double-precision externals
|
||||||
|
|
||||||
|
At the time of writing (2018-02) there is no official Pd that supports
|
||||||
|
double-precision numbers yet.
|
||||||
|
However, if you do get hold of an experimental double-precision Pd, you can
|
||||||
|
easily build your externals for 64-bit numbers:
|
||||||
|
|
||||||
|
make CPPFLAGS="-DPD_FLOATSIZE=64"
|
||||||
|
|
||||||
|
## building externals for W64 (64-bit Windows)
|
||||||
|
|
||||||
|
At the time of writing (2018-02) there is no official Pd that supports
|
||||||
|
W64 yet.
|
||||||
|
However, if you do get hold of an experimental W64 Pd, you can
|
||||||
|
easily build your externals for this environment with
|
||||||
|
|
||||||
|
make CPPFLAGS="-DPD_LONGINTTYPE=__int64" CC=x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
|
|
||||||
|
To build a double-precision external for W64, use something like:
|
||||||
|
|
||||||
|
make CPPFLAGS="-DPD_LONGINTTYPE=__int64 -DPD_FLOATSIZE=64" CC=x86_64-w64-mingw32-gcc
|
||||||
|
|
||||||
|
|
||||||
|
## TODO universal binaries on OSX
|
||||||
|
|
||||||
|
|
||||||
|
# Project management
|
||||||
|
|
||||||
|
In general it is advised to put the `Makefile.pdlibbuilder` into a separate
|
||||||
|
subdirectory (e.g. `pd-lib-builder/`).
|
||||||
|
This makes it much easier to update the `Makefile.pdlibbuilder` later
|
||||||
|
|
||||||
|
You *should* also use a variable to the actual path of the Makefile.pdlibbuilder
|
||||||
|
(even if you keep it in the root-directory), as this allows easy experimenting
|
||||||
|
with newer (or older) (or site-specific) versions of the pd-lib-builder
|
||||||
|
Makefile.
|
||||||
|
|
||||||
|
~~~make
|
||||||
|
PDLIBBUILDER_DIR=pd-lib-builder/
|
||||||
|
include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder
|
||||||
|
~~~
|
||||||
|
|
||||||
|
## Keeping pd-lib-builder up-to-date
|
||||||
|
|
||||||
|
### `git subtree`
|
||||||
|
|
||||||
|
With git-subtrees, you make the pd-lib-builder repository (or any other
|
||||||
|
repository for that matter) part of your own repository - with full history and
|
||||||
|
everything - put nicely into a distinct subdirectory.
|
||||||
|
|
||||||
|
Support for *manipulating* subtrees has been added with Git-v1.7.11 (May 2012).
|
||||||
|
The nice thing however is, that from "outside" the subtree is part of your
|
||||||
|
repository like any other directory. E.g. older versions of Git can clone your
|
||||||
|
repository with the full subtree (and all it's history) just fine.
|
||||||
|
You can also use git-archive to make a complete snapshot of your repository
|
||||||
|
(including the subtree) - nice, if you e.g. want self-contained downloads of
|
||||||
|
your project from git hosting platforms (like Github, Gitlab, Bitbucket,...)
|
||||||
|
|
||||||
|
In short, `git subtree` is the better `git submodule`.
|
||||||
|
|
||||||
|
So here's how to do it:
|
||||||
|
|
||||||
|
#### Initial setup/check-out
|
||||||
|
This will create a `pd-lib-builder/` directory containing the full history of
|
||||||
|
the pd-lib-builder repository up to its release `v0.5.0`
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git subtree add --prefix=pd-lib-builder/ https://github.com/pure-data/pd-lib-builder v0.5.0
|
||||||
|
~~~
|
||||||
|
|
||||||
|
This will automatically merge the `pd-lib-builder/` history into your current
|
||||||
|
branch, so everything is ready to go.
|
||||||
|
|
||||||
|
#### Cloning your repository with the subtree
|
||||||
|
Nothing special, really.
|
||||||
|
Just clone your repository as always:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git clone https://git.example.org/pd/superbonk~.git
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Updating the subtree
|
||||||
|
Time passes and sooner or later you will find, that there is a shiny new
|
||||||
|
pd-lib-builder with plenty of bugfixes and new features.
|
||||||
|
To update your local copy to pd-lib-builder's current `master`, simply run:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git subtree pull --prefix pd-lib-builder/ https://github.com/pure-data/pd-lib-builder master
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Pulling the updated subtree into existing clones
|
||||||
|
Again, nothing special.
|
||||||
|
Just pull as always:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git pull
|
||||||
|
~~~
|
||||||
|
|
||||||
|
|
||||||
|
#### Further reading
|
||||||
|
More on the power of `git subtree` can be found online
|
||||||
|
- https://medium.com/@v/git-subtrees-a-tutorial-6ff568381844
|
||||||
|
- https://www.atlassian.com/blog/git/alternatives-to-git-submodule-git-subtree
|
||||||
|
- ...
|
||||||
|
|
||||||
|
### ~~`git submodule`~~ [DISCOURAGED]
|
||||||
|
|
||||||
|
|
||||||
|
#### Initial setup/check-out
|
||||||
|
To add a new submodule to your repository, just run `git submodule add` and
|
||||||
|
commit the changes:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git submodule add https://github.com/pure-data/pd-lib-builder
|
||||||
|
git commit .gitmodules pd-lib-builder/ -m "Added pd-lib-builder as git-submodule"
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Cloning your repository with the submodule
|
||||||
|
|
||||||
|
When doing a fresh clone of your repository, pass the `--recursive` option to
|
||||||
|
automatically fetch all submodules:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git clone --recursive https://git.example.org/pd/superbonk~.git
|
||||||
|
~~~
|
||||||
|
|
||||||
|
If you've cloned non-recursively, you can initialize and update the submodules
|
||||||
|
manually:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Updating the submodule
|
||||||
|
Submodules are usually fixed to a given commit in their repository.
|
||||||
|
To update the `pd-lib-builder` submodule to the current `master` do something
|
||||||
|
like:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
cd pd-lib-builder
|
||||||
|
git checkout master
|
||||||
|
git pull
|
||||||
|
cd ..
|
||||||
|
git status pd-lib-builder
|
||||||
|
git commit pd-lib-builder -m "Updated pd-lib-builder to current master"
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Pulling the updated submodule into existing clones
|
||||||
|
After you have pushed the submodule updates in your repository, other clones of
|
||||||
|
the repository can be updated as follows:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git pull
|
||||||
|
~~~
|
||||||
|
|
||||||
|
The above will make your repository aware, that the submodule is out-of-sync.
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
$ LANG=C git status pd-lib-builder
|
||||||
|
On branch master
|
||||||
|
Your branch is up to date with 'origin/master'.
|
||||||
|
|
||||||
|
Changes not staged for commit:
|
||||||
|
(use "git add <file>..." to update what will be committed)
|
||||||
|
(use "git checkout -- <file>..." to discard changes in working directory)
|
||||||
|
|
||||||
|
modified: pd-lib-builder (new commits)
|
||||||
|
$
|
||||||
|
~~~
|
||||||
|
|
||||||
|
In order to sync the submodule to the correct commit, run the following:
|
||||||
|
|
||||||
|
~~~sh
|
||||||
|
git submodule update
|
||||||
|
~~~
|
||||||
|
|
||||||
|
#### Drawbacks
|
||||||
|
`git submodule` has a number of drawbacks:
|
||||||
|
- it requires special commands to synchronize the submodules, in addition to
|
||||||
|
synching your repository.
|
||||||
|
- you must make sure to use an URL for the submodule that is accessible to your
|
||||||
|
potential users. e.g. using `git@github.com:pure-data/pd-lib-builder` is bad,
|
||||||
|
because it requires everybody who wants to checkout your sources to have a
|
||||||
|
github-account - even if they could checkout *your* repository anonymously.
|
||||||
|
- submodules will be excluded from `git archive`. This means, that if you use a
|
||||||
|
mainstream git provider (like Github, GitLab, Bitbucket,...) and make releases
|
||||||
|
by creating a `git tag`, the automatically generated zipfiles with the sources
|
||||||
|
will lack the submodule - and your users will not be able to compile your
|
||||||
|
source code.
|
||||||
|
|
||||||
|
In general, I would suggest to **avoid** `git submodule`, and instead use the
|
||||||
|
better `git subtree` (above).
|
||||||
|
|
||||||
Loading…
Reference in a new issue