Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
c0014555
Commit
c0014555
authored
10 years ago
by
Adam C. Foltzer
Browse files
Options
Downloads
Patches
Plain Diff
Avoid broken `strip` versions on 32-bit Linux
Fixes #2339
parent
2791fb66
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Cabal/Distribution/Simple/Program/Builtin.hs
+18
-1
18 additions, 1 deletion
Cabal/Distribution/Simple/Program/Builtin.hs
Cabal/Distribution/Simple/Program/Strip.hs
+17
-3
17 additions, 3 deletions
Cabal/Distribution/Simple/Program/Strip.hs
with
35 additions
and
4 deletions
Cabal/Distribution/Simple/Program/Builtin.hs
+
18
−
1
View file @
c0014555
...
...
@@ -264,7 +264,24 @@ arProgram :: Program
arProgram
=
simpleProgram
"ar"
stripProgram
::
Program
stripProgram
=
simpleProgram
"strip"
stripProgram
=
(
simpleProgram
"strip"
)
{
programFindVersion
=
findProgramVersion
"--version"
$
\
str
->
-- Invoking "strip --version" gives very inconsistent
-- results. We look for the first word that starts with a
-- number, and try parsing out the first two components of
-- it. Non-GNU 'strip' doesn't appear to have a version flag.
let
numeric
""
=
False
numeric
(
x
:
_
)
=
isDigit
x
in
case
dropWhile
(
not
.
numeric
)
(
words
str
)
of
(
ver
:
_
)
->
-- take the first two version components
let
isDot
=
(
==
'.'
)
(
major
,
rest
)
=
break
isDot
ver
minor
=
takeWhile
(
not
.
isDot
)
(
dropWhile
isDot
rest
)
in
major
++
"."
++
minor
_
->
""
}
hsc2hsProgram
::
Program
hsc2hsProgram
=
(
simpleProgram
"hsc2hs"
)
{
...
...
This diff is collapsed.
Click to expand it.
Cabal/Distribution/Simple/Program/Strip.hs
+
17
−
3
View file @
c0014555
...
...
@@ -11,10 +11,13 @@ module Distribution.Simple.Program.Strip (stripLib, stripExe)
where
import
Distribution.Simple.Program
(
ProgramConfiguration
,
lookupProgram
,
rawSystemProgram
,
stripProgram
)
,
programVersion
,
rawSystemProgram
,
stripProgram
)
import
Distribution.Simple.Utils
(
warn
)
import
Distribution.System
(
Platform
(
..
),
OS
(
..
),
buildOS
)
import
Distribution.System
(
Arch
(
..
),
Platform
(
..
),
OS
(
..
),
buildOS
)
import
Distribution.Text
(
simpleParse
)
import
Distribution.Verbosity
(
Verbosity
)
import
Distribution.Version
(
withinRange
)
import
Control.Monad
(
unless
)
import
System.FilePath
(
takeBaseName
)
...
...
@@ -42,7 +45,7 @@ stripExe verbosity (Platform _arch os) conf path =
_
->
[]
stripLib
::
Verbosity
->
Platform
->
ProgramConfiguration
->
FilePath
->
IO
()
stripLib
verbosity
(
Platform
_
arch
os
)
conf
path
=
do
stripLib
verbosity
(
Platform
arch
os
)
conf
path
=
do
case
os
of
OSX
->
-- '--strip-unneeded' is not supported on OS X, iOS or
-- Solaris. See #1630.
...
...
@@ -53,6 +56,17 @@ stripLib verbosity (Platform _arch os) conf path = do
-- libraries with lots identically named modules. See
-- #1784.
return
()
Linux
|
arch
==
I386
->
-- Versions of 'strip' on 32-bit Linux older than 2.18 are
-- broken. See #2339.
let
(
Just
okVersion
)
=
simpleParse
">= 2.18"
in
case
programVersion
=<<
lookupProgram
stripProgram
conf
of
Just
v
|
withinRange
v
okVersion
->
runStrip
verbosity
conf
path
args
_
->
warn
verbosity
$
"Unable to strip library '"
++
(
takeBaseName
path
)
++
"' (version of 'strip' too old; "
++
"requires >= 2.18 on 32-bit Linux)"
_
->
runStrip
verbosity
conf
path
args
where
args
=
[
"--strip-unneeded"
]
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment