Last active
August 29, 2015 14:00
-
-
Save timonwong/11129685 to your computer and use it in GitHub Desktop.
Create python2.7 rpm by fpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NAME=python27 | |
MAJOR_VERSION=2.7 | |
VERSION=2.7.6 | |
PYTHON_SOURCE=Python-$(VERSION) | |
INSTALL_DIR=/opt/python$(MAJOR_VERSION) | |
INTERMEDIATE_INSTALL_DIR=/tmp/installdir-$(NAME)-$(VERSION) | |
.PHONY: all clean package | |
all: clean package | |
clean: | |
-rm -rf "$(PYTHON_SOURCE)" | |
-rm -rf "$(INTERMEDIATE_INSTALL_DIR)" | |
package: | |
mkdir -p $(INTERMEDIATE_INSTALL_DIR) | |
# Download python source | |
# curl -LO http://mirrors.sohu.com/python/$(VERSION)/$(PYTHON_SOURCE).tgz | |
tar xf $(PYTHON_SOURCE).tgz | |
# Build python | |
cd $(PYTHON_SOURCE) && \ | |
LDFLAGS="-Wl,-rpath=${INSTALL_DIR}/lib ${LDFLAGS}" \ | |
./configure --prefix=${INSTALL_DIR} --enable-unicode=ucs4 \ | |
--enable-shared --enable-ipv6 && \ | |
make -j2 && \ | |
make install DESTDIR=$(INTERMEDIATE_INSTALL_DIR) | |
-rm -f "$(NAME)-$(VERSION)"-*.rpm | |
fpm -s dir -t rpm -n $(NAME) -v '$(VERSION)' \ | |
-d 'openssl' \ | |
-d 'bzip2' \ | |
-d 'zlib' \ | |
-d 'expat' \ | |
-d 'db4' \ | |
-d 'sqlite' \ | |
-d 'ncurses' \ | |
-d 'readline' \ | |
--directories=$(INSTALL_DIR)/lib/python$(MAJOR_VERSION)/ \ | |
--directories=$(INSTALL_DIR)/include/python$(MAJOR_VERSION)/ \ | |
-C $(INTERMEDIATE_INSTALL_DIR) . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment