Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support building RPM package for CentOS 7
- Loading branch information
Showing
6 changed files
with
265 additions
and
5 deletions.
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # -*- mode: ruby -*- | ||
| # vi: set ft=ruby : | ||
|
|
||
| # Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | ||
| VAGRANTFILE_API_VERSION = "2" | ||
|
|
||
| Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | ||
| vms = [ | ||
| { | ||
| :id => "centos-7-x86_64", | ||
| :box_url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-7.0_chef-provisionerless.box", | ||
| }, | ||
| ] | ||
|
|
||
| vms.each do |vm| | ||
| config.vm.define(vm[:id]) do |node| | ||
| node.vm.box = vm[:id] | ||
| node.vm.box_url = vm[:box_url] | ||
| node.vm.provision(:shell, :path => "build-rpm.sh") | ||
| end | ||
| end | ||
| end |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| #!/bin/sh | ||
|
|
||
| run() | ||
| { | ||
| "$@" | ||
| if test $? -ne 0; then | ||
| echo "Failed $@" | ||
| exit 1 | ||
| fi | ||
| } | ||
|
|
||
| rpmbuild_options= | ||
|
|
||
| . /vagrant/env.sh | ||
|
|
||
| distribution=$(cut -d " " -f 1 /etc/redhat-release | tr "A-Z" "a-z") | ||
| if grep -q Linux /etc/redhat-release; then | ||
| distribution_version=$(cut -d " " -f 4 /etc/redhat-release) | ||
| else | ||
| distribution_version=$(cut -d " " -f 3 /etc/redhat-release) | ||
| fi | ||
| distribution_version=$(echo ${distribution_version} | sed -e 's/\..*$//g') | ||
|
|
||
| architecture="$(arch)" | ||
| case "${architecture}" in | ||
| i*86) | ||
| architecture=i386 | ||
| ;; | ||
| esac | ||
|
|
||
| run rpm -ivh http://packages.groonga.org/centos/groonga-release-1.1.0-1.noarch.rpm | ||
| run yum makecache | ||
|
|
||
| run yum groupinstall -y "Development Tools" | ||
| run yum install -y rpm-build rpmdevtools tar ${DEPENDED_PACKAGES} | ||
|
|
||
| if [ -x /usr/bin/rpmdev-setuptree ]; then | ||
| rm -rf .rpmmacros | ||
| run rpmdev-setuptree | ||
| else | ||
| run cat <<EOM > ~/.rpmmacros | ||
| %_topdir ${HOME}/rpmbuild | ||
| EOM | ||
| run mkdir -p ~/rpmbuild/SOURCES | ||
| run mkdir -p ~/rpmbuild/SPECS | ||
| run mkdir -p ~/rpmbuild/BUILD | ||
| run mkdir -p ~/rpmbuild/RPMS | ||
| run mkdir -p ~/rpmbuild/SRPMS | ||
| fi | ||
|
|
||
| repository="/vagrant/repositories/${distribution}/${distribution_version}" | ||
| rpm_dir="${repository}/${architecture}/Packages" | ||
| srpm_dir="${repository}/source/SRPMS" | ||
| run mkdir -p "${rpm_dir}" "${srpm_dir}" | ||
|
|
||
| # for debug | ||
| # rpmbuild_options="$rpmbuild_options --define 'optflags -O0 -g3'" | ||
|
|
||
| cd | ||
|
|
||
| if [ -n "${SOURCE_ARCHIVE}" ]; then | ||
| run cp /vagrant/tmp/${SOURCE_ARCHIVE} rpmbuild/SOURCES/ | ||
| else | ||
| run cp /vagrant/tmp/${PACKAGE}-${VERSION}.* rpmbuild/SOURCES/ | ||
| fi | ||
| run cp /vagrant/tmp/${distribution}/${PACKAGE}.spec rpmbuild/SPECS/ | ||
|
|
||
| run rpmbuild -ba ${rpmbuild_options} rpmbuild/SPECS/${PACKAGE}.spec | ||
|
|
||
| run mv rpmbuild/RPMS/*/* "${rpm_dir}/" | ||
| run mv rpmbuild/SRPMS/* "${srpm_dir}/" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # -*- rpm -*- | ||
|
|
||
| Name: @PACKAGE@ | ||
| Version: @VERSION@ | ||
| Release: 1%{?dist} | ||
| Summary: Fast full-text search plugin for PostgreSQL based on Groonga | ||
|
|
||
| Group: Applications/Text | ||
| License: PostgreSQL | ||
| URL: https://github.com/pgroonga/pgroonga | ||
| Source0: http://packages.groonga.org/source/pgroonga/pgroonga-%{version}.tar.gz | ||
|
|
||
| BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) | ||
| BuildRequires: groonga-devel | ||
| BuildRequires: postgresql-devel | ||
| Requires: groonga-libs | ||
| Requires: postgresql-server | ||
|
|
||
| %description | ||
| This package provides a fast full-text search plugin for PostgreSQL. | ||
| It is based on Groonga. | ||
|
|
||
| %prep | ||
| %setup -q -n pgroonga-%{version} | ||
|
|
||
|
|
||
| %build | ||
| make %{?_smp_mflags} | ||
|
|
||
| %install | ||
| make install DESTDIR=$RPM_BUILD_ROOT INSTALL="install -p" | ||
|
|
||
| %files | ||
| %doc README.md news.md COPYING | ||
| %{_libdir}/pgsql/*.so | ||
| %{_datadir}/pgsql/extension/*.control | ||
| %{_datadir}/pgsql/extension/*.sql | ||
|
|
||
| %changelog | ||
| * Thu Jan 29 2015 Kouhei Sutou <kou@clear-code.com> - 0.2.0-1 | ||
| - initial packaging for CentOS. |