aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile31
-rwxr-xr-xconfigure8
-rw-r--r--info/libgamma.texinfo8
-rwxr-xr-xsrc/extract/cut4
-rw-r--r--src/lib/gamma-helper.c4
-rw-r--r--src/lib/libgamma-error.c.gpp4
-rw-r--r--src/lib/libgamma-error.h4
7 files changed, 46 insertions, 17 deletions
diff --git a/Makefile b/Makefile
index 80c5145..c5c1861 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ GPP ?= gpp
# C compiler, GNU C Compiler by default
CC ?= gcc
+CC_BASE ?= $(shell echo $(CC) | cut -d ' ' -f 1)
# Enabled warnings.
@@ -44,7 +45,7 @@ WARN = -Wall -Wextra -pedantic -Wformat=2 -Winit-self -Wmissing-include-dirs \
-Wwrite-strings -Waggregate-return -Wpacked -Wstrict-prototypes \
-Wold-style-definition
-ifeq ($(CC),gcc)
+ifeq ($(CC_BASE),gcc)
WARN += -Wdouble-promotion -Wtrampolines -Wsign-conversion -Wsync-nand \
-Wlogical-op -Wvector-operation-performance \
-Wunsuffixed-float-constants -Wsuggest-attribute=const \
@@ -82,18 +83,23 @@ LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
# Change by .config.mk to reflect what is used in the OS, linux uses so: libgamma.so
SO = so
+# These three below are changed by .config.mk if required
+SHARED = -shared
+LDSO = -Wl,-soname,libgamma.$(SO).$(LIB_MAJOR)
+PIC = -fPIC
+
# Include configurations from `./configure`.
include .config.mk
# Optimisation level (and debug flags.)
ifeq ($(DEBUG),y)
-ifeq ($(CC),gcc)
-OPTIMISE = -Og -g
+ifeq ($(CC_BASE),gcc)
+OPTIMISE = -Og -g3
else
OPTIMISE = -g
endif
else
-ifeq ($(CC),gcc)
+ifeq ($(CC_BASE),gcc)
OPTIMISE = -Ofast
else
OPTIMISE = -O
@@ -110,23 +116,24 @@ endif
TEST_FLAGS = $(OPTIMISE) $(WARN) -std=$(STD) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
-fstrict-aliasing -fstrict-overflow -fno-builtin
-ifeq ($(CC),gcc)
+ifeq ($(CC_BASE),gcc)
TEST_FLAGS += -fstack-usage -ftree-vrp -fipa-pure-const -funsafe-loop-optimizations
endif
# Options for the C compiler for the library.
LIB_FLAGS = $(TEST_FLAGS) $(DEBUG_FLAGS) $(DEFINITIONS) -DLIBGAMMA_CONFIG_H
-# These two below are changed by .config.mk if required
-SHARED = -shared
-LDSO = -Wl,-soname,libgamma.$(SO).$(LIB_MAJOR)
-
-ifeq ($(CC),gcc)
+ifeq ($(CC_BASE),gcc)
TEST_FLAGS += -D__GCC__
LIB_FLAGS += -D__GCC__
endif
+ifeq ($(HAVE_INT128),y)
+LIB_FLAGS += -DHAVE_INT128
+endif
+
+
# Build rules.
@@ -154,10 +161,10 @@ bin/libgamma.$(SO):
obj/lib/%.o: src/lib/%.c src/lib/*.h
mkdir -p $(shell dirname $@)
- $(CC) $(LIB_FLAGS) $(LIBS_C) -fPIC -c -o $@ $<
+ $(CC) $(LIB_FLAGS) $(LIBS_C) $(PIC) -s -c -o $@ $<
obj/lib/%.o: obj/lib/%.c src/lib/*.h
- $(CC) $(LIB_FLAGS) $(LIBS_C) -fPIC -iquote"$$(dirname "$<" | sed -e 's:^obj:src:')" -c -o $@ $<
+ $(CC) $(LIB_FLAGS) $(LIBS_C) $(PIC) -iquote"$$(dirname "$<" | sed -e 's:^obj:src:')" -c -o $@ $<
obj/%: src/%.gpp src/extract/libgamma-*-extract
mkdir -p $(shell dirname $@)
diff --git a/configure b/configure
index e8820e9..98cadbc 100755
--- a/configure
+++ b/configure
@@ -36,10 +36,12 @@ for arg in "$@"; do
enable_drm=1
fake_w32gdi=1
fake_quartz=1
+ os=gnu
;;
(--linux) enable_vidmode=1
enable_randr=1
enable_drm=1
+ os=gnu
;;
(--*bsd=developer) enable_debug=1
enable_dummy=1
@@ -176,10 +178,14 @@ if [ ${fake_quartz} = 1 ]; then
fi
if [ ${os} = w32 ]; then
echo 'SO = dll' >&3
+ echo 'PIC = ' >&3
+ echo 'SHARED = -mdll' >&3
elif [ ${os} = os ]; then
- echo 'SO = dylib' >&3n
+ echo 'SO = dylib' >&3
echo 'SHARED = -dynamiclib' >&3
echo 'LDSO = ' >&3
+elif [ ${os} = gnu ]; then
+ echo 'HAVE_INT128 = y' >&3
fi
echo >&4
diff --git a/info/libgamma.texinfo b/info/libgamma.texinfo
index 442e117..27c170d 100644
--- a/info/libgamma.texinfo
+++ b/info/libgamma.texinfo
@@ -271,6 +271,14 @@ Quartz/CoreGraphics adjustment method.
Also enables @option{--debug}.
@end table
+Configuring with @option{--windows} or
+@option{--windows=developer} will also add
+configurations to the make script needed
+to compile for Windows. @option{--mac-os-x} or
+@option{--mac-os-x=developer} will do add
+configurations to the make script needed
+to compile for OS X.
+
When you have configured @command{libgamma}
using @command{./configure} you can compile
the library with @command{make}. Straight up
diff --git a/src/extract/cut b/src/extract/cut
index fa6cb99..7399b7f 100755
--- a/src/extract/cut
+++ b/src/extract/cut
@@ -36,7 +36,7 @@ while i < n:
delimiter = sys.argv[i]
elif arg == '-f':
i += 1
- fields += [int(f) for f in sys.argv[i].split(',')]
+ fields += [int(f) - 1 for f in sys.argv[i].split(',')]
elif arg == '--complement':
complement = True
i += 1
@@ -47,7 +47,7 @@ fields = set(fields)
def modify(line):
line = line.split(delimiter)
- if not complement:
+ if complement:
line = [line[i] for i in range(len(line)) if i not in fields]
else:
line = [line[i] for i in range(len(line)) if i in fields]
diff --git a/src/lib/gamma-helper.c b/src/lib/gamma-helper.c
index 45a38b5..d30e5ab 100644
--- a/src/lib/gamma-helper.c
+++ b/src/lib/gamma-helper.c
@@ -55,7 +55,7 @@ static inline uint64_t float_to_64(float value)
{
/* XXX Which is faster? */
-#ifdef __GCC__
+#ifdef HAVE_INT128
/* `__int128` is a GNU C extension, which
(because it is not ISO C) emits a warning
under -pedantic. */
@@ -121,7 +121,7 @@ static inline uint64_t double_to_64(double value)
{
/* XXX Which is faster? */
-#ifdef __GCC__
+#ifdef HAVE_INT128
/* `__int128` is a GNU C extension, which
(because it is not ISO C) emits a warning
under -pedantic. */
diff --git a/src/lib/libgamma-error.c.gpp b/src/lib/libgamma-error.c.gpp
index 0378f57..717f11b 100644
--- a/src/lib/libgamma-error.c.gpp
+++ b/src/lib/libgamma-error.c.gpp
@@ -37,7 +37,11 @@ $>export PATH=".:${PATH}"
* Group that the user needs to be a member of if
* `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned.
*/
+#ifndef __WIN32__
gid_t libgamma_group_gid = 0;
+#else
+short libgamma_group_gid = 0;
+#endif
/**
* Group that the user needs to be a member of if
diff --git a/src/lib/libgamma-error.h b/src/lib/libgamma-error.h
index d11dbc1..419985f 100644
--- a/src/lib/libgamma-error.h
+++ b/src/lib/libgamma-error.h
@@ -34,7 +34,11 @@
* Group that the user needs to be a member of if
* `LIBGAMMA_DEVICE_REQUIRE_GROUP` is returned.
*/
+#ifndef __WIN32__
extern gid_t libgamma_group_gid;
+#else
+extern short libgamma_group_gid;
+#endif
/**
* Group that the user needs to be a member of if