~ubuntu-branches/ubuntu/trusty/erlang/trusty

« back to all changes in this revision

Viewing changes to lib/wx/src/wxe_util.erl

  • Committer: Bazaar Package Importer
  • Author(s): Clint Byrum
  • Date: 2011-05-05 15:48:43 UTC
  • mfrom: (3.5.13 sid)
  • Revision ID: james.westby@ubuntu.com-20110505154843-0om6ekzg6m7ugj27
Tags: 1:14.b.2-dfsg-3ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Drop libwxgtk2.8-dev build dependency. Wx isn't in main, and not
    supposed to.
  - Drop erlang-wx binary.
  - Drop erlang-wx dependency from -megaco, -common-test, and -reltool, they
    do not really need wx. Also drop it from -debugger; the GUI needs wx,
    but it apparently has CLI bits as well, and is also needed by -megaco,
    so let's keep the package for now.
  - debian/patches/series: Do what I meant, and enable build-options.patch
    instead.
* Additional changes:
  - Drop erlang-wx from -et
* Dropped Changes:
  - patches/pcre-crash.patch: CVE-2008-2371: outer level option with
    alternatives caused crash. (Applied Upstream)
  - fix for ssl certificate verification in newSSL: 
    ssl_cacertfile_fix.patch (Applied Upstream)
  - debian/patches/series: Enable native.patch again, to get stripped beam
    files and reduce the package size again. (build-options is what
    actually accomplished this)
  - Remove build-options.patch on advice from upstream and because it caused
    odd build failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%% 
4
 
%% Copyright Ericsson AB 2008-2009. All Rights Reserved.
 
4
%% Copyright Ericsson AB 2008-2010. All Rights Reserved.
5
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
32
32
         get_const/1,colour_bin/1,datetime_bin/1,
33
33
         to_bool/1,from_bool/1]).
34
34
 
 
35
-export([wxgl_dl/0, priv_dir/1]).
 
36
 
35
37
-include("wxe.hrl").
36
38
 
37
 
 
38
39
to_bool(0) -> false;
39
40
to_bool(_) -> true.
40
41
 
199
200
            erlang:error({Error, MF})    
200
201
    after 0 -> ok
201
202
    end.
 
203
 
 
204
%% Get gl dynamic library
 
205
 
 
206
wxgl_dl() ->
 
207
    DynLib0 = "erl_gl",
 
208
    PrivDir = priv_dir(DynLib0),
 
209
    DynLib = case os:type() of
 
210
                 {win32,_} ->
 
211
                     DynLib0 ++ ".dll";
 
212
                 _ ->
 
213
                     DynLib0 ++ ".so"
 
214
             end,
 
215
    filename:join(PrivDir, DynLib).
 
216
 
 
217
priv_dir(Driver0) ->
 
218
    {file, Path} = code:is_loaded(?MODULE),
 
219
    Priv = case filelib:is_regular(Path) of
 
220
               true ->
 
221
                   Beam = filename:join(["ebin/",atom_to_list(?MODULE) ++ ".beam"]),
 
222
                   filename:join(strip(Path, Beam), "priv");
 
223
               false ->
 
224
                   code:priv_dir(wx)
 
225
           end,
 
226
    Driver = case os:type() of
 
227
                 {win32,_} ->
 
228
                     Driver0 ++ ".dll";
 
229
                 _ ->
 
230
                     Driver0 ++ ".so"
 
231
             end,
 
232
 
 
233
    case file:read_file_info(filename:join(Priv, Driver)) of
 
234
        {ok, _} ->
 
235
            Priv;
 
236
        {error, _} ->
 
237
            error_logger:format("ERROR: Could not find \'~s\' in: ~s~n",
 
238
                                [Driver, Priv]),
 
239
            erlang:error({load_driver, "No driver found"})
 
240
    end.
 
241
 
 
242
strip(Src, Src) ->
 
243
    [];
 
244
strip([H|R], Src) ->
 
245
    [H| strip(R, Src)].
 
246