Skip to content
This repository has been archived by the owner on Apr 12, 2019. It is now read-only.

Commit

Permalink
trim libgdal.a from 90 MB to 42 debug/8.6 MB release
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed May 17, 2014
1 parent dbcd877 commit c572d73
Show file tree
Hide file tree
Showing 2 changed files with 99 additions and 5 deletions.
90 changes: 90 additions & 0 deletions osx/patches/gdal_minimal.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
diff --git a/gdal/GDALmake.opt.in b/gdal/GDALmake.opt.in
index 7140214..3343ef8 100644
--- a/gdal/GDALmake.opt.in
+++ b/gdal/GDALmake.opt.in
@@ -475,14 +475,7 @@ FREEXL_INCLUDE = @FREEXL_INCLUDE@
# and their uppercase form should be the format portion of the
# format registration entry point. eg. gdb -> GDALRegister_GDB().
#
-GDAL_FORMATS = gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm \
- sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b \
- nitf bmp pcidsk airsar rs2 ilwis rmf leveller sgi srtmhgt \
- idrisi gsg ingr ers jaxapalsar dimap gff cosar pds adrg \
- coasp tsx terragen blx msgn til r northwood saga xyz hf2 \
- kmlsuperoverlay ctg e00grid zmap ngsgeoid iris map\
- @OPT_GDAL_FORMATS@
-
+GDAL_FORMATS = vrt gtiff hfa mem raw @OPT_GDAL_FORMATS@

ifneq ($(LIBZ_SETTING),no)
GDAL_FORMATS := $(GDAL_FORMATS) rik ozi pdf
diff --git a/gdal/ogr/ogrsf_frmts/GNUmakefile b/gdal/ogr/ogrsf_frmts/GNUmakefile
index c98498f..cda3b0d 100644
--- a/gdal/ogr/ogrsf_frmts/GNUmakefile
+++ b/gdal/ogr/ogrsf_frmts/GNUmakefile
@@ -2,11 +2,8 @@
include ../../GDALmake.opt

SUBDIRS-yes := \
- generic avc bna csv dgn geojson gml gmt mem kml \
- mitab ntf gpx rec s57 sdts shape tiger vrt \
- geoconcept xplane georss gtm dxf pgdump gpsbabel \
- sua openair pds htf aeronavfaa edigeo svg idrisi \
- arcgen segukooa segy sxf openfilegdb wasp selafin
+ generic geojson mem kml \
+ gpx shape vrt openfilegdb mitab

SUBDIRS-$(HAVE_DODS) += dods
SUBDIRS-$(HAVE_DWGDIRECT) += dxfdwg
diff --git a/gdal/ogr/ogrsf_frmts/generic/GNUmakefile b/gdal/ogr/ogrsf_frmts/generic/GNUmakefile
index bf72dd2..37d44e5 100644
--- a/gdal/ogr/ogrsf_frmts/generic/GNUmakefile
+++ b/gdal/ogr/ogrsf_frmts/generic/GNUmakefile
@@ -9,46 +9,14 @@ OBJ = ogrsfdriverregistrar.o ogrlayer.o ogrdatasource.o \
ogrmutexedlayer.o ogrmutexeddatasource.o

BASEFORMATS = \
- -DAVCBIN_ENABLED \
- -DBNA_ENABLED \
- -DCSV_ENABLED \
- -DDGN_ENABLED \
- -DGML_ENABLED \
- -DGMT_ENABLED \
-DGPX_ENABLED \
-DMEM_ENABLED \
- -DNTF_ENABLED \
- -DREC_ENABLED \
- -DS57_ENABLED \
- -DSDTS_ENABLED \
-DSHAPE_ENABLED \
- -DTAB_ENABLED \
- -DTIGER_ENABLED \
-DVRT_ENABLED \
-DKML_ENABLED \
-DGEOJSON_ENABLED \
- -DGEOCONCEPT_ENABLED \
- -DXPLANE_ENABLED \
- -DGEORSS_ENABLED \
- -DGTM_ENABLED \
- -DDXF_ENABLED \
- -DPGDUMP_ENABLED \
- -DGPSBABEL_ENABLED \
- -DSUA_ENABLED \
- -DOPENAIR_ENABLED \
- -DPDS_ENABLED \
- -DHTF_ENABLED \
- -DAERONAVFAA_ENABLED \
- -DEDIGEO_ENABLED \
- -DSVG_ENABLED \
- -DIDRISI_ENABLED \
- -DARCGEN_ENABLED \
- -DSEGUKOOA_ENABLED \
- -DSEGY_ENABLED \
- -DSXF_ENABLED \
-DOPENFILEGDB_ENABLED \
- -DWASP_ENABLED \
- -DSELAFIN_ENABLED
+ -DTAB_ENABLED \

CXXFLAGS := $(CXXFLAGS) -DINST_DATA=\"$(INST_DATA)\" $(BASEFORMATS)

14 changes: 9 additions & 5 deletions osx/scripts/build_gdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ if [[ $GDAL_LATEST == true ]]; then
git diff > latest-${CUR_NOW}
git checkout .
git pull || true
if [[ -f GDAL$MAKE.opt ]]; then
$MAKE clean
$MAKE distclean
fi
fi
else
download gdal-${GDAL_VERSION}.tar.gz
Expand All @@ -32,7 +28,15 @@ else
cd gdal-${GDAL_VERSION}
fi

if [[ $GDAL_LATEST == true ]]; then
if [[ -f GDALmake.opt ]]; then
$MAKE clean
$MAKE distclean
fi
git apply ${PATCHES}/gdal_minimal.diff
fi
# purge previous install
rm -f configure.orig configure.rej
rm -f ${BUILD}/include/cpl_*
rm -f ${BUILD}/include/gdal*
rm -f ${BUILD}/lib/libgdal*
Expand Down Expand Up @@ -103,9 +107,9 @@ if [[ $BUILD_WITH_SPATIALITE != "no" ]] || [[ $BUILD_WITH_GEOS != "no" ]]; then
fi
fi


LIBS=$CUSTOM_LIBS ./configure ${HOST_ARG} \
--prefix=${BUILD} \
--with-threads=no \
--enable-static \
--disable-shared \
${FGDB_ARGS} \
Expand Down

0 comments on commit c572d73

Please sign in to comment.