-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathiio-oscilloscope.rb
172 lines (155 loc) · 5.07 KB
/
iio-oscilloscope.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
class IioOscilloscope < Formula
desc 'ADI IIO-Oscilloscope'
homepage 'https://github.com/analogdevicesinc/iio-oscilloscope/'
#url 'https://github.com/analogdevicesinc/iio-oscilloscope/archive/v0.8-master.tar.gz'
url 'https://github.com/analogdevicesinc/iio-oscilloscope.git', :tag=>"v0.8-master"
version '0.8'
sha256 '45b451a6086e52275ec761f2b5c3a2e28bf8bd3264bddaca1da2890cd1efb3d7'
head 'https://github.com/analogdevicesinc/iio-oscilloscope/'
depends_on 'glib'
depends_on 'gtk+'
depends_on 'fftw'
depends_on 'gtkdatabox'
depends_on 'libiio'
depends_on 'libad9361-iio'
depends_on 'jansson'
depends_on 'libmatio'
depends_on 'szip'
depends_on 'hdf5'
depends_on 'gcc'
depends_on 'pkg-config'
patch :DATA
def install
args = ["CC=gcc-8", "PREFIX=#{prefix}"]
system 'make', *args
system 'make', *args, 'install'
end
end
__END__
diff --git a/Makefile b/Makefile
index 92d5736..d2b188d 100644
--- a/Makefile
+++ b/Makefile
@@ -21,9 +21,7 @@ WITH_MINGW := $(if $(shell echo | $(CC) -dM -E - |grep __MINGW32__),y)
EXPORT_SYMBOLS := -Wl,--export-all-symbols
EXPORT_SYMBOLS := $(if $(WITH_MINGW),$(EXPORT_SYMBOLS))
-PKG_CONFIG_PATH := $(SYSROOT)/usr/share/pkgconfig:$(SYSROOT)/usr/lib/pkgconfig:$(SYSROOT)$(PREFIX)/lib/pkgconfig:$(SYSROOT)/usr/lib/$(MULTIARCH)/pkgconfig
-PKG_CONFIG := env PKG_CONFIG_SYSROOT_DIR="$(SYSROOT)" \
- PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config
+PKG_CONFIG := pkg-config
DEPENDENCIES := glib-2.0 gtk+-2.0 gthread-2.0 gtkdatabox fftw3 libiio libxml-2.0 libcurl jansson matio libad9361
@@ -38,10 +36,8 @@ $(foreach dep,$(DEPENDENCIES),$(eval $(call dep_flags,$(dep))))
LDFLAGS := $(DEP_LDFLAGS) \
$(if $(WITH_MINGW),-lwinpthread) \
- -L$(SYSROOT)/usr/lib64 \
-L$(SYSROOT)/usr/lib \
- -L$(SYSROOT)/usr/lib32 \
- -lmatio -lz -lm -lad9361
+ -lz -lm
ifeq ($(WITH_MINGW),y)
LDFLAGS += -Wl,--subsystem,windows
@@ -51,16 +47,17 @@ endif
CFLAGS := $(DEP_CFLAGS) \
-I$(SYSROOT)/usr/include $(if $(WITH_MINGW),-mwindows,-fPIC) \
+ -I$(SYSROOT)/usr/include/malloc \
-Wall -Wclobbered -Wempty-body -Wignored-qualifiers -Wmissing-field-initializers \
-Wmissing-parameter-type -Wold-style-declaration -Woverride-init \
-Wsign-compare -Wtype-limits -Wuninitialized -Wunused-but-set-parameter \
-Wextra -Wno-unused-parameter \
- -Werror -g -std=gnu90 -D_GNU_SOURCE -O2 -funwind-tables \
+ -g -std=gnu90 -D_GNU_SOURCE -O2 -funwind-tables \
-DPREFIX='"$(PREFIX)"' \
-DFRU_FILES=\"$(FRU_FILES)\" -DGIT_VERSION=\"$(GIT_VERSION)\" \
-DGIT_COMMIT_TIMESTAMP='"$(GIT_COMMIT_TIMESTAMP)"' \
-DOSC_VERSION=\"$(GIT_BRANCH)-g$(GIT_HASH)\" \
- -D_POSIX_C_SOURCE=200809L
+ -D_POSIX_C_SOURCE=200809L -D_DARWIN_C_SOURCE
DEBUG ?= 0
ifeq ($(DEBUG),1)
@@ -211,9 +208,9 @@ uninstall-all: uninstall-common-files
xdg-desktop-menu uninstall osc.desktop
ldconfig
-install: $(if $(DEBIAN_INSTALL),install-common-files,install-all)
+install: install-common-files
-uninstall: $(if $(DEBIAN_INSTALL),uninstall-common-files,uninstall-all)
+uninstall: uninstall-common-files
clean:
$(SUM) " CLEAN ."
diff --git a/eeprom.c b/eeprom.c
index 741413d..786dc0c 100644
--- a/eeprom.c
+++ b/eeprom.c
@@ -9,6 +9,7 @@
#include <ftw.h>
#include <stddef.h>
#include <stdlib.h>
+#include <libgen.h>
#include <string.h>
#include "eeprom.h"
@@ -19,7 +20,7 @@ static const char *eeprom_path = NULL;
static int is_eeprom(const char *fpath, const struct stat *sb,
int typeflag, struct FTW *ftwbuf)
{
- if (typeflag == FTW_F && !strcmp(basename(fpath), "eeprom") \
+ if (typeflag == FTW_F && !strcmp(basename((char*)fpath), "eeprom") \
&& sb->st_size == FAB_SIZE_FRU_EEPROM) {
eeprom_path = strdup(fpath);
return 1;
diff --git a/fru.c b/fru.c
index 3a8c908..6279740 100644
--- a/fru.c
+++ b/fru.c
@@ -232,7 +232,7 @@ int ascii2six(unsigned char **dest, unsigned char *src, size_t size)
}
#ifndef __MINGW32__
#if __BYTE_ORDER == __BIG_ENDIAN
- k = __bswap_32(k);
+ //k = __bswap_32(k);
#endif
#endif
memcpy(p, &k, 3);
@@ -778,7 +778,7 @@ unsigned char * build_FRU_blob (struct FRU_DATA *fru, size_t *length, bool packe
/* Store OUI */
#ifndef __MINGW32__
# if __BYTE_ORDER == __BIG_ENDIAN
- oui = __bswap_32(oui);
+ //oui = __bswap_32(oui);
#endif
#endif
memcpy(&buf[i+5], &oui, 3);
diff --git a/plugins/scpi.c b/plugins/scpi.c
index e0a438c..d56a974 100644
--- a/plugins/scpi.c
+++ b/plugins/scpi.c
@@ -30,12 +30,9 @@
#include <arpa/inet.h>
#include <dirent.h>
-#include <error.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
-#include <linux/errno.h>
-#include <linux/types.h>
#include <math.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -136,6 +133,20 @@ static char *supported_counters[] = {
#define print_output_scpi(x) {do { } while (0);}
#endif
+/* Don't have this on W32, here's a naive implementation
+ * Was somehow removed on OS X ... */
+void *
+memrchr (const void *s, int c, size_t n)
+{
+ size_t i;
+ unsigned char *ucs = (unsigned char *) s;
+
+ for (i = n - 1; i >= 0; i--)
+ if (ucs[i] == c)
+ return (void *) &ucs[i];
+ return NULL;
+}
+
/*
* Network communications functions
*/