소스 검색

Initial commit

Alois Mahdal 7 년 전
커밋
1302a104c2
3개의 변경된 파일173개의 추가작업 그리고 0개의 파일을 삭제
  1. 4
    0
      README.md
  2. 51
    0
      slop.spec.in
  3. 118
    0
      trigger_copr

+ 4
- 0
README.md 파일 보기

@@ -0,0 +1,4 @@
1
+README
2
+======
3
+
4
+This repo contains script to build `slop` at my Fedora COPR.

+ 51
- 0
slop.spec.in 파일 보기

@@ -0,0 +1,51 @@
1
+Name:       slop
2
+Version:    __SLOP_VERSION__
3
+Release:    __SLOP_RELEASE__%{?dist}
4
+Summary:    slop - Select Operation
5
+
6
+License:    GPLv3
7
+Source0:    __SLOP_URLBASE__/archive/v%{version}.tar.gz
8
+
9
+BuildRequires: gcc-c++
10
+BuildRequires: cmake
11
+BuildRequires: glew-devel
12
+BuildRequires: glm-devel
13
+BuildRequires: libicu-devel
14
+BuildRequires: libXrender-devel
15
+BuildRequires: mesa-libEGL-devel
16
+
17
+%description
18
+slop (Select Operation) is an application that queries for a selection
19
+from the user and prints the region to stdout.
20
+
21
+Features:
22
+ *  Hovering over a window will cause a selection rectangle
23
+    to appear over it.
24
+ *  Clicking on a window makes slop return the dimensions of
25
+    the window, and it's ID.
26
+ *  OpenGL accelerated graphics where possible.
27
+ *  Supports simple arguments:
28
+     *  Change selection rectangle border size.
29
+     *  Select X display.
30
+     *  Set padding size.
31
+     *  Force window, or pixel selections with the tolerance
32
+        flag.
33
+     *  Set the color of the selection rectangles to match
34
+        your theme! (Even supports transparency!)
35
+     *  Remove window decorations from selections.
36
+ *  Supports custom programmable shaders.
37
+
38
+%prep
39
+%autosetup -n %{name}-%{version}
40
+
41
+%build
42
+cmake -DCMAKE_INSTALL_PREFIX="/usr" ./
43
+
44
+%install
45
+%make_install
46
+
47
+%files
48
+/usr/bin/slop
49
+/usr/include/slop.hpp
50
+/usr/lib/libslopy.so
51
+/usr/share/man/man1/slop.1.gz

+ 118
- 0
trigger_copr 파일 보기

@@ -0,0 +1,118 @@
1
+#!/bin/bash
2
+
3
+warn() {
4
+    echo "$1" >&2
5
+}
6
+
7
+die() {
8
+    warn "fatal: $1"
9
+    exit 3
10
+}
11
+
12
+usage() {
13
+    warn "usage: $0 [options] COPR_PROJECT"
14
+    warn ""
15
+    warn "Options:"
16
+    warn ""
17
+    warn "  -n      dry mode, don't do anything (just show"
18
+    warn "          what would be done)"
19
+    warn "  -r REL  use REL as Release number in SPEC file"
20
+    warn "  -v VER  use VER as Version number in SPEC file"
21
+    warn "  -u URL  use URL as base (to get last tag and"
22
+    warn "          compose Source0 in SPEC file)"
23
+    warn ""
24
+    warn "If -r or -v are not specified, git-describe master"
25
+    warn "is consulted."
26
+    exit 2
27
+}
28
+
29
+last_version() {
30
+    git ls-remote --tag "$UrlBase" \
31
+      | grep '/tags/' \
32
+      | cut -d/ -f3 \
33
+      | sort -V \
34
+      | tail -1 \
35
+      | sed "s/^v//"
36
+}
37
+
38
+trigger() {
39
+    sed -e "
40
+        /^Version/ s|__SLOP_VERSION__|$Version|
41
+        /^Release/ s|__SLOP_RELEASE__|$Release|
42
+        /^Source0/ s|__SLOP_URLBASE__|$UrlBase|
43
+    " <slop.spec.in >"$Tmp/slop.spec"
44
+    copr build "$CoprProject" "$Tmp/slop.spec"
45
+}
46
+
47
+git_guess() {
48
+    #
49
+    # Print git-guessed $1
50
+    #
51
+    local what=$1   # what we want (ver|rel)
52
+    local describe  # full git-describe output
53
+    local xtra=     # extra part (-N-gHASH)
54
+    local num=0     # num. of commits since tag (N)
55
+    local sha=      # '.g'+sha1 of this commit (gHASH)
56
+    describe=$(git describe --tags --always HEAD)
57
+    case $describe in
58
+        *-*)                        #     v1.2.3-21-g654cba
59
+            tag=${describe%%-*}     # tag=v1.2.3
60
+            xtra=${describe#$tag-}  # xtra=-21-g654cba
61
+            num=${xtra%%-*}         # num=21
62
+            sha=.${xtra#$num-}      # sha=.g654cba
63
+            ;;
64
+        *)
65
+            tag=$describe
66
+            ;;
67
+    esac
68
+    case $what in
69
+        ver)    echo "${tag#v}"         ;;
70
+        rel)    echo "$((num + 1))$sha" ;;
71
+    esac
72
+}
73
+
74
+main() {
75
+    local Version       # Version in SPEC file
76
+    local Release       # Release in SPEC file
77
+    local CoprProject   # COPR project
78
+    local UrlBase       # GitHub URL base
79
+    local Tmp           # our temp
80
+    local Branch        # branch to use, if empty, tags are considered
81
+    local DryRun=false  # do not do anything
82
+    UrlBase=https://github.com/AloisMahdal/slop
83
+    Tmp=$(mktemp -d)
84
+    while true; do case $1 in
85
+        -b) Branch=$2;      shift 2 || usage ;;
86
+        -u) UrlBase=$2;     shift 2 || usage ;;
87
+        -r) Release=$2;     shift 2 || usage ;;
88
+        -v) Version=${2#v}; shift 2 || usage ;;
89
+        -n) DryRun=true;    shift ;;
90
+        -*) usage ;;
91
+        *)  break ;;
92
+    esac done
93
+    CoprProject=$1
94
+    test -n "$CoprProject" || usage
95
+    which copr >/dev/null \
96
+     || die "copr not found, try 'sudo install python-copr'"
97
+    if test -n "$Branch"; then
98
+        die "not implemented"
99
+        test -n "$Version" || Version=$(git_guess ver)
100
+        test -n "$Release" || Release=$(git_guess rel)
101
+    else
102
+        test -n "$Version" || Version=$(last_version)
103
+        test -n "$Release" || Release=1
104
+    fi
105
+    $DryRun && {
106
+        warn "dry mode active, we would build:"
107
+        warn "    at $CoprProject"
108
+        test -n "$Branch" && warn "    using branch $Branch"
109
+        test -n "$Branch" || warn "    using last tag"
110
+        warn "    from $UrlBase"
111
+        warn "    yielding slop-$Version-$Release.*.rpm"
112
+        exit 1
113
+    }
114
+    trigger
115
+    rm -rf "$Tmp"
116
+}
117
+
118
+main "$@"