sapling/Makefile
Durham Goode 9e07f19a8b cdatapack: move libdatapack to be statically linked
Summary:
Linking native python extensions together is a huge pain and I'm encountering
bugs in the linker in centos6. To simplify everything, I'm going to merge all
the cstore related libraries into a single library.

Step one is to move the C libdatapack code to be a statically linked library.
distutils doesn't actually support using -l or extra args in it's static library
generator, so we need to monkey patch a fix for that here.

Test Plan:
Built using 'python setup.py build --component cdatapack'.  Verified the static library was built:
```
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iclib -I/usr/local/include -I/opt/local/include -I/opt/homebrew/include/ -c cdatapack/cdatapack.c -o build/temp.linux-x86_64-2.7/cdatapack/cdatapack.o -std=c99 -Wall -Werror -Werror=strict-prototypes
ar rc build/temp.linux-x86_64-2.7/libdatapack.a build/temp.linux-x86_64-2.7/cdatapack/cdatapack.o
```

And the resulting cdatapack.o library did not reference a libdatapack shared library any more by running 'ldd cdatapack.so'.  On OSX verified the same thing using "otool -L cdatapack.so"

Reviewers: #mercurial, simonfar

Reviewed By: simonfar

Subscribers: simonfar, stash, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4581274

Signature: t1:4581274:1487842180:d2125ebec7bbb9533e02b0589f188251881ed569
2017-02-23 14:03:02 -08:00

29 lines
691 B
Makefile

PYTHON=python
.PHONY: tests
PREFIX=/usr/local
help:
@echo 'Commonly used make targets:'
@echo ' local - build for inplace use'
@echo ' install - install program and man pages to PREFIX ($(PREFIX))'
@echo ' clean - remove files created by other targets'
@echo ' (except installed files or dist source tarball)'
local:
$(PYTHON) setup.py \
build_py -c -d . \
build_clib \
build_ext -i
install:
$(PYTHON) setup.py $(PURE) install --prefix="$(PREFIX)" --force
clean:
-$(PYTHON) setup.py clean --all # ignore errors from this command
find . \( -name '*.py[cdo]' -o -name '*.so' \) -exec rm -f '{}' ';'
deb:
contrib/builddeb