Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFerry Huberts <ferry.huberts@pelagic.nl>2015-01-14 15:19:45 +0300
committerFerry Huberts <ferry.huberts@pelagic.nl>2015-01-14 16:45:47 +0300
commit7e3c32666fd9624e304765b0ed0923eb90e31d7f (patch)
treef436f2450cb75cb43034718ec1da7503571774c0
parent7434d40d25188ee821038b288af71b7ca90832c0 (diff)
package.sh: add fedora
Fedora builds Cura by using ```mock```, thereby enabling it to build RPMs for every distribution that ```mock``` has a configuration file for. In pratice this means that Fedora can build RPMs for several versions of Fedora, CentOS and RHEL. Cura can be built under a regular user account, there is no need to have root privileges. In fact, having root privileges is very much discouraged. However, the user account under which the build is performed needs to be a member of the 'mock' group. Specify only 'fedora' to build RPMs for the current system. ./package.sh fedora Additionally specify any number of mock configurations (ls -1 /etc/mock/*.cfg) to build RPMs for those configurations. ./package.sh fedora fedora-21-x86_64.cfg fedora-21-i386.cfg ... Since only the filename of the mock configurations is used, this also works: ./package.sh fedora /etc/mock/fedora-21-x86_64.cfg ... Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
-rw-r--r--README.md54
-rwxr-xr-xpackage.sh130
-rw-r--r--scripts/linux/fedora/.gitignore2
-rw-r--r--scripts/linux/fedora/rpm.spec82
-rwxr-xr-xscripts/linux/fedora/usr/bin/cura2
-rw-r--r--scripts/linux/fedora/usr/share/.gitignore1
-rwxr-xr-xscripts/linux/fedora/usr/share/applications/cura.desktop10
7 files changed, 281 insertions, 0 deletions
diff --git a/README.md b/README.md
index 98d53329e1..e6cdbf4636 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,60 @@ The "package.sh" script generates a final release package. You should not need i
Both MacOS and Linux require some extra instructions for development, as you need to prepare an environment. Look below at the proper section to see what is needed.
+Fedora
+--------
+
+Fedora builds Cura by using ```mock```, thereby enabling it to build RPMs for
+every distribution that ```mock``` has a configuration file for. In pratice
+this means that Fedora can build RPMs for several versions of Fedora, CentOS
+and RHEL.
+
+Cura can be built under a regular user account, there is no need to have root
+privileges. In fact, having root privileges is very much discouraged.
+
+However, the user account under which the build is performed needs to be a
+member of the 'mock' group. This is accomplished as follows:
+
+```bash
+sudo usermod -a -G mock "$(whoami)"
+```
+
+To install the software that is required to build Cura, run the following
+commands:
+
+```bash
+sudo yum install -y git rpmdevtools rpm-build mock arduino
+
+# Ensure that the Arduino tools can be found by the build
+sudo mkdir -p /usr/share/arduino/hardware/tools/avr
+sudo ln -sf /usr/bin /usr/share/arduino/hardware/tools/avr/bin
+
+```
+
+To build and install Cura, run the following commands:
+
+```bash
+# Get the Cura software, only required once
+git clone https://github.com/daid/Cura.git Cura
+
+# Build for the current system
+cd Cura
+./package.sh fedora
+
+# Install on the current system
+sudo yum localinstall -y scripts/linux/fedora/RPMS/Cura-*.rpm
+```
+
+Examples of building other configurations:
+
+```bash
+# Build for Fedora rawhide x86-64 and i386
+./package.sh fedora fedora-rawhide-x86_64.cfg fedora-rawhide-i386.cfg
+
+# Since only the basename of the mock configurations is used, this also works:
+./package.sh fedora /etc/mock/fedora-21-x86_64.cfg /etc/mock/fedora-rawhide-i386.cfg
+```
+
Debian and Ubuntu Linux
--------
diff --git a/package.sh b/package.sh
index 018d895219..e6c5570d25 100755
--- a/package.sh
+++ b/package.sh
@@ -95,6 +95,8 @@ if [ "$BUILD_TARGET" = "none" ]; then
echo "$0 debian_armhf"
echo "$0 darwin"
echo "$0 freebsd"
+ echo "$0 fedora # current system"
+ echo "$0 fedora \"mock_config_file\" ... # different system(s)"
exit 0
fi
@@ -144,6 +146,7 @@ if [ ! -d "$ARDUINO_PATH" ]; then
exit 1
fi
+
#Build the Ultimaker Original firmwares.
gitClone git@github.com:Ultimaker/Marlin.git _UltimakerMarlin
cd _UltimakerMarlin/Marlin
@@ -380,6 +383,133 @@ if [ "$BUILD_TARGET" = "debian_armhf" ]; then
fi
#############################
+# Fedora Generic
+#############################
+
+function sanitiseVersion() {
+ local _version="$1"
+ echo "${_version//-/.}"
+}
+
+function fedoraCreateSRPM() {
+ local _curaName="$1"
+ local _version="$(sanitiseVersion "$2")"
+ local _srcSpecFile="$3"
+ local _srcSpecFileRelease="$4"
+ local _dstSrpmDir="$5"
+
+ local _dstTarSources="$HOME/rpmbuild/SOURCES/$_curaName-$_version.tar.gz"
+ local _dstSpec="$HOME/rpmbuild/SPECS/$_curaName-$_version.spec"
+
+ local _namePower="Power"
+ local _nameCuraEngine="CuraEngine"
+
+ gitClone "https://github.com/GreatFruitOmsk/Power" "$_namePower"
+ gitClone "$CURA_ENGINE_REPO" "$_nameCuraEngine"
+
+ cd "$_namePower"
+ local _gitPower="$(git rev-list -1 HEAD)"
+ cd -
+
+ cd "$_nameCuraEngine"
+ local _gitCuraEngine="$(git rev-list -1 HEAD)"
+ cd -
+
+ local _gitCura="$(git rev-list -1 HEAD)"
+
+ rpmdev-setuptree
+
+ rm -fv "$_dstTarSources"
+ tar \
+ --exclude-vcs \
+ --transform "s#^#$_curaName-$_version/#" \
+ -zcvf "$_dstTarSources" \
+ "$_nameCuraEngine" \
+ "$_namePower" \
+ Cura \
+ resources \
+ plugins \
+ scripts/linux/cura.py \
+ scripts/linux/fedora/usr
+
+ sed \
+ -e "s#__curaName__#$_curaName#" \
+ -e "s#__version__#$_version#" \
+ -e "s#__gitCura__#$_gitCura#" \
+ -e "s#__gitCuraEngine__#$_gitCuraEngine#" \
+ -e "s#__gitPower__#$_gitPower#" \
+ -e "s#__basedir__#scripts/linux/fedora#" \
+ "$_srcSpecFile" \
+ > "$_dstSpec"
+
+ rpmbuild -bs "$_dstSpec"
+
+ mkdir -pv "$_dstSrpmDir"
+ cp -v \
+ "$HOME/rpmbuild/SRPMS/$_curaName-$_version-$_srcSpecFileRelease.src.rpm" \
+ "$_dstSrpmDir"
+}
+
+function buildFedora() {
+ local _nameForRpm="Cura"
+ local _versionForRpm="$(sanitiseVersion "$BUILD_NAME")"
+
+ #
+ # SRPM
+ #
+
+ local _srcSpecFile="scripts/linux/fedora/rpm.spec"
+ local _srcSpecFileRelease="$(rpmspec -P "$_srcSpecFile" | grep -E '^Release:'|awk '{print $NF}')"
+ local _dstSrpmDir="scripts/linux/fedora/SRPMS"
+
+ fedoraCreateSRPM \
+ "$_nameForRpm" \
+ "$_versionForRpm" \
+ "$_srcSpecFile" \
+ "$_srcSpecFileRelease" \
+ "$_dstSrpmDir"
+
+ #
+ # RPM
+ #
+
+ local _srpmFile="$_dstSrpmDir/$_nameForRpm-$_versionForRpm-$_srcSpecFileRelease.src.rpm"
+ local _dstRpmDir="scripts/linux/fedora/RPMS"
+
+ while [ $# -ne 0 ]; do
+ local _mockRelease="$(basename "${1%\.cfg}")"
+ local _mockReleaseArg=""
+ if [ -n "$_mockRelease" ]; then
+ _mockReleaseArg="-r $_mockRelease"
+ fi
+
+ mkdir -pv "$_dstRpmDir/$_mockRelease"
+ mock \
+ $_mockReleaseArg \
+ --resultdir="$_dstRpmDir/$_mockRelease" \
+ "$_srpmFile"
+
+ shift 1
+ done
+}
+
+#############################
+# Fedora RPMs
+#############################
+
+if [ "$BUILD_TARGET" = "fedora" ]; then
+ shift 1 # skip "fedora" arg
+
+ if [ $# -eq 0 ]; then
+ "$0" "$BUILD_TARGET" ""
+ else
+ buildFedora "${@}"
+ fi
+
+ exit
+fi
+
+#############################
# Rest
#############################
diff --git a/scripts/linux/fedora/.gitignore b/scripts/linux/fedora/.gitignore
new file mode 100644
index 0000000000..ea03173056
--- /dev/null
+++ b/scripts/linux/fedora/.gitignore
@@ -0,0 +1,2 @@
+/RPMS/
+/SRPMS/
diff --git a/scripts/linux/fedora/rpm.spec b/scripts/linux/fedora/rpm.spec
new file mode 100644
index 0000000000..230aebf4c0
--- /dev/null
+++ b/scripts/linux/fedora/rpm.spec
@@ -0,0 +1,82 @@
+%global _curaName __curaName__
+%global _baseDir __basedir__
+%global _version __version__
+%global _gitCura __gitCura__
+%global _gitCuraEngine __gitCuraEngine__
+%global _gitPower __gitPower__
+
+
+Name: %{_curaName}
+Version: %{_version}
+Release: 1%{?dist}
+Summary: 3D printing software aimed at RepRaps and the Ultimaker
+Group: Applications/Engineering
+
+License: GPLv2+
+URL: https://github.com/daid/Cura.git
+Source0: %{_curaName}-%{_version}.tar.gz
+
+BuildRequires: libstdc++-static, glibc-static
+Requires: wxPython, curl
+Requires: python3-setuptools >= 0.6.34
+Requires: python3-PyOpenGL >= 3.0.2, PyOpenGL >= 3.0.2
+Requires: python3-pyserial >= 2.6, pyserial >= 2.6
+Requires: python3-numpy >= 1.6.2, numpy >= 1.6.2
+Requires: python3-power >= 1.2
+
+
+%description
+%{_curaName} is a full software solution for 3D printing, aimed at RepRaps and
+the Ultimaker.
+
+It's free software payed for and maintained by Ultimaker.
+
+
+%prep
+%setup -q -n %{name}-%{version}
+
+
+%build
+make -C CuraEngine VERSION=%{_version}
+
+dstDir="%{_baseDir}/usr/share/cura"
+
+rm -frv "$dstDir"
+mkdir -pv "$dstDir"
+
+cp -av -t "$dstDir" \
+ Cura \
+ resources \
+ plugins \
+ CuraEngine/build/CuraEngine \
+ Power/power \
+ scripts/linux/cura.py
+
+echo "%{_version}" > "$dstDir/Cura/version"
+cat > "$dstDir/Cura/versions" << EOF
+# Git SHAs of software used to build %{_curaName}
+Cura : %{_gitCura}
+CuraEngine : %{_gitCuraEngine}
+Power : %{_gitPower}
+EOF
+
+
+%install
+mkdir -pv "%{buildroot}"
+cp -av -t "%{buildroot}" "%{_baseDir}/usr"
+
+
+%files
+%defattr(-,root,root)
+%{_bindir}/cura
+%attr(644, root, root) %{_datarootdir}/applications/cura.desktop
+%attr(755, root, root) %{_datarootdir}/cura/Cura/cura.py
+%attr(755, root, root) %{_datarootdir}/cura/Cura/util/pymclevel/mce.py
+%attr(755, root, root) %{_datarootdir}/cura/CuraEngine
+%attr(755, root, root) %{_datarootdir}/cura/cura.py
+%{_datarootdir}/cura
+
+
+%changelog
+* Wed Jan 14 2015 Ferry Huberts <ferry.huberts@pelagic.nl>
+- Initial packaging, currently at version 15.01.RC7
diff --git a/scripts/linux/fedora/usr/bin/cura b/scripts/linux/fedora/usr/bin/cura
new file mode 100755
index 0000000000..bd9ef0e1a4
--- /dev/null
+++ b/scripts/linux/fedora/usr/bin/cura
@@ -0,0 +1,2 @@
+#!/bin/sh
+PYTHONPATH=$PYTHONPATH:/usr/share/cura/ /usr/bin/python /usr/share/cura/cura.py "$@"
diff --git a/scripts/linux/fedora/usr/share/.gitignore b/scripts/linux/fedora/usr/share/.gitignore
new file mode 100644
index 0000000000..90e6af15ef
--- /dev/null
+++ b/scripts/linux/fedora/usr/share/.gitignore
@@ -0,0 +1 @@
+/cura/
diff --git a/scripts/linux/fedora/usr/share/applications/cura.desktop b/scripts/linux/fedora/usr/share/applications/cura.desktop
new file mode 100755
index 0000000000..25dcc7f364
--- /dev/null
+++ b/scripts/linux/fedora/usr/share/applications/cura.desktop
@@ -0,0 +1,10 @@
+[Desktop Entry]
+Type=Application
+Name=Cura
+Comment=Cura
+Icon=/usr/share/cura/resources/images/c.png
+Exec=/usr/bin/python /usr/share/cura/cura.py
+Path=/usr/share/cura/
+StartupNotify=true
+Terminal=false
+Categories=Graphics;3DGraphics;Engineering;Development;