OpalKelly 5.3.6 → 6.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -16,13 +16,24 @@ if sdk_lib_dir
16
16
  end
17
17
 
18
18
  case RbConfig::CONFIG['arch']
19
- when 'x64-mingw32'
20
- include_dirs << "#{sdk_dir}/include"
21
- lib_dirs << "#{sdk_dir}/lib/x64"
19
+ when /mingw|mswin/
20
+ # The API directory of the FrontPanel 6 developer kit is flat: the header
21
+ # and the import library sit next to each other in it, exactly as under
22
+ # Unix. Look there first, as this is what okFP_SDK is documented to point
23
+ # at.
24
+ include_dirs << "#{sdk_dir}"
25
+ lib_dirs << "#{sdk_dir}"
26
+
27
+ # FrontPanel 5 installed the SDK with include/ and lib/<Platform>/
28
+ # subdirectories instead, so keep searching those too for anyone still
29
+ # building against such a tree, or against one laid out like it.
30
+ # RubyInstaller reports "x64" here for 64 bit builds and "i386" for 32 bit
31
+ # ones, but match on the width rather than on a list of names, so that any
32
+ # other spelling of a 64 bit target still picks the right subdirectory.
33
+ win_lib_subdir = RbConfig::CONFIG['target_cpu'] =~ /64/ ? 'x64' : 'Win32'
22
34
 
23
- when 'i386-mingw32'
24
35
  include_dirs << "#{sdk_dir}/include"
25
- lib_dirs << "#{sdk_dir}/lib/Win32"
36
+ lib_dirs << "#{sdk_dir}/lib/#{win_lib_subdir}"
26
37
 
27
38
  else
28
39
  # Assume Unix-like system, where subdirectories are not used.
@@ -30,14 +41,40 @@ case RbConfig::CONFIG['arch']
30
41
  lib_dirs << "#{sdk_dir}"
31
42
  end
32
43
 
33
- dir_config('frontpanel', include_dirs, lib_dirs)
44
+ # Note that we report what dir_config() returns rather than the defaults
45
+ # computed above, because --with-frontpanel-include and --with-frontpanel-lib
46
+ # replace those defaults entirely: showing the okFP_SDK-derived directories to
47
+ # someone who passed the options would point them at paths that were never
48
+ # searched.
49
+ frontpanel_include, frontpanel_lib = dir_config('frontpanel', include_dirs, lib_dirs)
50
+
51
+ # When the SDK is not found, the useful thing to know is where we looked, which
52
+ # is otherwise buried in mkmf.log.
53
+ message "looking for the FrontPanel SDK in:\n"
54
+ message " headers: %s\n" % Array(frontpanel_include).join(', ')
55
+ message " libraries: %s\n" % Array(frontpanel_lib).join(', ')
56
+
57
+ # Note that this is deliberately written as a plain string rather than a
58
+ # squeezed heredoc, which is only available since Ruby 2.3, while this file
59
+ # still supports Ruby 2.0.
60
+ sdk_hint =
61
+ "The SDK is looked for in these places, in order of precedence:\n" \
62
+ "\n" \
63
+ " 1. the --with-frontpanel-include=<dir> and --with-frontpanel-lib=<dir>\n" \
64
+ " options, passed after -- on the gem install command line\n" \
65
+ " 2. the okFP_SDK_INCLUDE and okFP_SDK_LIBS environment variables\n" \
66
+ " 3. the okFP_SDK environment variable, naming the API directory of the\n" \
67
+ " FrontPanel developer kit\n" \
68
+ "\n" \
69
+ "For the FrontPanel 6 developer kit the headers and the library are both in\n" \
70
+ "that one API directory.\n"
34
71
 
35
72
  unless have_header('okFrontPanel.h')
36
- abort 'Required header "okFrontPanel.h" not found, use --with-frontpanel-include=<dir> to specify its location.'
73
+ abort %(Required header "okFrontPanel.h" not found in any of the directories listed above.\n\n#{sdk_hint})
37
74
  end
38
75
 
39
76
  unless have_library('okFrontPanel', 'okFrontPanel_CheckAPIVersion', 'okFrontPanel.h')
40
- abort 'Required okFrontPanel library not found, use --with-frontpanel-lib=<dir> to specify its location.'
77
+ abort %(Required okFrontPanel library not found in any of the directories listed above.\n\n#{sdk_hint})
41
78
  end
42
79
 
43
80
  # Ensure we can use C++11 features. This is not needed with most compilers but
@@ -53,4 +90,38 @@ end
53
90
  $CPPFLAGS << ' -std=c++11'
54
91
  $CPPFLAGS << ' -Wno-deprecated-declarations'
55
92
 
93
+ # Record /usr/local/lib in the extension's own runtime library search path.
94
+ #
95
+ # The documented way to make the SDK library loadable is to copy it into a
96
+ # directory searched by default, i.e. /usr/local/lib. That does not work on its
97
+ # own: libokFrontPanel's install name under macOS is @rpath-relative, and an
98
+ # extension with no LC_RPATH entries at all expands @rpath to nothing, so no
99
+ # directory is searched and the copy is never found. /usr/local/lib is not part
100
+ # of the default dyld search path either. Under Linux the same copy is only
101
+ # found once ldconfig has been run to refresh its cache.
102
+ #
103
+ # One rpath entry fixes both: it is searched directly, before the loader cache,
104
+ # and a non-existent directory in this list is simply skipped.
105
+ #
106
+ # Windows has no equivalent, and the DLL is located there via RUBY_DLL_PATH.
107
+ unless RbConfig::CONFIG['host_os'] =~ /mingw|mswin|cygwin/
108
+ $DLDFLAGS << ' -Wl,-rpath,/usr/local/lib'
109
+
110
+ # Ask for DT_RUNPATH rather than DT_RPATH. Debian and Ubuntu patch their
111
+ # binutils to do this by default, but Red Hat and its derivatives do not, at
112
+ # any version, so this is a distribution family difference rather than an old
113
+ # toolchain that will age out.
114
+ #
115
+ # It matters because DT_RPATH takes precedence over LD_LIBRARY_PATH while
116
+ # DT_RUNPATH yields to it. Without this, the directory recorded above would
117
+ # silently win over a library the user had deliberately pointed at, which is
118
+ # the opposite of what someone setting LD_LIBRARY_PATH is asking for.
119
+ #
120
+ # Only under Linux: this option is specific to the GNU linker and Apple's
121
+ # linker rejects it outright.
122
+ if RbConfig::CONFIG['host_os'] =~ /linux/
123
+ $DLDFLAGS << ' -Wl,--enable-new-dtags'
124
+ end
125
+ end
126
+
56
127
  create_makefile('OpalKelly')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: OpalKelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.6
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Opal Kelly Incorporated
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-20 00:00:00.000000000 Z
11
+ date: 2026-08-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Provides access to FrontPanel devices.
14
14
  email: tech+rubygems@opalkelly.com