Skip to content

Commit

Permalink
WIP: get rid of GAPTypes.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jan 23, 2020
1 parent 84f12d7 commit ca9b26b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 25 deletions.
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
name = "GAP"
uuid = "c863536a-3901-11e9-33e7-d5cd0df7b904"
authors = ["Thomas Breuer <[email protected]>", "Sebastian Gutsche <[email protected]>", "Max Horn <[email protected]>"]
version = "0.2.3"
version = "0.2.4"

[deps]
GAPTypes = "cd4130c4-8d21-11e9-2a29-61e008680c2d"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"

[compat]
GAPTypes = "1"
julia = "1.1"

[extras]
Expand Down
17 changes: 3 additions & 14 deletions deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,15 @@ julia_binary = get(ENV, "JULIA_BINARY", Sys.BINDIR)
## Install GAP
if install_gap
println("Installing GAP ...")
gap_branch = "stable-4.11"
gap_branch = "mh/julia-no-GAPTypes"
cd(extra_gap_root)
run(`rm -rf gap`)
run(`git clone --depth=1 -b $(gap_branch) https://github.com/gap-system/gap`)
run(`git clone --depth=1 -b $(gap_branch) https://github.com/fingolfin/gap`)
cd("gap")
run(`./autogen.sh`)
run(`./configure --with-gc=julia --with-julia=$(julia_binary)`)
run(`make -j$(Sys.CPU_THREADS)`)
## FIXME: Hack to make GAPTypes available in the global package environment:
## For a moment, we set the Julia load path to the actual depot, i.e.,
## the env GAP.jl is installed to, to install GAPTypes.jl globally.
## Since the package manager usually sets the load paths,
## JULIA_LOAD_PATH should always be set when this script is
## executed. However, just setting this environment variable
## just for the configure currently does not work.
julia_load_path_save = ENV["JULIA_LOAD_PATH"]
pop!( ENV, "JULIA_LOAD_PATH" )
julia_executable = joinpath(julia_binary, "julia")
run(`$(julia_executable) -e 'import Pkg; Pkg.add("GAPTypes")'`)
ENV["JULIA_LOAD_PATH"] = julia_load_path_save

gap_install_packages = get(ENV, "GAP_INSTALL_PACKAGES", "yes")
if gap_install_packages == "yes"
run(`make bootstrap-pkg-full`)
Expand Down
2 changes: 1 addition & 1 deletion etc/travis_install_gap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

# Download and install GAP
git clone --depth=1 -b stable-4.11 https://github.com/gap-system/gap
git clone --depth=1 -b mh/julia-no-GAPTypes https://github.com/fingolfin/gap
cd gap
./autogen.sh
./configure --with-gc=julia --with-julia
Expand Down
22 changes: 15 additions & 7 deletions src/GAP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ import Base: length, convert, finalize

import Libdl

import GAPTypes
import GAPTypes: GapObj

# TODO: this module exists only for backwards compatibility; remove it as soon as GAP upstream is updated to not need it.
module GAPTypes
# abstract type from which ForeignGAP.MPtr is derived from.
abstract type GapObj end
end
GapObj = GAPTypes.GapObj
export GapObj

const Obj = Union{GapObj,FFE,Int64,Bool,Nothing}
Expand Down Expand Up @@ -79,11 +82,14 @@ function initialize( argv::Array{String,1}, env::Array{String,1}, error_handler_
end

function finalize( )
ccall( (:GAP_finalize, "libgap")
, Cvoid
, () )
ccall( (:GAP_finalize, "libgap"), Cvoid, () )
end

function register_GapObj()
ccall( :GAP_register_GapObj, Cvoid, () )
end


gap_is_initialized = false

run_it = function(gapdir::String, error_handler_func::Ptr{Nothing})
Expand Down Expand Up @@ -112,7 +118,9 @@ function __init__()
## the module is loaded.
gap_module = @__MODULE__
Base.MainInclude.eval(:(__JULIAGAPMODULE = $gap_module))
if ! isdefined(Main, :__GAPINTERNAL_LOADED_FROM_GAP) || Main.__GAPINTERNAL_LOADED_FROM_GAP != true
if isdefined(Main, :__GAPINTERNAL_LOADED_FROM_GAP) && Main.__GAPINTERNAL_LOADED_FROM_GAP
register_GapObj()
else
run_it(GAPROOT, error_handler_func)
end

Expand Down

0 comments on commit ca9b26b

Please sign in to comment.