diff --git a/build-rpm.sh b/build-rpm.sh
new file mode 100755
index 0000000..8128507
--- /dev/null
+++ b/build-rpm.sh
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+#Script to create the pgAdmin4 RPMs.
+
+#Color schemes
+red=`tput setaf 1`
+green=`tput setaf 2`
+blue=`tput setaf 4`
+reset=`tput sgr0`
+
+# Check whether lsb_release exists or not:
+if [ ! -f /usr/bin/lsb_release ]
+then
+        echo
+        echo "${red}ERROR:${reset} lsb_release command does not exist. Please install it with"
+        echo
+        echo "${blue}   yum -y install redhat-lsb-core"
+        echo
+        echo "${red}Exiting...${reset}"
+        echo
+        exit 1
+fi
+
+# Gather some information from the OS: OS name, version and arch:
+lsb_distro_name=`lsb_release -i -s`
+lsb_distro_version=`lsb_release -r -s`
+distro_arch=`uname -m`
+
+# We need the lowercase version of the distro name:
+lsb_distro_name=`echo $lsb_distro_name | awk '{print tolower($0)}'`
+
+if [ "$lsb_distro_name" = "centos" ]; then
+	lsb_distro_version=`echo $lsb_distro_version | cut -d"." -f1`
+	pkg_dir="EL-$lsb_distro_version"
+else
+	pkg_dir="F-$lsb_distro_version"
+fi
+
+# Find the pgAdmin4 version
+pgAdmin4_major=`awk '/APP_MAJOR =/ {print $3}' ./web/config.py`
+pgAdmin4_minor=`awk '/APP_MINOR =/ {print $3}' ./web/config.py`
+pgAdmin4_revision=`awk '/APP_REVISION =/ {print $3}' ./web/config.py`
+pgAdmin4_suffix=`awk '/APP_SUFFIX =/ {print $3}' ./web/config.py | sed "s/'//g"`
+
+# If suffix is defined
+if [ ! -z "$pgAdmin4_suffix" ]; then
+	pgAdmin4_suffix="${pgAdmin4_suffix}." #hyphen not allowed in SPEC for version
+fi
+
+# Is the OS version supported?
+if [ ! -d ./pkg/rpm/$pkg_dir ]; then
+	echo "./pkg/rpm/$pkg_dir does not exist"
+	exit 1
+fi
+
+cd ./pkg/rpm/$pkg_dir
+
+# Replace the placeholders in the spec
+sed -e "s/PGADMIN_MAJOR/$pgAdmin4_major/" \
+    -e "s/PGADMIN_MINOR/$pgAdmin4_minor/" \
+    -e "s/PGADMIN_REV/$pgAdmin4_revision/" \
+    -e "s/PGADMIN_SUFFIX/$pgAdmin4_suffix/" \
+    -e "s/DISTRO_ARCH/$distro_arch/" pgadmin4.spec.in > pgadmin4.spec
+
+make rpm
diff --git a/pkg/rpm/EL-6/Makefile b/pkg/rpm/EL-6/Makefile
new file mode 100644
index 0000000..8a31664
--- /dev/null
+++ b/pkg/rpm/EL-6/Makefile
@@ -0,0 +1,8 @@
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.rhel6
+SPECFILE="pgadmin4.spec"
+
+# Now, include global Makefile
+include ../common/Makefile.global
diff --git a/pkg/rpm/EL-6/pgadmin4.spec.in b/pkg/rpm/EL-6/pgadmin4.spec.in
new file mode 100644
index 0000000..f41e373
--- /dev/null
+++ b/pkg/rpm/EL-6/pgadmin4.spec.in
@@ -0,0 +1,175 @@
+
+%define pgadmin4_major PGADMIN_MAJOR
+%define pgadmin4_minor PGADMIN_MINOR
+%define pgadmin4_revision PGADMIN_REV
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-%{pgadmin4_major}.%{pgadmin4_minor}
+
+Name:           %{name}
+Version:        %{pgadmin4_major}.%{pgadmin4_minor}.%{pgadmin4_revision}
+Release:        PGADMIN_SUFFIX1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+Source0:        pgadmin4-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package        -n pgadmin4-web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+#%if 0%{?fedora} >= 23
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-argparse
+#Requires:  python-importlib
+#Requires:  python-wsgiref
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    -n pgadmin4-web
+This package contains the required files to run pgAdmin4 as a web application
+
+%prep
+%setup -n pgadmin4/runtime
+
+%build
+cd ../web
+sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+cd ../runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+
+%install
+rm -rf %{buildroot}
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+echo "
+[General]
+ApplicationPath=%{PYTHON_SITELIB}/pgadmin4-web
+PythonPath=
+" > %{buildroot}%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%files -n pgadmin4-web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/pgadmin4-web
+%doc
+
+%changelog
+* Fri Apr 22 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> 1.0.0-1
+- Initial version
+
diff --git a/pkg/rpm/EL-7/Makefile b/pkg/rpm/EL-7/Makefile
new file mode 100644
index 0000000..1eb0ea0
--- /dev/null
+++ b/pkg/rpm/EL-7/Makefile
@@ -0,0 +1,8 @@
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.rhel7
+SPECFILE="pgadmin4.spec"
+
+# Now, include global Makefile
+include ../common/Makefile.global
diff --git a/pkg/rpm/EL-7/pgadmin4.spec.in b/pkg/rpm/EL-7/pgadmin4.spec.in
new file mode 100644
index 0000000..f41e373
--- /dev/null
+++ b/pkg/rpm/EL-7/pgadmin4.spec.in
@@ -0,0 +1,175 @@
+
+%define pgadmin4_major PGADMIN_MAJOR
+%define pgadmin4_minor PGADMIN_MINOR
+%define pgadmin4_revision PGADMIN_REV
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-%{pgadmin4_major}.%{pgadmin4_minor}
+
+Name:           %{name}
+Version:        %{pgadmin4_major}.%{pgadmin4_minor}.%{pgadmin4_revision}
+Release:        PGADMIN_SUFFIX1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+Source0:        pgadmin4-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package        -n pgadmin4-web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+#%if 0%{?fedora} >= 23
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-argparse
+#Requires:  python-importlib
+#Requires:  python-wsgiref
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    -n pgadmin4-web
+This package contains the required files to run pgAdmin4 as a web application
+
+%prep
+%setup -n pgadmin4/runtime
+
+%build
+cd ../web
+sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+cd ../runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+
+%install
+rm -rf %{buildroot}
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+echo "
+[General]
+ApplicationPath=%{PYTHON_SITELIB}/pgadmin4-web
+PythonPath=
+" > %{buildroot}%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%files -n pgadmin4-web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/pgadmin4-web
+%doc
+
+%changelog
+* Fri Apr 22 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> 1.0.0-1
+- Initial version
+
diff --git a/pkg/rpm/F-22/Makefile b/pkg/rpm/F-22/Makefile
new file mode 100644
index 0000000..d6ed841
--- /dev/null
+++ b/pkg/rpm/F-22/Makefile
@@ -0,0 +1,8 @@
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.f22
+SPECFILE="pgadmin4.spec"
+
+# Now, include global Makefile
+include ../common/Makefile.global
diff --git a/pkg/rpm/F-22/pgadmin4.spec.in b/pkg/rpm/F-22/pgadmin4.spec.in
new file mode 100644
index 0000000..f41e373
--- /dev/null
+++ b/pkg/rpm/F-22/pgadmin4.spec.in
@@ -0,0 +1,175 @@
+
+%define pgadmin4_major PGADMIN_MAJOR
+%define pgadmin4_minor PGADMIN_MINOR
+%define pgadmin4_revision PGADMIN_REV
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-%{pgadmin4_major}.%{pgadmin4_minor}
+
+Name:           %{name}
+Version:        %{pgadmin4_major}.%{pgadmin4_minor}.%{pgadmin4_revision}
+Release:        PGADMIN_SUFFIX1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+Source0:        pgadmin4-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package        -n pgadmin4-web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+#%if 0%{?fedora} >= 23
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-argparse
+#Requires:  python-importlib
+#Requires:  python-wsgiref
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    -n pgadmin4-web
+This package contains the required files to run pgAdmin4 as a web application
+
+%prep
+%setup -n pgadmin4/runtime
+
+%build
+cd ../web
+sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+cd ../runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+
+%install
+rm -rf %{buildroot}
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+echo "
+[General]
+ApplicationPath=%{PYTHON_SITELIB}/pgadmin4-web
+PythonPath=
+" > %{buildroot}%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%files -n pgadmin4-web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/pgadmin4-web
+%doc
+
+%changelog
+* Fri Apr 22 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> 1.0.0-1
+- Initial version
+
diff --git a/pkg/rpm/F-23/Makefile b/pkg/rpm/F-23/Makefile
new file mode 100644
index 0000000..9316c99
--- /dev/null
+++ b/pkg/rpm/F-23/Makefile
@@ -0,0 +1,8 @@
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.f23
+SPECFILE="pgadmin4.spec"
+
+# Now, include global Makefile
+include ../common/Makefile.global
diff --git a/pkg/rpm/F-23/pgadmin4.spec.in b/pkg/rpm/F-23/pgadmin4.spec.in
new file mode 100644
index 0000000..f41e373
--- /dev/null
+++ b/pkg/rpm/F-23/pgadmin4.spec.in
@@ -0,0 +1,175 @@
+
+%define pgadmin4_major PGADMIN_MAJOR
+%define pgadmin4_minor PGADMIN_MINOR
+%define pgadmin4_revision PGADMIN_REV
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-%{pgadmin4_major}.%{pgadmin4_minor}
+
+Name:           %{name}
+Version:        %{pgadmin4_major}.%{pgadmin4_minor}.%{pgadmin4_revision}
+Release:        PGADMIN_SUFFIX1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+Source0:        pgadmin4-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package        -n pgadmin4-web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+#%if 0%{?fedora} >= 23
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-argparse
+#Requires:  python-importlib
+#Requires:  python-wsgiref
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    -n pgadmin4-web
+This package contains the required files to run pgAdmin4 as a web application
+
+%prep
+%setup -n pgadmin4/runtime
+
+%build
+cd ../web
+sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+cd ../runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+
+%install
+rm -rf %{buildroot}
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+echo "
+[General]
+ApplicationPath=%{PYTHON_SITELIB}/pgadmin4-web
+PythonPath=
+" > %{buildroot}%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%files -n pgadmin4-web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/pgadmin4-web
+%doc
+
+%changelog
+* Fri Apr 22 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> 1.0.0-1
+- Initial version
+
diff --git a/pkg/rpm/F-24/Makefile b/pkg/rpm/F-24/Makefile
new file mode 100644
index 0000000..f48f68d
--- /dev/null
+++ b/pkg/rpm/F-24/Makefile
@@ -0,0 +1,8 @@
+
+ARCH=`rpm --eval "%{_arch}"`
+DIR=`pwd`
+DIST=.f24
+SPECFILE="pgadmin4.spec"
+
+# Now, include global Makefile
+include ../common/Makefile.global
diff --git a/pkg/rpm/F-24/pgadmin4.spec.in b/pkg/rpm/F-24/pgadmin4.spec.in
new file mode 100644
index 0000000..f41e373
--- /dev/null
+++ b/pkg/rpm/F-24/pgadmin4.spec.in
@@ -0,0 +1,175 @@
+
+%define pgadmin4_major PGADMIN_MAJOR
+%define pgadmin4_minor PGADMIN_MINOR
+%define pgadmin4_revision PGADMIN_REV
+
+%define name pgadmin4
+%define pgadmin4instdir /usr/%{name}-%{pgadmin4_major}.%{pgadmin4_minor}
+
+Name:           %{name}
+Version:        %{pgadmin4_major}.%{pgadmin4_minor}.%{pgadmin4_revision}
+Release:        PGADMIN_SUFFIX1%{?dist}
+Summary:        pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.   
+
+Group:          Applications/Databases   
+License:        PostgreSQL License
+URL:            http://www.pgadmin.org
+Source0:        pgadmin4-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      DISTRO_ARCH
+
+BuildRequires:  mesa-libGL-devel
+BuildRequires:  gcc-c++
+Requires:       pgadmin4-web
+%if 0%{?fedora}
+BuildRequires:	qt5-qtbase-devel >= 5.1
+BuildRequires:  qt5-qtwebkit-devel
+%define QMAKE   /usr/bin/qmake-qt5
+%else
+BuildRequires:  qt-devel >= 4.6
+BuildRequires:  qtwebkit-devel
+%define QMAKE   /usr/lib64/qt4/bin/qmake
+%endif
+
+%if 0%{?fedora}
+BuildRequires:  python3-devel
+Requires:       python >= 3.3
+%else
+BuildRequires:  python-devel
+Requires:       python >= 2.6
+%endif
+
+%if 0%{?fedora}
+Requires:       qt >= 5.1
+%else
+Requires:       qt >= 4.6
+%endif
+
+%description
+pgAdmin 4 is a rewrite of the popular pgAdmin3 management tool for the PostgreSQL (http://www.postgresql.org) database.
+pgAdmin 4 is being written as a web application in Python, using jQuery and
+Bootstrap for the client side processing and UI. On the server side, Flask is
+being utilised.
+
+Although developed using web technologies, we intend for pgAdmin 4 to be usable
+either on a web server using a browser, or standalone on a workstation. The
+runtime/ subdirectory contains a QT based runtime application intended to allow
+this - it is essentially a browser and Python interpretor in one package which
+will be capable of hosting the Python application and presenting it to the user
+as a desktop application.
+
+%package        -n pgadmin4-web
+Summary:        pgAdmin4 web package
+BuildArch:      noarch
+#%if 0%{?fedora} >= 23
+%if 0%{?fedora}
+Requires:  python3-babel
+Requires:  python3-flask
+Requires:  python3-flask-sqlalchemy
+Requires:  python3-flask-wtf
+Requires:  python3-jinja2
+Requires:  python3-markupsafe
+Requires:  python3-sqlalchemy
+Requires:  python3-wtforms
+Requires:  python3-beautifulsoup4
+Requires:  python3-blinker
+Requires:  python3-html5lib
+Requires:  python3-itsdangerous
+Requires:  python3-psycopg2
+Requires:  python3-six
+Requires:  python3-crypto
+Requires:  python3-simplejson
+Requires:  python3-dateutil
+Requires:  python3-werkzeug
+#Requires:  python3-flask-babel
+#Requires:  python3-speaklater
+#Requires:  python3-passlib
+#Requires:  python3-flask-gravatar
+#Requires:  python3-flask-mail
+#Requires:  python3-flask-security
+#Requires:  python3-flask-login
+#Requires:  python3-flask-principal
+#Requires:  python3-django-htmlmin
+%else
+Requires:  python-babel
+Requires:  python-flask
+Requires:  python-flask-sqlalchemy
+Requires:  python-flask-wtf
+Requires:  python-jinja2
+Requires:  python-markupsafe
+Requires:  python-sqlalchemy
+Requires:  python-wtforms
+Requires:  python-beautifulsoup4
+Requires:  python-blinker
+Requires:  python-html5lib
+Requires:  python-itsdangerous
+Requires:  python-psycopg2
+Requires:  python-six
+Requires:  python-crypto
+Requires:  python-simplejson
+Requires:  python-dateutil
+Requires:  python-werkzeug
+Requires:  pytz
+#Requires:  python-flask-babel
+#Requires:  python-speaklater
+#Requires:  python-passlib
+#Requires:  python-flask-gravatar
+#Requires:  python-flask-mail
+#Requires:  python-flask-security
+#Requires:  python-flask-login
+#Requires:  python-flask-principal
+#Requires:  python-django-htmlmin
+#Requires:  python-argparse
+#Requires:  python-importlib
+#Requires:  python-wsgiref
+%endif
+
+%if 0%{?fedora}
+%define PYTHON_SITELIB %{python3_sitelib}
+%else
+%define PYTHON_SITELIB %{python2_sitelib}
+%endif
+
+%description    -n pgadmin4-web
+This package contains the required files to run pgAdmin4 as a web application
+
+%prep
+%setup -n pgadmin4/runtime
+
+%build
+cd ../web
+sed -e 's/SERVER_MODE = True/SERVER_MODE = False/' config.py > config_local.py
+cd ../runtime
+%{QMAKE} -o Makefile pgAdmin4.pro
+make
+
+%install
+rm -rf %{buildroot}
+install -d -m 755 %{buildroot}%{pgadmin4instdir}/runtime
+cp pgAdmin4 %{buildroot}%{pgadmin4instdir}/runtime
+install -d -m 755 %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+cp -pR ../web/* %{buildroot}%{PYTHON_SITELIB}/pgadmin4-web
+echo "
+[General]
+ApplicationPath=%{PYTHON_SITELIB}/pgadmin4-web
+PythonPath=
+" > %{buildroot}%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%clean
+rm -rf %{buildroot}
+
+%files
+%defattr(-,root,root,-)
+%{pgadmin4instdir}/runtime/pgAdmin4
+%{pgadmin4instdir}/runtime/pgadmin4.ini
+
+%files -n pgadmin4-web
+%defattr(-,root,root,-)
+%{PYTHON_SITELIB}/pgadmin4-web
+%doc
+
+%changelog
+* Fri Apr 22 2016 Sandeep Thakkar <sandeep.thakkar@enterprisedb.com> 1.0.0-1
+- Initial version
+
diff --git a/pkg/rpm/README b/pkg/rpm/README
new file mode 100644
index 0000000..8f332b8
--- /dev/null
+++ b/pkg/rpm/README
@@ -0,0 +1,5 @@
+# Instructions on how to build RPMs for pgadmin4
+
+Go to pgAdmin4 root directory and run build-rpm.sh. This will compile
+the sources and create the RPMS for your OS in pkg/rpm/EL-6|EL-7|F-22|F-23 
+for web and runtime.
diff --git a/pkg/rpm/common/Makefile.global b/pkg/rpm/common/Makefile.global
new file mode 100644
index 0000000..3f9e9b2
--- /dev/null
+++ b/pkg/rpm/common/Makefile.global
@@ -0,0 +1,21 @@
+
+prep:
+	# Update spec file, patches, etc, before running spectool:
+	git pull
+	# Use spectool to download source files, especially tarballs.
+	spectool -g -S $(SPECFILE)
+
+allclean:
+	git clean -df
+
+clean:
+	rm -rf i386/ i586/ i686/ x86_64/ noarch/
+	rm -f *.src.rpm
+	rm -f *.tar *.tar.gz *.tar.bz2 *.tgz *.zip .xz
+
+rpm: prep
+	rpmbuild --define "_sourcedir $(PWD)" \
+	--define "_specdir $(PWD)" \
+	--define  "_builddir $(PWD)" \
+	--define "_rpmdir $(PWD)" \
+	--define "dist $(DIST)" -bb $(SPECFILE)
