update-sqlite-map-file.sh revision 20131
16309N/A#!/bin/bash
16309N/A# usage:
16309N/A# update-sqlite-map-file new-version new-sqlite-lib old-sqlite-lib old-map-file
16309N/A
16309N/AUsage()
20779N/A{
16309N/A echo "Usage: $0 new-version new-sqlite-lib old-sqlite-lib old-map-file [new-map-file]"
16309N/A echo "If new-map-file is missing, default is new-map-file"
16309N/A}
17185N/A
16309N/Aif [ $# -ne 4 -a $# -ne 5 ]
16309N/Athen
16309N/A Usage
16309N/A exit 1
16309N/Afi
16309N/A
16309N/ANEW_VERSION=$1
16309N/ANEW_SQLITE_LIB=$2
16309N/ANEW_GLOBAL_SYMBOL_FILE="/tmp/new-sqlite-lib-global-symobl.$$"
16309N/A
16309N/AOLD_SQLITE_LIB=$3
16309N/AOLD_MAP_FILE=$4
16309N/AOLD_GLOBAL_SYMBOL_FILE="/tmp/old-sqlite-lib-global-symobl.$$"
16309N/AOLD_VERSION=""
18688N/A
18688N/Aif [ $# -eq 5 ]
16309N/Athen
16309N/A NEW_MAP_FILE=$5
19112N/Aelse
16309N/A NEW_MAP_FILE="new-map-file"
16309N/Afi
16309N/A
16309N/A# get parent interface
16309N/APARENT_INTERFACE=`grep "^sqlite_" $OLD_MAP_FILE | sed -n -s '1p' | cut -d ' ' -f 1`
16309N/A
20857N/Anm $NEW_SQLITE_LIB | grep GLOB | grep FUNC | grep -v 'UNDEF' | cut -d '|' -f 8 | uniq |sort > $NEW_GLOBAL_SYMBOL_FILE
20857N/A
20779N/Anm $OLD_SQLITE_LIB | grep GLOB | grep FUNC | grep -v 'UNDEF' | cut -d '|' -f 8 | uniq |sort > $OLD_GLOBAL_SYMBOL_FILE
16309N/A
16309N/Anew_global_symbols=`diff -u $OLD_GLOBAL_SYMBOL_FILE $NEW_GLOBAL_SYMBOL_FILE | grep '^+[a-zA-Z][a-zA-Z]*' | sed -e 's,^+,,'`
16309N/A
16309N/A# output License HEAD
16309N/Acat >$NEW_MAP_FILE <<END_OF_LICENSE
20857N/A#
18850N/A# CDDL HEADER START
16309N/A#
20340N/A# The contents of this file are subject to the terms of the
20239N/A# Common Development and Distribution License (the "License").
20239N/A# You may not use this file except in compliance with the License.
18850N/A#
18850N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
16309N/A# or http://www.opensolaris.org/os/licensing.
20826N/A# See the License for the specific language governing permissions
16309N/A# and limitations under the License.
16309N/A#
16309N/A# When distributing Covered Code, include this CDDL HEADER in each
16309N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16309N/A# If applicable, add the following below this CDDL HEADER, with the
16309N/A# fields enclosed by brackets "[]" replaced with your own identifying
16309N/A# information: Portions Copyright [yyyy] [name of copyright owner]
16309N/A#
16309N/A# CDDL HEADER END
16309N/A#
16309N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
16309N/A# Use is subject to license terms.
16309N/A#
20857N/A# ident "@(#)mapfile-libsqlite3 1.4 09/06/05 SMI"
16309N/A#
16309N/A# Defines the public interface to SQLite3
16309N/A#
16309N/AEND_OF_LICENSE
16309N/A
20857N/A# output new interface
18850N/Acat >>$NEW_MAP_FILE <<INTERFACE_END
16309N/Asqlite_$NEW_VERSION {
16584N/A global:
16584N/AINTERFACE_END
16584N/A
16584N/A# output new global symbols
16309N/Afor global_symbol in `echo $new_global_symbols`
17468N/Ado
18688N/A echo " $global_symbol;"
18688N/Adone >> $NEW_MAP_FILE
17462N/A
17462N/Aecho "} $PARENT_INTERFACE;\n" >> $NEW_MAP_FILE
17462N/A
20857N/A# output the old interfaces
20239N/A# ^sqlite_ : catch the first section
20239N/A# $ : match the last line in the file
20239N/A# p : print the line in the range
17462N/Acat $OLD_MAP_FILE | sed -n -s '/^sqlite_/,$p' >> $NEW_MAP_FILE
17462N/A
17462N/Arm -f $NEW_GLOBAL_SYMBOL_FILE $OLD_GLOBAL_SYMBOL_FILE_
20243N/Aexit 0
20239N/A