Bläddra i källkod

Merge pull request #42 from troglobit/configure-script

Convert build system to GNU configure & build
Joachim Nilsson 5 år sedan
förälder
incheckning
73d7e48da5
No account linked to committer's email
9 ändrade filer med 84 tillägg och 28 borttagningar
  1. 20
    0
      .gitignore
  2. 0
    27
      Makefile
  3. 20
    0
      Makefile.am
  4. 21
    1
      README.md
  5. 3
    0
      autogen.sh
  6. 13
    0
      configure.ac
  7. 7
    0
      src/Makefile.am
  8. 0
    0
      src/helpers.h
  9. 0
    0
      src/light.h

+ 20
- 0
.gitignore Visa fil

@@ -1,2 +1,22 @@
1
+*~
2
+*.o
3
+.deps
4
+GPATH
5
+GRTAGS
6
+GTAGS
1 7
 light
2 8
 light.1.gz
9
+aclocal.m4
10
+autom4te.cache
11
+compile
12
+config.h
13
+config.h.in
14
+config.log
15
+config.status
16
+configure
17
+depcomp
18
+install-sh
19
+missing
20
+stamp-h1
21
+Makefile
22
+Makefile.in

+ 0
- 27
Makefile Visa fil

@@ -1,27 +0,0 @@
1
-ifeq ($(PREFIX),)
2
-	PREFIX := /usr
3
-endif
4
-BINDIR=$(DESTDIR)$(PREFIX)/bin
5
-MANDIR=$(DESTDIR)$(PREFIX)/share/man/man1
6
-
7
-CC=gcc
8
-CFLAGS=-std=c89 -O2 -pedantic -Wall -I"./include" -D_XOPEN_SOURCE=500
9
-
10
-light: src/helpers.c src/light.c src/main.c
11
-	$(CC) $(CFLAGS) -g -o $@ $^
12
-
13
-install: light
14
-	install -dZ $(BINDIR)
15
-	install -DZ -m 4755 ./light -t $(BINDIR)
16
-	install -dZ $(MANDIR)
17
-	install -DZ light.1 -t $(MANDIR)
18
-
19
-uninstall:
20
-	rm -f $(BINDIR)/light
21
-	rm -rf /etc/light
22
-	rm -f $(MANDIR)/light.1.gz
23
-
24
-clean:
25
-	rm -vfr *~ light light.1.gz
26
-
27
-.PHONY: man install uninstall clean

+ 20
- 0
Makefile.am Visa fil

@@ -0,0 +1,20 @@
1
+SUBDIRS        = src
2
+dist_man1_MANS = light.1
3
+doc_DATA       = README.md LICENSE CHANGELOG
4
+EXTRA_DIST     = README.md LICENSE CHANGELOG
5
+
6
+#
7
+# Target to run when building a release
8
+#
9
+release: distcheck
10
+	@for file in $(DIST_ARCHIVES); do	\
11
+		md5sum $$file > ../$$file.md5;	\
12
+	done
13
+	@mv $(DIST_ARCHIVES) ../
14
+	@echo
15
+	@echo "Resulting release files:"
16
+	@echo "================================================================="
17
+	@for file in $(DIST_ARCHIVES); do					\
18
+		printf "$$file    \tDistribution tarball\n";			\
19
+		printf "$$file.md5\t"; cat ../$$file.md5 | cut -f1 -d' ';	\
20
+	done

+ 21
- 1
README.md Visa fil

@@ -29,7 +29,27 @@ I recommend you go with light-git as you might miss important features and bugfi
29 29
 
30 30
 ### Manual
31 31
 
32
-`make && sudo make install`
32
+We recommended downloading a versioned tarball from the relases page on
33
+GitHub.  Download and untar the archive:
34
+
35
+    tar xf light-x.yy.tar.gz
36
+    cd light-x.yy/
37
+    ./configure && make
38
+    sudo make install
39
+
40
+However, should you want to try the latest GitHub source you first need
41
+to clone the repository and run the `autogen.sh` script.  This requires
42
+`automake` and `autoconf` to be installed on your system.
43
+
44
+    ./autogen.sh
45
+    ./configure && make
46
+    sudo make install
47
+
48
+The `configure` script and `Makefile.in` files are not part of GIT
49
+because they are generated at release time with `make release`.
50
+
51
+
52
+### Permissions
33 53
 
34 54
 **Optional:** If you want to use udev rules instead of suid to manage sysfs permissions, you may skip the `make install` step and instead add something like the following to `/etc/udev/rules.d/90-backlight.rules` after copying your binaries:
35 55
 ```

+ 3
- 0
autogen.sh Visa fil

@@ -0,0 +1,3 @@
1
+#!/bin/sh
2
+
3
+autoreconf -W portability -visfm

+ 13
- 0
configure.ac Visa fil

@@ -0,0 +1,13 @@
1
+AC_INIT([light], [1.2-dev], [https://github.com/haikarainen/light/issues])
2
+AM_INIT_AUTOMAKE([1.11 foreign])
3
+AM_SILENT_RULES([yes])
4
+
5
+AC_CONFIG_SRCDIR([src/light.c])
6
+AC_CONFIG_HEADER([config.h])
7
+AC_CONFIG_FILES([Makefile src/Makefile])
8
+
9
+AC_PROG_CC
10
+AC_PROG_INSTALL
11
+AC_HEADER_STDC
12
+
13
+AC_OUTPUT

+ 7
- 0
src/Makefile.am Visa fil

@@ -0,0 +1,7 @@
1
+bin_PROGRAMS   = light
2
+light_SOURCES  = main.c light.c light.h helpers.c helpers.h
3
+light_CPPFLAGS = -I../include -D_XOPEN_SOURCE=500
4
+light_CFLAGS   = -W -Wall -Wextra -pedantic -std=c89
5
+
6
+install-exec-hook:
7
+	chmod 4755 $(DESTDIR)$(bindir)/light

include/helpers.h → src/helpers.h Visa fil


include/light.h → src/light.h Visa fil