diff options
author | B. Stack <bgstack15@gmail.com> | 2021-08-18 15:44:46 -0400 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2021-08-18 15:47:14 -0400 |
commit | 2be9cca3e7547c33a239c376bbbe08903d93a854 (patch) | |
tree | 0cfcd7741d97f00a2d83c0f7586ffcf5fff2ac07 | |
parent | initial commit (diff) | |
download | gtk3-classic-build-2be9cca3e7547c33a239c376bbbe08903d93a854.tar.gz gtk3-classic-build-2be9cca3e7547c33a239c376bbbe08903d93a854.tar.bz2 gtk3-classic-build-2be9cca3e7547c33a239c376bbbe08903d93a854.zip |
add rpm script
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | README.md | 20 | ||||
-rw-r--r-- | for-repo/README.md | 22 | ||||
-rwxr-xr-x | gtk-classic-build-rpm.sh | 145 |
4 files changed, 188 insertions, 2 deletions
@@ -4,3 +4,6 @@ gtk*z *.changes* gtk3classic/ .*.swp +gtk3/ +gtk3classic/ +*_vers @@ -1,6 +1,8 @@ -# Readme for gtk3-classic-build-deb +# Readme for gtk3-classic-build Gtk3-classic-build-deb is [bgstack15](https://bgstack15.wordpress.com)'s builds of [gtk3-classic](https://github.com/lah7/gtk3-classic) for Devuan Ceres. Check out the final assets at my [OBS sub-project](https://build.opensuse.org/project/show/home:bgstack15:gtk3-classic). +Gtk3-classic-build-rpm is by the same author, for Fedora. Check out the final assets on my [COPR](https://copr.fedorainfracloud.org/coprs/bgstack15/gtk3-classic/package/gtk3/). + ## Overview Notable improvements over stock gtk3 include * Regular type-to-navigate-to-filename in the file dialog instead of the "typeahead" behavior @@ -10,13 +12,19 @@ Notable weaknesses include: * Always-on mnemonics is still not implemented. Keep using [gtk3-automnemonics](https://pkginfo.devuan.org/cgi-bin/package-query.html?c=package&q=gtk3-automnemonics) for that. ## Using +### deb script The `gtk3-classic-build-deb.sh` script and Makefile can be used to generate the build assets that can be used to build the binary dpkgs of gtk3 with the gtk3-classic patches. The shell script finds the available gtk3 versions in debian, and gtk3-classic releases, and then finds the highest version that matches between the two. This highest version then gets downloaded, given the patches in `debian/patches/series`, and then the .dsc and .debian.tar.xz file are generated! +### rpm script +The `gtk-classic-build-rpm.sh` script can be used to generate a git repository contents that can be used by rpkg on the COPR. This script also generates a src.rpm which can be used to build an rpm locally. + ## Upstreams ### Build script -The build script is loosely inspired by [luigifab/deb.sh](https://gist.github.com/luigifab/0fce786cdb93b5687069a82f490ea95e) (gist.github.com), but is maintained separately. +The deb build script is loosely inspired by [luigifab/deb.sh](https://gist.github.com/luigifab/0fce786cdb93b5687069a82f490ea95e) (gist.github.com), but is maintained separately. + +The rpm build script is loosely inspired by my script for [LibreWolf rpm](https://gitlab.com/bgstack15/librewolf-fedora) which makes its own [git repo](https://gitlab.com/bgstack15/librewolf-fedora-ff) output for copr. ### gtk3-classic The [gtk3-classic](https://github.com/lah7/gtk3-classic) patch set is one of the main inputs to this process. @@ -24,10 +32,13 @@ The [gtk3-classic](https://github.com/lah7/gtk3-classic) patch set is one of the ### gtk3 The debian [orig](http://deb.debian.org/debian/pool/main/g/gtk+3.0/gtk+3.0_3.24.29.orig.tar.xz) tarball is used for the build process. +The rpm uses the upstream gtk3 release asset. + ## Alternatives * [gtk3-stackrpms](https://gitlab.com/bgstack15/stackrpms/-/tree/master/gtk3-stackrpms) suite which suits my needs almost exactly, minus the file dialog type-to-find functionality. ## Dependencies +### deb script To run the build script you need: * rmadison * git @@ -35,6 +46,11 @@ To run the build script you need: To build gtk3, you need the standard set which is available in the `debian/control` file. +### rpm script +* git +* yum +* fedpkg-minimal + ## References * [gtk3-stackrpms](https://gitlab.com/bgstack15/stackrpms/-/tree/master/gtk3-stackrpms) suite * [gtk3-nooverlayscrollbar](https://pkginfo.devuan.org/cgi-bin/policy-query.html?c=package&q=gtk3-nooverlayscrollbar&x=submit) in Devuan diff --git a/for-repo/README.md b/for-repo/README.md new file mode 100644 index 0000000..4373acb --- /dev/null +++ b/for-repo/README.md @@ -0,0 +1,22 @@ +# README for gtk3-classic-build-gtk3 + +## Overview +After using the [gtk-classic-build-rpm.sh](https://gitlab.com/bgstack15/gtk3-classic-build) script, a modified copy of Fedora gtk3 src.rpm exists on the local filesystem. + +If this README exists in a directory named `for-repo`, then it is still in its source location from the above link, and not in its final location. + +## This repository +This README file belongs in the modified copy of that Fedora gtk3 src.rpm [git repository](https://src.fedoraproject.org/rpms/gtk3). That modified git repo can be sent up to a [new web location](https://gitlab.com/bgstack15/gtk3-classic-build-gtk3). + +Fedora [COPR](https://copr.fedorainfracloud.org/coprs/bgstack15/gtk3-classic/packages/) can then use rpkg to pull this new git repository, so users do not have to upload the 21MB srpm manually. + +## Using this repository +The `gtk-classic-build-rpm.sh` script itself performs the work of bringing in this README file and fixes the .gitignore file. + +## Differences from upstream repo +The [gtk3-classic](https://github.com/lah7/gtk3-classic) patchset makes some fundamental changes to gtk3, which are implemented in the srpm as a set of patches. The same .orig.tar.xz file is used. +Files that are added or modified: +* `*.patch` that are not named specifically here. The original gtk3 srpm had no .patch files. +* gtk3.spec +* this README.md +* .gitignore diff --git a/gtk-classic-build-rpm.sh b/gtk-classic-build-rpm.sh new file mode 100755 index 0000000..02ffbf6 --- /dev/null +++ b/gtk-classic-build-rpm.sh @@ -0,0 +1,145 @@ +#!/bin/sh +# File: gtk-classic-build-rpm.sh +# Location: https://gitlab.com/bgstack15/gtk3-classic-build +# Author: bgstack15 +# Startdate: 2021-08-18 08:06 +# SPDX-License-Identifier: GPL-3.0 +# Title: Build src rpm for gtk3-classic +# Purpose: build git repo and src.rpm for gtk3-classic +# History: +# Usage: +# ./gtk-classic-build.rpm +# References: +# rpm fedpkg-minimal +# Improve: +# Handle other versions of gtk other than only what is installed on dev system. +# Dependencies: +# git, yum | dnf + +test -z "${WORKDIR}" && WORKDIR="$( readlink -f . )" +export WORKDIR + +GTK3CLASSIC_GIT=https://github.com/lah7/gtk3-classic +FEDORA_GTK3_GIT=https://src.fedoraproject.org/rpms/gtk3 +cd "${WORKDIR}" + +#### Find versions of gtk3-classic available, which involves fetching the repo +if ! test "$( cd "${WORKDIR}/gtk3classic" 2>/dev/null && git remote -v | grep -o 'origin https://github.com/lah7/gtk3-classic' | head -n1 )" = "origin https://github.com/lah7/gtk3-classic" ; then + git clone "${GTK3CLASSIC_GIT}" "${WORKDIR}/gtk3classic" +else + ( + cd "${WORKDIR}/gtk3classic" + git checkout master + git pull --all + ) +fi +classic_vers="$( cd "${WORKDIR}/gtk3classic" ; git tag | sort -r --sort=version | head -n 20 )" +echo "${classic_vers}" > "${WORKDIR}/classic_vers" + +### Find versions of gtk3 available to Fedora Linux +fedora_vers="$( yum list installed gtk3 | awk '$1~/gtk/{print $2,$2}' | awk '{gsub("-[0-9]+.fc[0-9]+","",$1);print}' | sort -r --sort=version )" +echo "${fedora_vers}" > "${WORKDIR}/fedora_vers" + +### Find highest matching version +highest_ver="$( awk 'NR==FNR{a[$0];next} NR!=FNR{if($1 in a){print}}' "${WORKDIR}/classic_vers" "${WORKDIR}/fedora_vers" | head -n1 )" +raw_version="$( echo "${highest_ver}" | awk '{print $1}' )" +fedora_version="$( echo "${highest_ver}" | awk '{print $2}' | awk -F'-' '{print $2}' | sed -r -e 's/fc/f/g;' | awk -F'.' '{print $2}' )" # fedora gtk3 package does not use git tags for gtk3 versions; it uses branch names for each release of Fedora, so f33. +fedora_git="gtk3" # the name of this directory must be gtk3 so `fedpkg sources` works correctly + +### Fetch Fedora Linux sources +cd "${WORKDIR}" +git clone "${FEDORA_GTK3_GIT}" "${fedora_git}" +cd "${WORKDIR}/${fedora_git}" +git checkout "${fedora_version}" + +### Fetch gtk3-classic sources +( + cd "${WORKDIR}/gtk3classic" + git checkout "${raw_version}" +) + +### Protect against uncleaned directory +if test -f "gtk3.spec.orig" ; +then + cp -pr gtk3.spec.orig gtk3.spec +else + cp -pr gtk3.spec gtk3.spec.orig +fi +### Combine +sed -i -r -e '/Release:/{s/[0-9]+%/100%/}' gtk3.spec +{ + sed -n -r -e '1,/%changelog/p' gtk3.spec + echo "* $( date "+%a %b %d %Y" ) B. Stack <bgstack15@gmail.com> - ${raw_version}-100" + echo "- Rebuild gtk3 with gtk3-classic patches" + echo "- Remove tests" + echo "" + sed -r -e '1,/%changelog/d' gtk3.spec +} > gtk3.spec.1 +cp -p "${WORKDIR}/gtk3classic/"*.patch "${WORKDIR}/${fedora_git}" +# build patch list +patch_list="$( grep -viE "^\s*(#|$)" "${WORKDIR}/gtk3classic/series" )" +case "${raw_version}" in + 3.24.29) + # Fedora has already applied: + # appearance__buttons-menus-icons.patch + # 3.24.29 just does not need: + # appearance__smaller-statusbar file-chooser__places-sidebar + remove_list="appearance__smaller-statusbar file-chooser__places-sidebar appearance__buttons-menus-icons" + for word in ${remove_list} ; do rm ${word}.patch ; done + patch_list="$( echo "${patch_list}" | grep -v $( for word in ${remove_list} ; do printf '%s %s ' '-e' "${word}" ; done ) )" + #echo "patch_list=\"${patch_list}\"" + ;; + *) echo "Unknown patchset for ${raw_version}. Using all patches." ;; +esac +# add %patch macros +{ + # print everything up to %description, excluding description + sed -n -r -e '1,/%description/p' gtk3.spec.1 | head -n -1 + echo "BuildRequires: libjpeg-turbo-devel" + # adapt the dpkg series file contents for an rpm spec file + x=799 + for word in ${patch_list} ; + do + x=$((x+1)) + echo "Patch${x}: ${word}" + done + # print the next section up to but excluding %build + sed -n -r -e '/%description/,/%build/p' gtk3.spec.1 | head -n -1 + x=799 + for word in ${patch_list} ; + do + x=$((x+1)) + echo "%patch${x} -p1" + done + sed -n -r -e '/%build/,$p' gtk3.spec.1 +} > gtk3.spec.2 +# Remove tests +{ + sed -r -e '/%package tests/,/the functionality of the installed/d' -e '/ble-installed-tests/s/enable-/disable-/g;' -e '/%files tests/,/%changelog/{/%changelog/!d;}' gtk3.spec.2 +} > gtk3.spec.3 +mv gtk3.spec.3 gtk3.spec +rm gtk3.spec.[12] +# that should be everything + +### We can now upload this to a public git repo +cd "${WORKDIR}/${fedora_git}" +git remote add gitlab https://gitlab.com/bgstack15/gtk3-classic-build-gtk3.git +git add gtk3.spec *.patch +cp -pf "${WORKDIR}/for-repo/README.md" README.md +grep -qE '\*\.spec\.orig' .gitignore || echo "*.spec.orig" >> .gitignore +grep -qE '\.\*\.swp' .gitignore || echo '.*.swp' >> .gitignore +git pull +git add . + +### Build srpm +# download all the sources from the sources file +# or we could have used spectool -g gtk3.spec here. +fedpkg sources +mkdir -p ~/rpmbuild/SOURCES +mv -f *.tar.xz ~/rpmbuild/SOURCES +rpmbuild -bs gtk3.spec +cp -pr ~/rpmbuild/SRPMS/gtk3-${raw_version}-100.*.src.rpm "${WORKDIR}/" + +### Clean +test -z "${NO_CLEAN}" && rm -rf "${WORKDIR}/fedora_vers" "${WORKDIR}/classic_vers" "${WORKDIR}/gtk3classic" +# do not remove ${fedora_git} because we need to push updates to gitlab remote, manually |