12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752 |
- #!/bin/bash -x
- #TODO: Add in perl? Maybe?
- #TODO: Update deb build numbers as needed
- echo $PATH
- MAINTAINER="Maintainer: Kevin Bradley <maintainer@nito.tv>"
- VERIFY="true"
- ARCH="arm64"
- PLATFORM="AppleTVOS"
- PLATFORM_LOWER="appletvos"
- MIN_VERSION="-mappletvos-version-min=9.0"
- CODESIGN_TOOL="ldid"
- CLANG_PATH="`xcrun -f clang`"
- CLANGPLUS_PATH="`xcrun -f clang++`"
- BUILD_ROOT="`pwd`"
- ROOT_PREFIX="fs/jb/usr"
- SKEL_PREFIX="$BUILD_ROOT/skel"
- PKG_NAME="" #The name of our current package being built
- PKG_VERSION="-1"
- WORKING_DIR="" #This stores the working directory under BUILD_ROOT
- BUILD_BASH="false"
- NITOTV="false"
- CLEAN_SKEL="false"
- MOVE_DPKG="true"
- set -e
- # set trap to help debug any build errors
- trap "echo '** ERROR with build:'; pwd; say 'ohnoes failed'" INT TERM EXIT
- usage() {
- echo "usage: $0 [-c|--codesign-tool] [-b|--build-bash] [-i|--insecure] [-p|--platform] [-s|--sdk-path]"
- trap - INT TERM EXIT
- exit 0
- }
- while test $# -gt 0; do
- case "$1" in
- -h|--help)
- usage
- ;;
- -n|--nito-tv)
- NITOTV="true"
- shift
- ;;
- -c|--codesign-tool)
- shift
- if test $# -gt 0; then
- CODESIGN_TOOL="$1"
- if [[ ! "$CODESIGN_TOOL" == "ldid" ]] && [[ ! "$CODESIGN_TOOL" == "ldid2" ]] && [[ ! "$CODESIGN_TOOL" == "jtool" ]]; then
- echo "Error: Invalid codesigning tool"
- trap - INT TERM EXIT
- exit 1
- fi
- else
- echo "Error: No codesigning tool given."
- echo " Try: ldid, jtool or ldid2"
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- -b|--build-bash)
- BUILD_BASH="true"
- shift
- ;;
- -i|--insecure|--no-verify)
- VERIFY="false"
- echo "Working without verifying packages..."
- echo "YOU BETTER KNOW WHAT YOU'RE DOING"
- sleep 2 #Give them a couple seconds to think about what they're about to do
- shift
- ;;
- -p|--platform)
- shift
- if test $# -gt 0; then
- PLATFORM="$1"
- else
- echo "No platform given."
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- -s|--sdk-path|--sdk)
- shift
- if test $# -gt 0; then
- SDK_PATH="$1"
- else
- echo "No platform given."
- trap - INT TERM EXIT
- exit 1
- fi
- shift
- ;;
- *)
- break
- ;;
- esac
- done
- #Check for required programs
- #command -v cmake >/dev/null 2>&1 || { echo >&2 "Missing cmake.\nRun: brew install cmake" ; }
- #command -v gtar >/dev/null 2>&1 || { echo >&2 "Missing gnutar.\nRun: brew install gnu-tar" ; }
- #command -v dpkg >/dev/null 2>&1 || { echo >&2 "Missing dpkg.\nRun: brew install dpkg" ; }
- #jtool
- #command -v jtool >/dev/null 2>&1 || { }
- #brew
- #autoconf
- #docbook-xsl
- #One of the two is required
- #command -v md5sum >/dev/null 2>&1 || { command -v md5 >/dev/null 2>&1 || { echo >&2 "Missing md5sum" ; } ; }
- if [[ "$VERIFY" == "true" ]]; then
- command -v gpg >/dev/null 2>&1 || { echo >&2 "Missing GPG. Cannot verify. Dying."; exit 127 ; }
- echo "Importing necessary PGP keys"
- gpg --recv-key 69184620 7C0135FB088AAF6C66C650B9BB5869F064EA74AB 702353E0F7E48EDB 7FD9FCCB000BEEEE A15B725964A95EE5 D8692123C4065DEA5E0F3AB5249B39D24F25E3B6 031EC2536E580D8EA286A9F22071B08A33BD3F06 9D5EAAF69013B842
- fi
- #Eventually we'll make -j8 this work for any platform
- #For now, this is just scaffolding for the future
- #When the time comes, there are several other places which have hardcoded appletvos in them
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- #Defaults are good
- echo ""
- elif [[ "$PLATFORM" == "WatchOS" ]]; then
- #Untested
- PLATFORM_LOWER="watchos"
- MIN_VERSION="-mwatchos-version-min=3.0"
- ARCH="armv7k"
- else
- echo "Unsupported Platform."
- trap - INT TERM EXIT
- exit 127
- fi
- echo "after platform check..."
- if [[ -z "$SDK_PATH" ]]; then
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- echo "APPLETV YO"
- SDK_PATH="`xcrun --sdk appletvos --show-sdk-path`"
- echo $SDK_PATH
- SDK_VERSION="`xcrun --show-sdk-version --sdk appletvos`"
- SDK_VERSION=16.4
- echo $SDK_VERSION
- IOKIT_MATCH="`find ~/Library/Developer/Xcode/tvOS\ DeviceSupport/ -name IOKit.framework | grep "$SDK_VERSION" -m 1`"
- echo "IOKit match: $IOKIT_MATCH"
- elif [[ "$PLATFORM" == "WatchOS" ]]; then
- SDK_PATH="`xcrun --sdk watchos --show-sdk-path`"
- SDK_VERSION="`xcrun --show-sdk-version --sdk watchos`"
- fi
- elif [[ ${SDK_PATH: -1} == "/" ]]; then
- # Some of our sed's require SDK_PATH *not* end with /
- SDK_PATH="`echo $SDK_PATH | sed 's/\/$//g'`"
- fi
- echo "after SDK path check..."
- #================
- #Helper Functions
- #----------------
- initDebStructure() {
- sudo rm -rf deb
- mkdir -p deb/DEBIAN
- sudo rm -rf deb-doc
- mkdir -p deb-doc/DEBIAN
- sudo rm -rf deb-dev
- mkdir -p deb-dev/DEBIAN
- }
- prepSDK() {
- #Availability.h patches
- #grep -R "#define __TVOS_UNAVAILABLE " "$SDK_PATH/usr/include/Availability.h"
- #grep -R "#define __TVOS_PROHIBITED " "$SDK_PATH/usr/include/Availability.h"
- #sudo sed -i -- "s|#define __TVOS_UNAVAILABLE __OS_AVAILABILITY(tvos,unavailable)|#define __TVOS_UNAVAILABLE_NOTQUITE __OS_AVAILABILITY(tvos,unavailable)|" /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/Availability.h
- #sudo sed -i -- "s|#define __TVOS_PROHIBITED __OS_AVAILABILITY(tvos,unavailable)|#define __TVOS_PROHIBITED_NOTQUITE __OS_AVAILABILITY(tvos,unavailable)|" /Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/Availability.h
- #Fix for ncurses
- if [[ ! -e "$SDK_PATH/usr/include/sys/ttydev.h" ]]; then
- echo "Missing <sys/ttydev.h>. Moving it in from MacOSX SDK (with sudo)"
- sudo cp "`xcrun --sdk macosx --show-sdk-path`/usr/include/sys/ttydev.h" "$SDK_PATH/usr/include/sys/ttydev.h"
- fi
- if [[ ! -e "$SDK_PATH/usr/include/lockdown.h" ]]; then
- echo "Missing lockdown.h! Generating the bare essentials for apt to build..."
- echo "#ifndef LOCKDOWN_LOCKDOWN_H" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#define LOCKDOWN_LOCKDOWN_H" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#include <CoreFoundation/CFString.h>" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#ifdef __cplusplus" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "extern \"C\" {" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#endif" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "extern CFStringRef kLockdownUniqueDeviceIDKey;" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "extern void *lockdown_connect(void);" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "extern CFStringRef lockdown_copy_value(void *lockdown, void *null, CFStringRef key);" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "extern void lockdown_disconnect(void *lockdown);" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#ifdef __cplusplus" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "}" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#endif" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "" >> "$SDK_PATH/usr/include/lockdown.h"
- echo "#endif/*LOCKDOWN_LOCKDOWN_H*/" >> "$SDK_PATH/usr/include/lockdown.h"
- fi
- echo "IOKit: $SDK_PATH/System/Library/Frameworks/IOKit.framework"
- if [[ ! -d "$SDK_PATH/System/Library/Frameworks/IOKit.framework" ]]; then
- if [[ ! -z "$IOKIT_MATCH" ]]; then
- echo "we do indeed have an IOKit match and IOKIt is missing!!"
- echo "cp -r $IOKIT_MATCH $SDK_PATH/System/Library/Frameworks/"
- cp -r "$IOKIT_MATCH" "$SDK_PATH/System/Library/Frameworks/"
- fi
- fi
- #I forget.. Readline perhaps?
- #IOKit
- #~/Library/Developer/Xcode/tvOS\ DeviceSupport
- #9.0 (13T396)
- #9.0.1 (13T402)
- #10.1 (14U593)
- #10.1.1 (14U712a)
- #10.2.1 (14W585a)
- #10.2.2 (14W756)
- #11.1 (15J582)
- #/Users/kevinbradley/Library/Developer/Xcode/tvOS\ DeviceSupport/11.1\ \(15J582\)/Symbols/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
- }
- # this needs to be modified to have the proper spacing, if the spacing is absolutely perfect you can't ever use jtool to change the entitlements without building from scratch
- createEntitlements() {
- if [[ ! -e "$BUILD_ROOT/ent.plist" ]]; then
- echo "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" >> "$BUILD_ROOT/ent.plist"
- echo "<plist version=\"1.0\">" >> "$BUILD_ROOT/ent.plist"
- echo "<dict>" >> "$BUILD_ROOT/ent.plist"
- echo " <key>platform-application</key>" >> "$BUILD_ROOT/ent.plist"
- echo " <true/>" >> "$BUILD_ROOT/ent.plist"
- echo " <key>com.apple.private.skip-library-validation</key>" >> "$BUILD_ROOT/ent.plist"
- echo " <true/>" >> "$BUILD_ROOT/ent.plist"
- echo "</dict>" >> "$BUILD_ROOT/ent.plist"
- echo "</plist>" >> "$BUILD_ROOT/ent.plist"
- fi
- }
- # for some reason the files signed this way don't run on tvOS 9 anymore
- codesign() {
- #local var=$(ldid -S "$1");
- if [[ "$CODESIGN_TOOL" == "jtool" ]]; then
- createEntitlements
- jtool --sign platform --ent "$BUILD_ROOT/ent.plist" "$1"
- sudo cp -X out.bin "$1"
- elif [[ "$CODESIGN_TOOL" == "ldid" ]]; then
- cp "$1" out.bin
- sudo chmod 777 out.bin
- ldid -S"$BUILD_ROOT/ent.plist" out.bin
- sudo cp -X out.bin "$1"
- elif [[ "$CODESIGN_TOOL" == "ldid2" ]]; then
- cp "$1" out.bin
- sudo chmod 777 out.bin
- ldid2 -S"$BUILD_ROOT/ent.plist" out.bin
- sudo cp -X out.bin "$1"
- fi
- }
- notifyProgress() {
- echo "$1"
- say "$1"
- }
- createListFile() {
- INFOPATH="$SKEL_PREFIX/var/lib/dpkg/info"
- if [[ -d "$SKEL_PREFIX/private/var/lib/dpkg/info/" ]]; then
- INFOPATH="$SKEL_PREFIX/private/var/lib/dpkg/info"
- elif [[ ! -d "$SKEL_PREFIX/var/lib/dpkg/info/" ]]; then
- mkdir -p "$SKEL_PREFIX/var/lib/dpkg/info/"
- fi
- #md5 -r == md5sum
- MD5="md5sum"
- command -v md5sum >/dev/null 2>&1 || { MD5="md5 -r" ; }
- find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" -exec $MD5 {} \; | awk '{ print $1 " " $2 }' | sed "s|$BUILD_ROOT/$WORKING_DIR/deb/||g" >> "$INFOPATH/$PKG_NAME.md5sums"
- find "$BUILD_ROOT/$WORKING_DIR/deb" -type f -not -path "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*" | sed "s|$BUILD_ROOT/$WORKING_DIR/deb||g" >> "$INFOPATH/$PKG_NAME.list"
- FILES="$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/*"
- for f in $FILES; do
- file=${f##*/}
- if [[ "$file" != "control" ]]; then
- echo "Processing $file in $PKG_NAME..";
- cp "$f" "$INFOPATH/$PKG_NAME.$file"
- fi
- done
- }
- #warning: this will process ANY deb file you have in your $BUILD_ROOT
- createStatusFile() {
- cd "$BUILD_ROOT"
- rm -rf status
- rm -rf available
- for f in *.deb; do
- echo "Processing $f..";
- dpkg-deb -f "$f" >> status
- dpkg-deb -f "$f" >> available
- echo "Status: install ok installed" >> status
- echo "" >> status
- echo "" >> available
- done
- if [[ -d "$SKEL_PREFIX/private/var/lib/dpkg/" ]]; then
- mv status "$SKEL_PREFIX/private/var/lib/dpkg/status"
- mv available "$SKEL_PREFIX/private/var/lib/dpkg/available"
- else
- echo "### [WARNING]: $SKEL_PREFIX/private/var/lib/dpkg/ is missing! this bootstrap is likely malformed..."
- echo ""
- mv status "$SKEL_PREFIX/var/lib/dpkg/status"
- mv available "$SKEL_PREFIX/var/lib/dpkg/available"
- fi
- }
- checkPGPSig() {
- if [[ "$VERIFY" == "true" ]]; then
- SIGFILE="$1"
- FILE="$2"
- local VERIFY_TEST="`gpg --verify $SIGFILE $FILE 2>&1 | grep 'Good signature'`"
- if [[ "$VERIFY_TEST" == "" ]]; then
- echo "Failed to validate PGP signature for $FILE"
- trap - INT TERM EXIT
- exit 127
- fi
- echo "*** VALID SIGNATURE"
- fi
- }
- checkSHA256() {
- if [[ "$VERIFY" == "true" ]]; then
- FILE="$1"
- VALID_SHA="$2"
- VERIFY_TEST="`shasum -a 256 $FILE | cut -c 1-64`"
- if [[ "$VERIFY_TEST" != "$VALID_SHA" ]]; then
- echo "Failed to validate SHA256 signature for $FILE"
- trap - INT TERM EXIT
- exit 127
- fi
- echo "*** VALID SIGNATURE"
- fi
- }
- fixSystem() {
- FILE="$1"
- echo '#define PROC_PIDPATHINFO_MAXSIZE (1024)' >> "$FILE"
- echo 'static int file_exist(const char *filename) {' >> "$FILE"
- echo ' struct stat buffer;' >> "$FILE"
- echo ' int r = stat(filename, &buffer);' >> "$FILE"
- echo ' return (r == 0);' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *searchpath(const char *binaryname){' >> "$FILE"
- echo ' if (strstr(binaryname, "/") != NULL){' >> "$FILE"
- echo ' if (file_exist(binaryname)){' >> "$FILE"
- echo ' char *foundpath = malloc((strlen(binaryname) + 1) * (sizeof(char)));' >> "$FILE"
- echo ' strcpy(foundpath, binaryname);' >> "$FILE"
- echo ' return foundpath;' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' return NULL;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *pathvar = getenv("PATH");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *dir = strtok(pathvar,":");' >> "$FILE"
- echo ' while (dir != NULL){' >> "$FILE"
- echo ' char searchpth[PROC_PIDPATHINFO_MAXSIZE];' >> "$FILE"
- echo ' strcpy(searchpth, dir);' >> "$FILE"
- echo ' strcat(searchpth, "/");' >> "$FILE"
- echo ' strcat(searchpth, binaryname);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (file_exist(searchpth)){' >> "$FILE"
- echo ' char *foundpath = malloc((strlen(searchpth) + 1) * (sizeof(char)));' >> "$FILE"
- echo ' strcpy(foundpath, searchpth);' >> "$FILE"
- echo ' return foundpath;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' dir = strtok(NULL, ":");' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' return NULL;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static int isShellScript(const char *path){' >> "$FILE"
- echo ' FILE *file = fopen(path, "r");' >> "$FILE"
- echo ' uint8_t header[2];' >> "$FILE"
- echo ' if (fread(header, sizeof(uint8_t), 2, file) == 2){' >> "$FILE"
- echo " if (header[0] == '#' && header[1] == '!'){" >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return 1;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return -1;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *getInterpreter(char *path){' >> "$FILE"
- echo ' FILE *file = fopen(path, "r");' >> "$FILE"
- echo ' char *interpreterLine = NULL;' >> "$FILE"
- echo ' unsigned long lineSize = 0;' >> "$FILE"
- echo ' getline(&interpreterLine, &lineSize, file);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawInterpreter = (interpreterLine+2);' >> "$FILE"
- echo ' rawInterpreter = strtok(rawInterpreter, " ");' >> "$FILE"
- echo ' rawInterpreter = strtok(rawInterpreter, "\n");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *interpreter = malloc((strlen(rawInterpreter)+1) * sizeof(char));' >> "$FILE"
- echo ' strcpy(interpreter, rawInterpreter);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(interpreterLine);' >> "$FILE"
- echo ' fclose(file);' >> "$FILE"
- echo ' return interpreter;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'static char *fixedCmd(const char *cmdStr){' >> "$FILE"
- echo ' char *cmdCpy = malloc((strlen(cmdStr)+1) * sizeof(char));' >> "$FILE"
- echo ' strcpy(cmdCpy, cmdStr);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *cmd = strtok(cmdCpy, " ");' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' uint8_t size = strlen(cmd) + 1;' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *args = cmdCpy + size;' >> "$FILE"
- echo ' if ((strlen(cmdStr) - strlen(cmd)) == 0)' >> "$FILE"
- echo ' args = NULL;' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *abs_path = searchpath(cmd);' >> "$FILE"
- echo ' if (abs_path){' >> "$FILE"
- echo ' int isScript = isShellScript(abs_path);' >> "$FILE"
- echo ' if (isScript == 1){' >> "$FILE"
- echo ' char *interpreter = getInterpreter(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' uint8_t commandSize = strlen(interpreter) + 1 + strlen(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' commandSize += 1 + strlen(args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawCommand = malloc(sizeof(char) * (commandSize + 1));' >> "$FILE"
- echo ' strcpy(rawCommand, interpreter);' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' rawCommand[(commandSize)+1] = "\0";' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(interpreter);' >> "$FILE"
- echo ' free(abs_path);' >> "$FILE"
- echo ' free(cmdCpy);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' return rawCommand;' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' uint8_t commandSize = strlen(abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' commandSize += 1 + strlen(args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' char *rawCommand = malloc(sizeof(char) * (commandSize + 1));' >> "$FILE"
- echo ' strcat(rawCommand, abs_path);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' if (args){' >> "$FILE"
- echo ' strcat(rawCommand, " ");' >> "$FILE"
- echo ' strcat(rawCommand, args);' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' rawCommand[(commandSize)+1] = "\0";' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' free(abs_path);' >> "$FILE"
- echo ' free(cmdCpy);' >> "$FILE"
- echo ' ' >> "$FILE"
- echo ' return rawCommand;' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' return cmdCpy;' >> "$FILE"
- echo '}' >> "$FILE"
- echo '' >> "$FILE"
- echo 'int RunCmd(const char *cmd) {' >> "$FILE"
- echo ' pid_t pid;' >> "$FILE"
- echo ' char *rawCmd = fixedCmd(cmd);' >> "$FILE"
- echo ' char *argv[] = {"sh", "-c", (char*)rawCmd, NULL};' >> "$FILE"
- echo ' int status;' >> "$FILE"
- echo ' status = posix_spawn(&pid, "/bin/sh", NULL, NULL, argv, environ);' >> "$FILE"
- echo ' if (status == 0) {' >> "$FILE"
- echo ' if (waitpid(pid, &status, 0) == -1) {' >> "$FILE"
- echo ' perror("waitpid");' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' } else {' >> "$FILE"
- echo ' printf("posix_spawn: %s\n", strerror(status));' >> "$FILE"
- echo ' }' >> "$FILE"
- echo ' free(rawCmd);' >> "$FILE"
- echo ' return status;' >> "$FILE"
- echo '}' >> "$FILE"
- }
- #=====================
- #OSGT10.1
- #---------------------
- #Download readline
- downloadReadline() {
- #http://gnu.askapache.com/readline/readline-7.0.tar.gz
- if [[ ! -e readline-7.0.tar.gz ]]; then
- echo "Downloading readline-7.0.tar.gz"
- curl -LO http://gnu.askapache.com/readline/readline-7.0.tar.gz
- curl -LO http://gnu.askapache.com/readline/readline-7.0.tar.gz.sig
- checkPGPSig readline-7.0.tar.gz.sig readline-7.0.tar.gz
- else
- echo "Using existing readline"
- fi
- sudo rm -rf readline-7.0
- tar xzvf readline-7.0.tar.gz
- WORKING_DIR="readline-7.0"
- PKG_NAME="readline"
- PKG_VERSION="7.0-1"
- cd "$WORKING_DIR"
- }
- downloadProduct() {
- downloadLink=$1
- filename=$(basename $downloadLink)
- version=$2
- sigDownload=$3
- extension=$(echo $filename | sed 's/^.*\.//')
- sigFile=$(basename $sigDownload)
-
- if [[ ! -e $filename ]]; then
- echo "Downloading $filename"
- curl -LO $downloadLink
- curl -LO $sigDownload
- checkPGPSig $sigFile $filename
- else
- echo "Using existing $filename"
- fi
- sudo rm -rf $filename
-
- }
- buildProduct() {
- }
- #readline
- #Notes:
- # Doesn't like to build with ncurses.a in any of its linker paths (read: rm -rf skel)
- buildReadline() {
- downloadReadline
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libhistory.7.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libreadline.7.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libhistory.7.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libreadline.7.0.dylib"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: command-line history management" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://tiswww.cwru.edu/php/chet/readline/rltop.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download ncurses
- downloadNcurses() {
- if [[ ! -e ncurses-6.0.tar.gz ]]; then
- echo "Downlading ncurses-6.0.tar.gz"
- curl -LO http://gnu.mirror.constant.com/ncurses/ncurses-6.0.tar.gz
- curl -LO http://gnu.mirror.constant.com/ncurses/ncurses-6.0.tar.gz.sig
- checkPGPSig ncurses-6.0.tar.gz.sig ncurses-6.0.tar.gz
- else
- echo "Using existing ncurses-6.0"
- fi
- sudo rm -rf ncurses-6.0
- tar xzvf ncurses-6.0.tar.gz
- WORKING_DIR="ncurses-6.0"
- PKG_NAME="ncurses"
- PKG_VERSION="6.0-1"
- cd "$WORKING_DIR"
- }
- patchNcurses() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- if [[ "$PKG_VERSION" == "6.0-1" ]]; then
- # LEFT ERROR ON environ)' no ;
- # For some reason, building never fails on the error...
- # But still, tput is in /usr/bin... so.... ??
- cat progs/tput.c | head -n 55 > tput.patched.c
- echo "#include <stdint.h>" >> tput.patched.c
- echo "#include <stdio.h>" >> tput.patched.c
- echo "#include <stdlib.h>" >> tput.patched.c
- echo "#include <spawn.h>" >> tput.patched.c
- echo "#include <sys/wait.h>" >> tput.patched.c
- echo "" >> tput.patched.c
- echo "extern char **environ;" >> tput.patched.c
- echo "" >> tput.patched.c
- cat progs/tput.c | tail -n 350 | head -n 50 >> tput.patched.c
- fixSystem "tput.patched.c"
- cat progs/tput.c | tail -n 301 | sed 's/system(init_prog)/RunCmd(init_prog)/g' >> tput.patched.c
- cp tput.patched.c progs/tput.c
- fi
- fi
- }
- #ncurses
- #Notes:
- # Needs DESTDIR in make -j8 to not attempt to build test files (which fail to link)
- # May need the make clean in between to keep out artifacts from the old DESTDIR
- buildNcurses() {
- downloadNcurses
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX/" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/clear"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/infocmp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tabs"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tic"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/toe"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tput"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tset"
- make clean
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/clear"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/infocmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tabs"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tic"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/toe"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tput"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tset"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: System" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: feature-complete terminal library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: New Curses" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnu.org/software/ncurses/ncurses.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ncurses6-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download bash
- downloadBash() {
- #http://gnu.askapache.com/bash/bash-4.4.12.tar.gz
- if [[ ! -e bash-4.4.12.tar.gz ]]; then
- echo "Downloading bash-4.4.12.tar.gz"
- curl -LO http://gnu.askapache.com/bash/bash-4.4.12.tar.gz
- curl -LO http://gnu.askapache.com/bash/bash-4.4.12.tar.gz.sig
- checkPGPSig bash-4.4.12.tar.gz.sig bash-4.4.12.tar.gz
- else
- echo "Using existing bash"
- fi
- sudo rm -rf bash-4.4.12
- tar xzvf bash-4.4.12.tar.gz
- WORKING_DIR="bash-4.4.12"
- PKG_NAME="bash"
- PKG_VERSION="4.4.12-1"
- cd "$WORKING_DIR"
- }
- patchBash() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|^#undef HAVE_SYS_SIGLIST$|#define HAVE_SYS_SIGLIST 1|' config.h.in
- fi
- }
- #bash
- #Notes:
- # Requires autoconf
- buildBash() {
- downloadBash
- patchBash
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking --disable-nls --with-installed-readline --disable-largefile bash_cv_dev_fd=absent bash_cv_sys_named_pipes=present bash_cv_job_control_missing=present bash_cv_func_sigsetjmp=present bash_cv_func_ctype_nonascii=no bash_cv_must_reinstall_sighandlers=no bash_cv_func_strcoll_broken=yes ac_cv_c_stack_direction=-1 ac_cv_func_mmap_fixed_mapped=yes gt_cv_int_divbyzero_sigfpe=no ac_cv_func_setvbuf_reversed=no ac_cv_func_strcoll_works=yes ac_cv_func_working_mktime=yes ac_cv_type_getgroups=gid_t bash_cv_dup2_broken=no ac_cv_prog_cc_g=no ac_cv_rl_version=6.0
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --disable-nls --with-installed-readline --disable-largefile bash_cv_dev_fd=absent bash_cv_sys_named_pipes=present bash_cv_job_control_missing=present bash_cv_func_sigsetjmp=present bash_cv_func_ctype_nonascii=no bash_cv_must_reinstall_sighandlers=no bash_cv_func_strcoll_broken=yes ac_cv_c_stack_direction=-1 ac_cv_func_mmap_fixed_mapped=yes gt_cv_int_divbyzero_sigfpe=no ac_cv_func_setvbuf_reversed=no ac_cv_func_strcoll_works=yes ac_cv_func_working_mktime=yes ac_cv_type_getgroups=gid_t bash_cv_dup2_broken=no ac_cv_prog_cc_g=no ac_cv_rl_version=6.0
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bash"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/basename"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/dirname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/finfo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/head"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/id"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/ln"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/logname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/mkdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/mypid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/pathchk"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/print"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/printenv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/push"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/realpath"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/rmdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/setpgid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/sleep"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/strftime"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/sync"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/tee"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/truefalse"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/tty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/uname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/unlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/whoami"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/bin/bashbug"
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc"
- sed -i -- "s|BUILD_DIR = $BUILD_ROOT/$WORKING_DIR|BUILD_DIR = /usr/src/usr.bin/$WORKING_DIR|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/bashbug--"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/bash/Makefile.inc--"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bash"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/basename"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/dirname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/finfo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/head"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/id"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/ln"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/logname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/mkdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/mypid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/pathchk"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/print"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/printenv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/push"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/realpath"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/rmdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/setpgid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/sleep"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/strftime"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/sync"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/tee"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/truefalse"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/tty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/uname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/unlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/whoami"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bashbug"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc"
- sed -i -- "s|BUILD_DIR = $BUILD_ROOT/$WORKING_DIR|BUILD_DIR = /usr/src/usr.bin/$WORKING_DIR|g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bashbug--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/bash/Makefile.inc--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Terminal_Support" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- echo "Pre-Depends: dpkg (>= 1.14.25-8), cy+model.appletv" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- else
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- fi
- echo "Depends: grep, readline (>= 6.0-7), sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: the best shell ever written by Brian Fox" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Bourne-Again SHell" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/bash/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- #FIXME: Make a $PKG_NAME-staticlibs.deb
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- # DONT USE UNLESS YOU ARE ON 11+; OVERWRITE BASH (or any other apple-signed file, for that matter), LEAD TO BRICK
- # 10.2 and up
- buildBashAndFriends() {
- notifyProgress "Building readline"
- buildReadline
- notifyProgress "Building ncurses"
- buildNcurses
- notifyProgress "Building bash"
- buildBash
- }
- #=====================
- #Basic Utils
- #---------------------
- #Download sed
- downloadSed() {
- if [[ ! -e sed-4.4.tar.xz ]]; then
- echo "Downloading sed-4.4.tar.xz"
- curl -LO https://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz
- curl -LO https://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz.sig
- checkPGPSig sed-4.4.tar.xz.sig sed-4.4.tar.xz
- else
- echo "Using existing sed"
- fi
- sudo rm -rf sed-4.4/
- tar xJvf sed-4.4.tar.xz
- WORKING_DIR="sed-4.4"
- PKG_NAME="sed"
- PKG_VERSION="4.4-1"
- cd "$WORKING_DIR"
- }
- #sed
- buildSed() {
- downloadSed
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX/" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sed"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sed"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: edits streams of text using patterns" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/sed/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download grep
- downloadGrep() {
- if [[ ! -e grep-3.0.tar.xz ]]; then
- echo "Downloading grep-3.0.tar.xz"
- curl -LO https://ftp.gnu.org/gnu/grep/grep-3.0.tar.xz
- curl -LO https://ftp.gnu.org/gnu/grep/grep-3.0.tar.xz.sig
- checkPGPSig grep-3.0.tar.xz.sig grep-3.0.tar.xz
- else
- echo "Using existing grep"
- fi
- sudo rm -rf grep-3.0/
- tar xJvf grep-3.0.tar.xz
- WORKING_DIR="grep-3.0"
- PKG_NAME="grep"
- PKG_VERSION="3.0-1"
- cd "$WORKING_DIR"
- }
- #grep
- buildGrep() {
- downloadGrep
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking --without-libiconv-prefix
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --without-libiconv-prefix
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/grep"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/grep"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: searches files for regular expressions" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/grep/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- #rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download coreutils
- downloadCoreutils() {
- if [[ ! -e coreutils-8.9.tar.xz ]]; then
- echo "Downloading coreutils-8.9.tar.xz"
- curl -LO http://gnu.mirror.constant.com/coreutils/coreutils-8.9.tar.xz
- curl -LO http://gnu.mirror.constant.com/coreutils/coreutils-8.9.tar.xz.sig
- checkPGPSig coreutils-8.9.tar.xz.sig coreutils-8.9.tar.xz
- else
- echo "Using existing coreutils"
- fi
- sudo rm -rf coreutils-8.9
- tar xJvf coreutils-8.9.tar.xz
- WORKING_DIR="coreutils-8.9"
- PKG_NAME="coreutils"
- PKG_VERSION="8.9-1"
- cd "$WORKING_DIR"
- }
- patchCoreutils() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' lib/config.hin
- sed -i -- 's|#undef HAVE_CLOCK_SETTIME||' lib/config.hin
- sed -i -- 's|#undef HAVE_FDATASYNC||' lib/config.hin
- sed -i -- 's|# define __stpncpy stpncpy||' lib/stpncpy.c
- if [[ ! -d "$SKEL_PREFIX/$ROOT_PREFIX/include" ]]; then
- mkdir -p "$SKEL_PREFIX/$ROOT_PREFIX/include"
- fi
- if [[ ! -e "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h" ]]; then
- echo "#include <sys/cdefs.h>" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "__BEGIN_DECLS" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char ***_NSGetArgv(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern int *_NSGetArgc(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char ***_NSGetEnviron(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern char **_NSGetProgname(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "extern struct mach_header *_NSGetMachExecuteHeader(void);" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- echo "__END_DECLS" >> "$SKEL_PREFIX/$ROOT_PREFIX/include/crt_externs.h"
- fi
- fi
- }
- #coreutils
- buildCoreutils() {
- downloadCoreutils
- patchCoreutils
- # Only builds with arm-apple-darwin, not aarch64
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/["
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/base64"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/basename"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chcon"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chgrp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chmod"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chown"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/chroot"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cksum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/comm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/csplit"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cut"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/date"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dd"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/df"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dircolors"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/du"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/echo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/env"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/expand"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/expr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/factor"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/false"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/fmt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/fold"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/groups"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/head"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/hostid"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/id"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/install"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/join"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/kill"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/link"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ln"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/logname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ls"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/md5sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mkdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mkfifo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mknod"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mktemp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nice"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nl"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nohup"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/nproc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/od"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/paste"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pathchk"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pinky"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/printenv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/printf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/ptx"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/pwd"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/readlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/rm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/rmdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/runcon"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/seq"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha1sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha224sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha256sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha384sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sha512sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/shred"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/shuf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sleep"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sort"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/split"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/stat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/stty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sum"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sync"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tac"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tail"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tee"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/test"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/timeout"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/touch"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/true"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/truncate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tsort"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tty"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uname"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/unexpand"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uniq"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/unlink"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/uptime"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/users"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/vdir"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/wc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/who"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/whoami"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/yes"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/["
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/base64"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/basename"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chcon"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chgrp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chmod"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chown"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/chroot"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cksum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/comm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/csplit"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cut"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/date"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dd"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/df"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dircolors"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/du"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/echo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/env"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/expand"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/expr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/factor"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/false"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/fmt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/fold"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/groups"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/head"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/hostid"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/id"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/install"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/join"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/kill"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/link"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ln"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/logname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ls"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/md5sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mkdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mkfifo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mknod"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mktemp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nice"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nl"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nohup"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/nproc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/od"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/paste"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pathchk"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pinky"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/printenv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/printf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/ptx"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/pwd"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/readlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/rm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/rmdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/runcon"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/seq"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha1sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha224sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha256sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha384sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sha512sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/shred"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/shuf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sleep"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sort"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/split"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/stat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/stty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sum"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sync"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tac"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tail"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tee"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/test"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/timeout"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/touch"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/true"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/truncate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tsort"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tty"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uname"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/unexpand"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uniq"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/unlink"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/uptime"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/users"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/vdir"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/wc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/who"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/whoami"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/yes"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Provides: md5sum, sha1sum" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: core set of Unix shell utilities from GNU" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Core Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/coreutils/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download findutils
- downloadFindUtils() {
- if [[ ! -e findutils-4.6.0.tar.gz ]]; then
- echo "Downloading findutils-4.6.0.tar.gz "
- curl -LO http://mirror.keystealth.org/gnu/findutils/findutils-4.6.0.tar.gz
- curl -LO http://mirror.keystealth.org/gnu/findutils/findutils-4.6.0.tar.gz.sig
- # NOT WORKING FOR SOME REASON, we have the signature but it still says theres no public sig, really weird
- #checkPGPSig findutils-4.6.0.tar.gz.sig findutils-4.6.0.tar.gz
- checkSHA256 findutils-4.6.0.tar.gz ded4c9f73731cd48fec3b6bdaccce896473b6d8e337e9612e16cf1431bb1169d
- else
- echo "Using existing findutils"
- fi
- sudo rm -rf findutils-4.6.0
- tar xzvf findutils-4.6.0.tar.gz
- WORKING_DIR="findutils-4.6.0"
- PKG_NAME="findutils"
- PKG_VERSION="4.6.0-1"
- cd "$WORKING_DIR"
- }
- #findutils
- buildFindUtils() {
- downloadFindUtils
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/find"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/locate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xargs"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: indexes and searches filesystems" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Find Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnu.org/software/findutils/" >> deb/DEBIAN/control
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/find"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/locate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xargs"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/var"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download diffutils
- downloadDiffUtils() {
- if [[ ! -e diffutils-3.6.tar.xz ]]; then
- echo "Downloading diffutils-3.6.tar.xz"
- curl -LO http://ftp.gnu.org/gnu/diffutils/diffutils-3.6.tar.xz
- curl -LO http://ftp.gnu.org/gnu/diffutils/diffutils-3.6.tar.xz.sig
- checkPGPSig diffutils-3.6.tar.xz.sig diffutils-3.6.tar.xz
- else
- echo "Using existing diffutils"
- fi
- sudo rm -rf diffutils-3.6
- tar xJvf diffutils-3.6.tar.xz
- WORKING_DIR="diffutils-3.6"
- PKG_NAME="diffutils"
- PKG_VERSION="3.6-1"
- cd "$WORKING_DIR"
- }
- #diffutils
- buildDiffUtils() {
- downloadDiffUtils
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/cmp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/diff"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/diff3"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/sdiff"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff3"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sdiff"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: compare two files for differences" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Diff Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/diffutils/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files for this
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download darwintools
- downloadDarwinTools() {
- if [[ ! -d DarwinToolsARM ]]; then
- echo "Fetching DarwinTools"
- mkdir -p DarwinToolsARM
- cd DarwinToolsARM
- curl -LO https://opensource.apple.com/source/DarwinTools/DarwinTools-1/sw_vers.c
- #Not built yet
- curl -LO https://opensource.apple.com/source/launchd/launchd-842.92.1/support/launchctl.c
- #sw_vers.c
- checkSHA256 sw_vers.c 55aab510b465f7687b8ebe23f0e51926606fd5316da138778838b2dac3e7c7e0
- else
- echo "Using existing DarwinTools"
- cd DarwinToolsARM
- fi
- WORKING_DIR="DarwinToolsARM"
- PKG_NAME="darwintools"
- PKG_VERSION="1.0-1"
- }
- patchDarwinTools() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#include <CoreFoundation/CFPriv.h>|extern CFDictionaryRef _CFCopySystemVersionDictionary(void);\
- extern CFDictionaryRef _CFCopyServerVersionDictionary(void);|' sw_vers.c
- sed -i -- 's|_kCFSystemVersionProductNameKey|CFSTR(\"ProductName\")|g' sw_vers.c
- sed -i -- 's|_kCFSystemVersionProductVersionKey|CFSTR(\"ProductVersion\")|g' sw_vers.c
- sed -i -- 's|_kCFSystemVersionBuildVersionKey|CFSTR(\"ProductBuildVersion\")|g' sw_vers.c
- fi
- }
- #darwintools
- #Notes:
- # This only builds a striped down version of the one on iOS
- # If you're building for a non-appletv platform, you may need to fix things here.
- buildDarwinTools() {
- downloadDarwinTools
- patchDarwinTools
- "$CLANG_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -framework CoreFoundation "$MIN_VERSION" -o "sw_vers" sw_vers.c
- codesign "$BUILD_ROOT/$WORKING_DIR/sw_vers"
- cp sw_vers "$SKEL_PREFIX/$ROOT_PREFIX/bin/"
- initDebStructure
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- cp sw_vers "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Administration" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Maintainer: $MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: sw_vers" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Darwin Tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete #Not that there are any...
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download uikittools
- downloadUIKitTools() {
- if [[ ! -d uikittools ]]; then
- echo "Fetching uikittools"
- git clone git://git.saurik.com/uikittools.git
- else
- echo "Using existing uikittools"
- fi
- WORKING_DIR="uikittools"
- PKG_NAME="uikittools"
- PKG_VERSION="1.1.12-1"
- cd "$WORKING_DIR"
- git checkout tags/v1.1.12
- }
- #uikittools
- #Notes:
- # This only builds a striped down version of the one on iOS
- # If you're building for a non-appletv platform, you may need to fix things here.
- buildUIKitTools() {
- downloadUIKitTools
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation "$MIN_VERSION" -o cfversion cfversion.mm
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation "$MIN_VERSION" -o gssc gssc.mm
- "$CLANGPLUS_PATH" -arch "$ARCH" -isysroot"$SDK_PATH" -Os -Werror -framework CoreFoundation -framework Foundation -framework UIKit "$MIN_VERSION" -o uiduid uiduid.mm
- codesign "$BUILD_ROOT/$WORKING_DIR/cfversion"
- codesign "$BUILD_ROOT/$WORKING_DIR/gssc"
- codesign "$BUILD_ROOT/$WORKING_DIR/uiduid"
- cp gssc cfversion uiduid "$SKEL_PREFIX/$ROOT_PREFIX/bin/"
- initDebStructure
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- cp gssc cfversion uiduid "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Maintainer: $MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: UIKit/GraphicsServices command line access" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: UIKit Tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Author: Jay Freeman (saurik) <saurik@saurik.com>" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depiction: http://cydia.saurik.com/info/uikittools/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- echo "Pre-Depends: cy+model.appletv" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: coreutils, firmware (>= 9.0)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- else
- #FIXME: If you're building for some other platform, you should address this.
- echo "Depends: coreutils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- fi
- echo "Tag: purpose::console, role::hacker" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete #Not that there are any...
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- buildBasicUtils() {
- notifyProgress "Building sed"
- buildSed
- notifyProgress "Building grep"
- buildGrep
- notifyProgress "Building coreutils"
- buildCoreutils
- notifyProgress "Building findutils"
- buildFindUtils
- notifyProgress "Building diffutils"
- buildDiffUtils
- notifyProgress "Building DarwinTools"
- buildDarwinTools
- notifyProgress "Building UIKitTools"
- buildUIKitTools
- }
- #=====================
- #DPKG and Dependencies
- #---------------------
- #Download zlib
- downloadZLib() {
- #Download zlib
- if [[ ! -d zlib ]]; then
- echo "Downloading zlib git"
- git clone https://github.com/madler/zlib.git
- else
- echo "Using existing zlib"
- fi
- WORKING_DIR="zlib"
- PKG_NAME="zlib"
- PKG_VERSION="1.2.11-1"
- cd "$WORKING_DIR"
- git checkout tags/v1.2.11
- sudo rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- #zlib
- buildZLib() {
- downloadZLib
- cmake -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_OSX_SYSROOT="$SDK_PATH/" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX" ..
- #make
- make -j8 DESTDIR="$SKEL_PREFIX" install
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Massively spiffy yet delicately unobtrusive compression library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: zlib" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://zlib.net/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download xz
- downloadXZ() {
- if [[ ! -e xz-5.2.3.tar.gz ]]; then
- echo "Downloading xz-5.2.3.tar.gz"
- curl -LO http://tukaani.org/xz/xz-5.2.3.tar.gz
- curl -LO http://tukaani.org/xz/xz-5.2.3.tar.gz.sig
- checkPGPSig xz-5.2.3.tar.gz.sig xz-5.2.3.tar.gz
- else
- echo "Using xz-5.2.3.tar.gz"
- fi
- sudo rm -rf xz-5.2.3
- tar xzvf xz-5.2.3.tar.gz
- WORKING_DIR="xz-5.2.3"
- PKG_NAME="xz"
- PKG_VERSION="5.2.3-1"
- cd "$WORKING_DIR"
- }
- patchXZ() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- fi
- }
- #xz
- buildXZ() {
- downloadXZ
- patchXZ
- if [[ "$ARCH" == "arm64" ]]; then
- ./configure CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXXFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" CFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" LIBS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- ./configure CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXXFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" CFLAGS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" LIBS="$MIN_VERSION -isysroot $SDK_PATH -arch $ARCH" --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lzmadec"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lzmainfo"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xz"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/xzdec"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.5.dylib"
- if [[ ! -e "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib" ]]; then
- mkdir -p "$SKEL_PREFIX/$ROOT_PREFIX/local/lib"
- #cp "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.5.dylib" "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- ln -s /usr/lib/liblzma.5.dylib "$SKEL_PREFIX/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- fi
- initDebStructure
- make DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lzmadec"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lzmainfo"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xz"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/xzdec"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblzma.5.dylib"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/local/lib"
- ln -s /usr/lib/liblzma.5.dylib "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/local/lib/liblzma.5.dylib"
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: XZ Utils are the successor to LZMA Utils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: XZ Utils" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://tukaani.org/xz/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblzma.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download bzip2
- downloadBZip2() {
- if [[ ! -e bzip2-1.0.6.tar.gz ]]; then
- echo "Downloading bzip2-1.0.6.tar.gz"
- curl -LO https://gigenet.dl.sourceforge.net/project/bzip2/bzip2-1.0.6.tar.gz
- checkSHA256 bzip2-1.0.6.tar.gz a2848f34fcd5d6cf47def00461fcb528a0484d8edef8208d6d2e2909dc61d9cd
- else
- echo "Using bzip2-1.0.6.tar.gz"
- fi
- sudo rm -rf bzip2-1.0.6
- tar xzvf bzip2-1.0.6.tar.gz
- WORKING_DIR="bzip2-1.0.6"
- PKG_NAME="bzip2"
- PKG_VERSION="1.0.6-1"
- cd "$WORKING_DIR"
- }
- patchBZip2() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- #fix up our makefile...
- sed -i -- 's|CC=gcc|CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang|' Makefile
- sed -i -- 's|AR=ar|AR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar|' Makefile
- sed -i -- 's|RANLIB=ranlib|RANLIB=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib|' Makefile
- sed -i -- "s|LDFLAGS=|LDFLAGS=$MIN_VERSION -isysroot \"$SDK_PATH\" -arch $ARCH|" Makefile
- sed -i -- "s|CFLAGS=|CFLAGS=$MIN_VERSION -isysroot \"$SDK_PATH\" -arch $ARCH |" Makefile
- sed -i -- 's|all:\(.*\) test$|all: \1|' Makefile
- sed -i -- 's|ln -s -f \$(PREFIX)/bin/|ln -s -f |g' Makefile
- fi
- }
- #bzip2
- buildBZip2() {
- downloadBZip2
- patchBZip2
- make -j8 install PREFIX="$SKEL_PREFIX/$ROOT_PREFIX"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bunzip2"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzcat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzip2"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/bzip2recover"
- initDebStructure
- make -j8 install PREFIX="$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bunzip2"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzcat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzip2"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/bzip2recover"
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 148" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: compression that's slightly better than gzip" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.bzip.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- #FIXME: Make a $PKG_NAME-staticlibs.deb
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download lz4
- downloadLZ4() {
- if [[ ! -e lz4-v1.7.5.tar.gz ]]; then
- #echo "Cloning lz4.git"
- #git clone https://github.com/lz4/lz4.git
- #Master = v1.7.5
- curl -LO https://github.com/lz4/lz4/archive/v1.7.5.tar.gz
- mv v1.7.5.tar.gz lz4-v1.7.5.tar.gz
- checkSHA256 lz4-v1.7.5.tar.gz 0190cacd63022ccb86f44fa5041dc6c3804407ad61550ca21c382827319e7e7e
- else
- echo "Using existing lz4"
- fi
- sudo rm -rf lz4-1.7.5/
- tar xzvf lz4-v1.7.5.tar.gz
- WORKING_DIR="lz4-1.7.5/contrib/cmake_unofficial/"
- PKG_NAME="lz4"
- PKG_VERSION="1.7.5-1"
- cd "$WORKING_DIR"
- rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- #lz4
- buildLZ4() {
- downloadLZ4
- initDebStructure
- cmake -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_OSX_SYSROOT="$SDK_PATH/" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX" ..
- make -j8
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lz4"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/lz4c"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblz4.1.7.5.dylib"
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lz4"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/lz4c"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/liblz4.1.7.5.dylib"
- export COPYFILE_DISABLE
- export COPY_EXTENDED_ATTRIBUTES_DISABLE
- echo "Package: $PKG_NAME" > "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 396" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Extremely Fast Compression algorithm" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: lz4" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.lz4.org" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download openssl
- downloadOpenSSL() {
- if [[ ! -d openssl ]]; then
- git clone -b OpenSSL_1_1_0-stable https://github.com/openssl/openssl.git
- else
- echo "Using existing openssl repo"
- fi
- WORKING_DIR="openssl"
- PKG_NAME="openssl"
- PKG_VERSION="1.1.0-1"
- cd "$WORKING_DIR"
- }
- patchOpenSSL() {
- #if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- "s|-arch $ARCH -mios-version-min=7.0.0|-arch $ARCH $MIN_VERSION|" Configurations/10-main.conf
- #fi
- }
- #openssl
- buildOpenSSL() {
- downloadOpenSSL
- patchOpenSSL
- export PLATFORM="$PLATFORM"
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang -fembed-bitcode"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- #export PATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$PATH"
- ./Configure ios64-cross no-dso no-hw no-engine --prefix="/$ROOT_PREFIX"
- #./Configure ios64-cross no-shared no-dso no-hw no-engine --prefix="/$ROOT_PREFIX"
- #make
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/openssl"
- #codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libcrypto.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libcrypto.1.1.dylib"
- initDebStructure
- make DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/openssl"
- #codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcrypto.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcrypto.1.1.dylib"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 6164" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: SSL library and cryptographic tools" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: OpenSSL" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.openssl.org" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- #mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download Curl
- downloadCurl() {
- if [[ ! -e curl-7.50.1.tar.gz ]]; then
- echo "Downloading curl-7.50.1.tar.gz"
- curl -LO https://curl.haxx.se/download/curl-7.50.1.tar.gz
- checkSHA256 curl-7.50.1.tar.gz 3e392cf600822b817be82d9080b377fcbab70538d5a8bf525a1cd66e157b99ea
- else
- echo "Using curl-7.50.1.tar.gz"
- fi
- sudo rm -rf curl-7.50.1
- echo "Unpacking curl"
- tar xzvf "curl-7.50.1.tar.gz"
- WORKING_DIR="curl-7.50.1"
- PKG_NAME="curl"
- PKG_VERSION="7.50.1-1"
- cd "$WORKING_DIR"
- }
- patchCurl() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- #(Forcibly) Remove that dirty clock_gettime
- #TODO: Determine if this is the best way
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME_MONOTONIC||' lib/curl_config.h.in
- fi
- }
- #curl
- buildCurl() {
- downloadCurl
- patchCurl
- export PLATFORM="$PLATFORM"
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- export CFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION -fembed-bitcode -I$SKEL_PREFIX/$ROOT_PREFIX/include/ "
- export LDFLAGS="-arch $ARCH -isysroot $SDK_PATH -L${SKEL_PREFIX}/$ROOT_PREFIX/lib"
- ./configure --prefix="/$ROOT_PREFIX" --host="arm-apple-darwin" --with-zlib="$SKEL_PREFIX/$ROOT_PREFIX/lib" -with-random=/dev/urandom --disable-ntlm-wb --with-ssl="$SKEL_PREFIX/$ROOT_PREFIX/lib"
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/curl"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libcurl.4.dylib"
- make clean
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.4.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Networking" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: openssl" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: flexible multi-protocol file transfers" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: cURL" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://curl.haxx.se/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/curl-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libcurl.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download berkeleydb
- downloadBerkeleyDB() {
- if [[ ! -e db-6.2.23.tar.gz ]]; then
- echo "Downlading db-6.2.23.tar.gz"
- curl -LO http://download.oracle.com/berkeley-db/db-6.2.23.tar.gz
- checkSHA256 db-6.2.23.tar.gz 47612c8991aa9ac2f6be721267c8d3cdccf5ac83105df8e50809daea24e95dc7
- else
- echo "Using existing db-6.2.23"
- fi
- sudo rm -rf db-6.2.23
- tar xzvf db-6.2.23.tar.gz
- WORKING_DIR="db-6.2.23/build_unix/"
- PKG_NAME="berkeleydb"
- PKG_VERSION="6.2.23-1"
- cd "$WORKING_DIR"
- }
- patchBerkeleyDB() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' ../dist/config.hin
- if [[ "$PKG_VERSION" == "6.2.23-1" ]]; then
- cat ../lang/sql/sqlite/src/shell.c | head -n 14 > shell.patched.c
- echo "#include <stdint.h>" >> shell.patched.c
- echo "#include <stdio.h>" >> shell.patched.c
- echo "#include <stdlib.h>" >> shell.patched.c
- echo "#include <spawn.h>" >> shell.patched.c
- echo "#include <sys/wait.h>" >> shell.patched.c
- echo "#include <sys/stat.h>" >> shell.patched.c
- echo "" >> shell.patched.c
- echo "extern char **environ;" >> shell.patched.c
- echo "" >> shell.patched.c
- cat ../lang/sql/sqlite/src/shell.c | tail -n 4847 | head -n 2622 >> shell.patched.c
- fixSystem "shell.patched.c"
- cat ../lang/sql/sqlite/src/shell.c | tail -n 2226 | sed 's/system(zCmd)/RunCmd(zCmd)/g' >> shell.patched.c
- cp shell.patched.c ../lang/sql/sqlite/src/shell.c
- fi
- fi
- }
- #berkeleydb
- buildBerkeleyDB() {
- downloadBerkeleyDB
- patchBerkeleyDB
- #Not sure which all we need...
- export PLATFORM="$PLATFORM" #TODO: Maybe necessary? Need to test.
- export BUILD_TOOLS="`xcode-select --print-path`"
- export CC="clang"
- export CROSS_COMPILE="`xcode-select --print-path`/Toolchains/XcodeDefault.xctoolchain/usr/bin/"
- export CROSS_TOP="`xcode-select --print-path`/Platforms/$PLATFORM.platform/Developer"
- export CROSS_SDK="`echo $SDK_PATH | sed 's/.*\///g'`"
- export CFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION"
- export CXXFLAGS="-arch $ARCH -pipe -Os -gdwarf-2 -isysroot $SDK_PATH $MIN_VERSION"
- export LDFLAGS="-arch $ARCH -isysroot $SDK_PATH" # -L${SKEL_PREFIX}/lib"
- #Only builds with arm-apple-darwin, not aarch64
- ../dist/configure --disable-debug --disable-test --disable-atomicsupport --enable-cxx--enable-compact185 --enable-sql --enable-sql_codegen --enable-dbm --enable-slt --disable-java --host=arm-apple-darwin --prefix="/$ROOT_PREFIX"
- make DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_archive"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_checkpoint"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_deadlock"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_dump"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_hotbackup"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_load"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_log_verify"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_printlog"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_recover"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_replicate"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_sql_codegen"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_stat"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_tuner"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_upgrade"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/db_verify"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dbsql"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb_sql-6.2.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb-6.2.dylib"
- initDebStructure
- make DESTDIR="$BUILD_ROOT/db-6.2.23/build_unix/deb/" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_archive"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_checkpoint"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_deadlock"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_dump"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_hotbackup"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_load"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_log_verify"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_printlog"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_recover"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_replicate"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_sql_codegen"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_stat"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_tuner"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_upgrade"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/db_verify"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dbsql"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb_sql-6.2.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb-6.2.dylib"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: important" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Data_Storage" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 1644" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: Oracle's embeddable database engine" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Berkeley DB" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.oracle.com/technology/products/berkeley-db/index.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/docs" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb-6.2.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdb_sql-6.2.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download tar
- downloadTar() {
- if [[ ! -e tar-1.33.tar.xz ]]; then
- echo "Downloading tar-1.33.tar.xz"
- curl -LO http://ftp.gnu.org/gnu/tar/tar-1.33.tar.xz
- checkSHA256 tar-1.33.tar.xz 66a8344b1dc83a411d311bd1547e0176e56cc311f28ee94a30f84dafb3d9067e
- else
- echo "Using existing tar"
- fi
- sudo rm -rf tar-1.33
- tar xJvf tar-1.33.tar.xz
- WORKING_DIR="tar-1.33"
- PKG_NAME="tar"
- PKG_VERSION="1.33-1"
- cd "$WORKING_DIR"
- }
- patchTar() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- fi
- }
- #tar
- buildTar() {
- downloadTar
- patchTar
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/tar"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/tar"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: bzip2, xz" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnu.org/software/tar/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: tool for making tape archives" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Tape Archive" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Tag: purpose::console, role::hacker" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download dpkg
- downloadDpkg() {
- if [[ ! -d dpkg ]]; then
- echo "Downlading dpkg"
- git clone https://git.nito.tv/NitoTV/dpkg.git
- else
- echo "Using existing dpkg"
- fi
- WORKING_DIR="dpkg"
- PKG_NAME="dpkg"
- PKG_VERSION="1.18.23-1" #FIXME
- cd "$WORKING_DIR"
- }
- patchDpkg() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- "s|#define ARCHITECTURE \"darwin-arm\"|#define ARCHITECTURE \"$PLATFORM_LOWER-$ARCH\"|" config.h
- sed -i -- 's|gtar|tar|' config.h
- fi
- }
- #dpkg
- buildDpkg() {
- downloadDpkg
- local dont_die_here=$(./autogen.sh)
- if [[ "$ARCH" == "arm64" ]]; then
- LZMA_LIBS="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --disable-start-stop-daemon --host=aarch64-apple-darwin --disable-dependency-tracking PERL_LIBDIR='$(prefix)/lib/' --disable-dselect --localstatedir="/var/" --sysconfdir="/etc"
- else
- LZMA_LIBS="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CXX=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --disable-start-stop-daemon --host=arm-apple-darwin PERL_LIBDIR='$(prefix)/lib/' --disable-dselect --localstatedir="/var/" --sysconfdir="/etc"
- fi
- patchDpkg #Must be after configure for now. I'll deal with this later
- make -j8 DESTDIR="$SKEL_PREFIX" install
- #lzma conflicts with built in libraries when running in certian conditions.
- #we make -j8 a symlink our version of lzma in the xz build process
- #here we change dpkg-deb to look for this version instead
- #if we do not do this, apt-get/dpkg* will fail from our setuid tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-divert"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-query"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-split"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-trigger"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dpkg-statoverride"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/update-alternatives"
- echo "appletvos-arm64" >> "$SKEL_PREFIX/var/lib/dpkg/arch"
- echo "darwin-arm64" >> "$SKEL_PREFIX/var/lib/dpkg/arch"
- initDebStructure
- make -j8 install DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/"
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-deb"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-divert"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-query"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-split"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-trigger"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/dpkg-statoverride"
- codesign "$BUILD_ROOT/dpkg/deb/$ROOT_PREFIX/bin/update-alternatives"
- echo "appletvos-arm64" >> "$BUILD_ROOT/dpkg/deb/var/lib/dpkg/arch"
- echo "darwin-arm64" >> "$BUILD_ROOT/dpkg/deb/var/lib/dpkg/arch"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la"
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig/libdpkg.pc"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la--"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig/libdpkg.pc--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Packaging" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: bash, bzip2, coreutils-bin, diffutils, findutils, gzip, lzma, ncurses, tar" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: bzip2, coreutils, diffutils, findutils, xz, tar" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: package maintainance tools from Debian" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Debian Packager" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://wiki.debian.org/Teams/Dpkg" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libdpkg.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/pkgconfig" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- #FIXME
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/etc"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/var"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- buildDPKGAndDependencies() {
- notifyProgress "Building zlib"
- buildZLib
- notifyProgress "Building xz"
- buildXZ
- notifyProgress "Building bzip2"
- buildBZip2
- notifyProgress "Building lz4"
- buildLZ4
- notifyProgress "Building openSSL"
- buildOpenSSL
- notifyProgress "Building curl"
- buildCurl
- notifyProgress "Building BerkeleyDB"
- buildBerkeleyDB
- notifyProgress "Building tar"
- buildTar
- notifyProgress "Building dpkg"
- buildDpkg
- }
- #====================
- #APT and Dependencies
- #--------------------
- #Download libgpg-error
- downloadGpgError() {
- if [[ ! -e libgpg-error-1.27.tar.bz2 ]]; then
- echo "Downloading libgpg-error-1.27.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2.sig
- checkPGPSig libgpg-error-1.27.tar.bz2.sig libgpg-error-1.27.tar.bz2
- else
- echo "Using existing libgpg-error"
- fi
- sudo rm -rf libgpg-error-1.27
- tar xjvf libgpg-error-1.27.tar.bz2
- WORKING_DIR="libgpg-error-1.27"
- PKG_NAME="libgpg-error"
- PKG_VERSION="1.27-1"
- cd "$WORKING_DIR"
- }
- patchGpgError() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- echo ""
- #sed -i -- 's|assert (!"lock ABI version");|//assert (!"lock ABI version");|' config.h
- #sed -i -- 's|assert (!"lock ABI version");|//assert (!"lock ABI version");|' config.h
- fi
- }
- #libgpg-error
- buildGpgError() {
- downloadGpgError
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=aarch64-apple-darwin --disable-dependency-tracking --disable-tests --enable-threads=posix
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CPPFLAGS="-isysroot $SDK_PATH -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=arm-apple-darwin --disable-tests --enable-threads=posix
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-error"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-error"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's error management library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GnuPG Errors" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libgpg-error/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/libgpg-error" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-error-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/common-lisp" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgpg-error.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download gcrypt
- downloadGcrypt() {
- if [[ ! -e libgcrypt-1.8.2.tar.bz2 ]]; then
- echo "Downloading libgcrypt-1.8.2.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libgcrypt/libgcrypt-1.8.2.tar.bz2.sig
- checkPGPSig libgcrypt-1.8.2.tar.bz2.sig libgcrypt-1.8.2.tar.bz2
- else
- echo "Using existing gcrypt"
- fi
- sudo rm -rf libgcrypt-1.8.2
- tar xjvf libgcrypt-1.8.2.tar.bz2
- WORKING_DIR="libgcrypt-1.8.2"
- PKG_NAME="libgcrypt"
- PKG_VERSION="1.8.2-1"
- cd "$WORKING_DIR"
- }
- patchGcrypt() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- if [[ "$PKG_VERSION" == "1.8.2-1" ]]; then
- cat tests/random.c | head -n 39 > random.patched.c
- echo "#include <stdint.h>" >> random.patched.c
- echo "#include <stdio.h>" >> random.patched.c
- echo "#include <stdlib.h>" >> random.patched.c
- echo "#include <spawn.h>" >> random.patched.c
- echo "#include <sys/wait.h>" >> random.patched.c
- echo "#include <sys/stat.h>" >> random.patched.c
- echo "" >> random.patched.c
- echo "extern char **environ;" >> random.patched.c
- echo "" >> random.patched.c
- fixSystem "random.patched.c"
- cat tests/random.c | tail -n 727 | sed 's/system (cmdline)/RunCmd(cmdline)/g' >> random.patched.c
- cp random.patched.c tests/random.c
- fi
- fi
- }
- #gcrypt
- buildGcrypt() {
- downloadGcrypt
- patchGcrypt
- #TODO: Doesn't like aarch64-apple-darwin, but may build with it with minor changes.
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dumpsexp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/hmac256"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/mpicalc"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.20.dylib"
- #make clean
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dumpsexp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/hmac256"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/mpicalc"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.20.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgpg-error" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: LGPL cryptographic algorithm library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GNU Cryptography" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libgcrypt/" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/man" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/libgcrypt-config" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/bin/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libgcrypt.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download libkbsa
- downloadKSBA() {
- if [[ ! -e libksba-1.3.5.tar.bz2 ]]; then
- echo "Downloading libksba-1.3.5.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libksba/libksba-1.3.5.tar.bz2.sig
- checkPGPSig libksba-1.3.5.tar.bz2.sig libksba-1.3.5.tar.bz2
- else
- echo "Using existing libksba"
- fi
- sudo rm -rf libksba-1.3.5
- tar xjvf libksba-1.3.5.tar.bz2
- WORKING_DIR="libksba-1.3.5"
- PKG_NAME="libksba"
- PKG_VERSION="1.3.5-1"
- cd "$WORKING_DIR"
- }
- #libkbsa
- buildKSBA() {
- downloadKSBA
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --disable-dependency-tracking --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.8.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/libksba-1.3.5/deb" install
- codesign "deb/$ROOT_PREFIX/lib/libksba.8.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgpg-error" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's certification management library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: KSBA" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libksba/" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libksba.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download npth
- downloadNpth() {
- if [[ ! -e npth-1.5.tar.bz2 ]]; then
- echo "Downloading npth-1.5.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/npth/npth-1.5.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/npth/npth-1.5.tar.bz2.sig
- checkPGPSig npth-1.5.tar.bz2.sig npth-1.5.tar.bz2
- else
- echo "Using existing npth"
- fi
- sudo rm -rf npth-1.5
- tar xjvf npth-1.5.tar.bz2
- WORKING_DIR="npth-1.5"
- PKG_NAME="libnpth"
- PKG_VERSION="1.5-1"
- cd "$WORKING_DIR"
- }
- patchNpth() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- if [[ "$PKG_VERSION" == "1.5-1" ]]; then
- cat src/npth.c | head -n 19 > npth.patched.c
- echo "#include <stdint.h>" >> npth.patched.c
- echo "#include <stdio.h>" >> npth.patched.c
- echo "#include <stdlib.h>" >> npth.patched.c
- echo "#include <spawn.h>" >> npth.patched.c
- echo "#include <sys/wait.h>" >> npth.patched.c
- echo "" >> npth.patched.c
- echo "extern char **environ;" >> npth.patched.c
- echo "" >> npth.patched.c
- cat src/npth.c | tail -n 757 | head -n 537 >> npth.patched.c
- fixSystem "npth.patched.c"
- cat src/npth.c | tail -n 220 | sed 's/system(cmd)/RunCmd(cmd)/g' >> npth.patched.c
- cp npth.patched.c src/npth.c
- fi
- fi
- }
- #npth
- buildNpth() {
- downloadNpth
- patchNpth
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --disable-dependency-tracking
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libnpth.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: portable threading library used by X" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The New GNU Portable Threads Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/software/npth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- #No files
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libnpth.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download libassuan
- downloadAssuan() {
- if [[ ! -e libassuan-2.5.1.tar.bz2 ]]; then
- echo "Downloading libassuan-2.5.1.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/libassuan/libassuan-2.5.1.tar.bz2.sig
- checkPGPSig libassuan-2.5.1.tar.bz2.sig libassuan-2.5.1.tar.bz2
- else
- echo "Using existing libassuan"
- fi
- sudo rm -rf libassuan-2.5.1
- tar xjvf libassuan-2.5.1.tar.bz2
- WORKING_DIR="libassuan-2.5.1"
- PKG_NAME="libassuan"
- PKG_VERSION="2.5.1-1"
- cd "$WORKING_DIR"
- }
- #libassuan
- buildAssuan() {
- downloadAssuan
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --disable-dependency-tracking --with-gpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-gpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.la"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/libassuan.la--"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libnpth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: GnuPG's inter-process communication" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: Assuan" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/libassuan/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/aclocal" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/share/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libassuan.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- rmdir "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download ntbtls
- downloadNtbtls() {
- if [[ ! -e ntbtls-0.1.2.tar.bz2 ]]; then
- echo "Downloading ntbtls-0.1.2.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/ntbtls/ntbtls-0.1.2.tar.bz2.sig
- checkPGPSig ntbtls-0.1.2.tar.bz2.sig ntbtls-0.1.2.tar.bz2
- else
- echo "Using existing ntbtls"
- fi
- sudo rm -rf ntbtls-0.1.2
- tar xjvf ntbtls-0.1.2.tar.bz2
- WORKING_DIR="ntbtls-0.1.2"
- PKG_NAME="libntbtls"
- PKG_VERSION="0.1.2-1"
- cd "$WORKING_DIR"
- }
- patchNtbtls() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- # this is required because prior dependencies write /$ROOT_PREFIX/lib/libgpg-error.la as a dependency in the .la file
- sed -i -- "s|/$ROOT_PREFIX/lib/libgpg-error.la|$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.la|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.la"
- sed -i -- "s|/$ROOT_PREFIX/lib/libgpg-error.la|$SKEL_PREFIX/$ROOT_PREFIX/lib/libgpg-error.la|g" "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.la"
- rm -f "$SKEL_PREFIX/$ROOT_PREFIX/lib/libgcrypt.la--"
- rm -f "$SKEL_PREFIX/$ROOT_PREFIX/lib/libksba.la--"
- fi
- }
- #ntbtls
- buildNtbtls() {
- downloadNtbtls
- patchNtbtls
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=aarch64-apple-darwin --disable-dependency-tracking --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libntbtls.0.dylib"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/" install
- codesign "deb/$ROOT_PREFIX/lib/libntbtls.0.dylib"
- #Get rid of cross-compile artifacts
- sed -i -- "s|$SKEL_PREFIX||g" "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la"
- rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la--"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Security" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgcrypt, libksba" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: a tiny TLS 1.2 only implementation designed to be used with Libgcrypt and LibKSBA" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The Not Too Bad TLS Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/related_software/ntbtls/index.en.html" >> deb/DEBIAN/control
- #Build the doc deb
- #No files
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libntbtls.la" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/lib/"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download gpg
- downloadGpg() {
- if [[ ! -e gnupg-2.2.3.tar.bz2 ]]; then
- echo "Downloading gnupg-2.2.3.tar.bz2"
- curl -LO https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.3.tar.bz2
- curl -LO https://www.gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.3.tar.bz2.sig
- checkPGPSig gnupg-2.2.3.tar.bz2.sig gnupg-2.2.3.tar.bz2
- else
- echo "Using existing gpg"
- fi
- sudo rm -rf gnupg-2.2.3
- tar xjvf gnupg-2.2.3.tar.bz2
- WORKING_DIR="gnupg-2.2.3"
- PKG_NAME="gnupg"
- PKG_VERSION="2.2.3-1"
- cd "$WORKING_DIR"
- }
- patchGpg() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- if [[ "$PKG_VERSION" == "2.2.3-1" ]]; then
- cat "g10/exec.c" | head -n 54 > "exec.patched.c"
- echo "#include <stdint.h>" >> "exec.patched.c"
- echo "#include <stdio.h>" >> "exec.patched.c"
- echo "#include <stdlib.h>" >> "exec.patched.c"
- echo "#include <spawn.h>" >> "exec.patched.c"
- echo "#include <sys/wait.h>" >> "exec.patched.c"
- echo "" >> "exec.patched.c"
- echo "extern char **environ;" >> "exec.patched.c"
- echo "" >> "exec.patched.c"
- cat "g10/exec.c" | head -n 111 | tail -n 57 >> "exec.patched.c"
- fixSystem "exec.patched.c"
- cat "g10/exec.c" | tail -n 524 | sed 's/=system(info->command)/=RunCmd(info->command)/g' >> "exec.patched.c"
- cp "exec.patched.c" "g10/exec.c"
- fi
- fi
- }
- #gpg
- buildGpg() {
- downloadGpg
- patchGpg
- if [[ "$ARCH" == "arm64" ]]; then
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=aarch64-apple-darwin --disable-dependency-tracking --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libassuan-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-npth-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ntbtls-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- else
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix="/$ROOT_PREFIX/" --host=arm-apple-darwin --with-libgpg-error-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libgcrypt-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-libassuan-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ksba-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-npth-prefix="$SKEL_PREFIX/$ROOT_PREFIX/" --with-ntbtls-prefix="$SKEL_PREFIX/$ROOT_PREFIX/"
- fi
- make -j8 DESTDIR="$SKEL_PREFIX" install
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirmngr"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/dirmngr-client"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-agent"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-connect-agent"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgconf"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgparsemail"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgscm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgsm"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgtar"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpgv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/kbxutil"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/watchgnupg"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-check-pattern"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-preset-passphrase"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-protect-tool"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/gpg-wks-client"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/scdaemon"
- initDebStructure
- make -j8 install DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb/"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirmngr"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/dirmngr-client"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-agent"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpg-connect-agent"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgconf"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgparsemail"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgscm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgsm"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgtar"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/gpgv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/kbxutil"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/watchgnupg"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-check-pattern"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-preset-passphrase"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-protect-tool"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/gpg-wks-client"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/scdaemon"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: libgcrypt, libnpth, libassuan, libksba, libntbtls" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: newer encryption compatible with OpenPGP" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: GNU Privacy Guard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gnupg.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #Build the doc deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-doc|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-doc/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share" "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/"
- rm "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX/share/info/dir"
- #Build the dev deb
- #No files
- #rm -rf "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/share/info"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-doc/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- #Download apt
- downloadApt() {
- if [[ ! -d apt ]]; then
- echo "Downlading apt"
- git clone https://git.nito.tv/NitoTV/apt.git
- else
- echo "Using existing apt"
- fi
- WORKING_DIR="apt"
- PKG_NAME="apt7"
- PKG_VERSION="0.7.25.3-1"
- cd "$WORKING_DIR"
- sudo rm -rf build
- mkdir build
- cd build
- WORKING_DIR="$WORKING_DIR/build"
- }
- patchAPT() {
- if [[ "$PLATFORM" == "AppleTVOS" ]]; then
- sed -i -- '/^INCLUDE_DIRECTORIES/d' ../CMakeLists.txt
- sed -i -- '/^LINK_DIRECTORIES/d' ../CMakeLists.txt
- cat ../CMakeLists.txt | head -n 15 > newCmakeLists.txt
- echo "INCLUDE_DIRECTORIES($SKEL_PREFIX/$ROOT_PREFIX/include)" >> newCmakeLists.txt
- echo "LINK_DIRECTORIES($SKEL_PREFIX/$ROOT_PREFIX/lib)" >> newCmakeLists.txt
- echo "" >> newCmakeLists.txt
- cat ../CMakeLists.txt | tail -n 217 >> newCmakeLists.txt
- mv newCmakeLists.txt ../CmakeLists.txt
- #sed -i -- "s|/Users/jaywalker/RnD/ATV/packages/test/skel/|$SKEL_PREFIX/|g" ../CMakeLists.txt
- fi
- }
- #apt
- buildAPT() {
- downloadApt
- patchAPT
- cmake -DCMAKE_LOCALSTATEDIR="/private/var" -DCMAKE_INSTALL_NAME_DIR="/$ROOT_PREFIX/lib" -DCMAKE_INSTALL_RPATH="/$ROOT_PREFIX/" -DCMAKE_OSX_SYSROOT="$SDK_PATH" -DCMAKE_CXX_FLAGS="-arch $ARCH" -DCMAKE_C_FLAGS="-arch $ARCH" -DCMAKE_INSTALL_PREFIX="/$ROOT_PREFIX/" -DCMAKE_SHARED_LINKER_FLAGS="-lresolv -L$SKEL_PREFIX/$ROOT_PREFIX/lib/" -DCURL_INCLUDE_DIR="$SKEL_PREFIX/$ROOT_PREFIX/include" -DCURL_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/libcurl.4.dylib" -DLZ4_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include/" -DLZ4_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblz4.dylib" -DLZMA_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include/" -DLZMA_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib" -DCURRENT_VENDOR=debian -DUSE_NLS=0 -DWITH_DOC=0 -DBERKELEY_DB_INCLUDE_DIRS="$SKEL_PREFIX/$ROOT_PREFIX/include" -DBERKELEY_DB_LIBRARIES="$SKEL_PREFIX/$ROOT_PREFIX/lib/libdb.dylib" -DCMAKE_FIND_ROOT_PATH="$SKEL_PREFIX" ..
- sed -i -- "s|#define COMMON_ARCH \"darwin-amd64\"|#define COMMON_ARCH \"$PLATFORM_LOWER-$ARCH\"|" include/config.h
- make -j8 DESTDIR="$SKEL_PREFIX" install
- #lzma conflicts with built in libraries we make -j8 an extra copy of our version of lzma in the xz build process
- #here we change libapt-pkg*.dylib to look for this version instead
- #if we do not do this, apt-get will fail from our helper tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib $SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-cache"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-cdrom"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-config"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-ftparchive"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-get"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-mark"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/bin/apt-sortpkgs"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-inst.2.0.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/lib/libapt-private.0.0.0.dylib"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/apt-helper"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/cdrom"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/copy"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/file"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/ftp"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/gpgv"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/http"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/https"
- #codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/mirror"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/rred"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/rsh"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/methods/store"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/planners/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/solvers/apt"
- codesign "$SKEL_PREFIX/$ROOT_PREFIX/libexec/apt/solvers/dump"
- initDebStructure
- make -j8 DESTDIR="$BUILD_ROOT/$WORKING_DIR/deb" install
- #lzma conflicts with built in libraries we make -j8 an extra copy of our version of lzma in the xz build process
- #here we change libapt-pkg*.dylib to look for this version instead
- #if we do not do this, apt-get will fail from our helper tool
- install_name_tool -change /usr/lib/liblzma.5.dylib /usr/local/lib/liblzma.5.dylib deb/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-cache"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-cdrom"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-config"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-ftparchive"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-get"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-mark"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/apt-sortpkgs"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-inst.2.0.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-pkg.5.0.1.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/lib/libapt-private.0.0.0.dylib"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/apt-helper"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/cdrom"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/copy"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/file"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/ftp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/gpgv"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/http"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/https"
- #codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/mirror"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/rred"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/rsh"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/methods/store"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/planners/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/solvers/apt"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/libexec/apt/solvers/dump"
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: standard" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Packaging" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Depends: sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: the advanced packaging tool from Debian" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: APT 0.7 Strict" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://wiki.debian.org/Apt" >> deb/DEBIAN/control
- #Build the dev deb
- cat "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control" | sed "s|^Package: $PKG_NAME|Package: $PKG_NAME-dev|" | sed 's|^Priority: .*|Priority: optional|' | sed "s|^Depends: .*|Depends: $PKG_NAME|" | sed '/^Pre-Depends: /d' | sed 's|^Section: .*|Section: Development|' >> "$BUILD_ROOT/$WORKING_DIR/deb-dev/DEBIAN/control"
- mkdir -p "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- mv "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/include" "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX/"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/etc"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb/var"
- sudo chown -R root:wheel "$BUILD_ROOT/$WORKING_DIR/deb-dev/$ROOT_PREFIX"
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/${PKG_NAME}_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- buildAPTAndDependencies() {
- notifyProgress "Building gpg-error"
- buildGpgError
- notifyProgress "Building gcrypt"
- buildGcrypt
- notifyProgress "Building KSBA"
- buildKSBA
- notifyProgress "Building npth"
- buildNpth
- notifyProgress "Building Assuan"
- buildAssuan
- notifyProgress "Building ntbtls"
- buildNtbtls
- notifyProgress "Building gpg"
- buildGpg
- notifyProgress "Building apt"
- buildAPT
- }
- #===============
- #Dead Packages
- #---------------
- downloadGnuTLS() {
- #http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz
- if [[ ! -e gnutls-3.1.5.tar.xz ]]; then
- echo "Downloading gnutls-3.1.5.tar.xz"
- curl -LO http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz
- curl -LO http://gnu.mirrors.pair.com/gnutls/gnutls-3.1.5.tar.xz.sig
- checkPGPSig gnutls-3.1.5.tar.xz.sig gnutls-3.1.5.tar.xz
- else
- echo "Using existing gnutls"
- fi
- rm -rf gnutls-3.1.5
- tar xJvf gnutls-3.1.5.tar.xz
- }
- buildGnuTLS() {
- pthname="gnutls-3.1.5"
- downloadGnuTLS
- cd $pthname
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- make clean
- make -j8 DESTDIR="$SKEL_PREFIX" install
- make clean
- mkdir deb
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- sed -i -- 's|#undef HAVE_CLOCK_GETTIME||' config.h.in
- make -j8 DESTDIR="$BUILD_ROOT/$pthname/deb" install
- mkdir -p deb/DEBIAN
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: optional" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Development" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: portable threading library used by X" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Name: The New GNU Portable Threads Library" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: https://www.gnupg.org/software/npth" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/gnutls-3.5.1-1_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-doc
- mv deb-doc.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-doc_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- dpkg -b deb-dev
- mv deb-dev.deb "$BUILD_ROOT/extra_pkg/${PKG_NAME}-dev_${PKG_VERSION}_${PLATFORM_LOWER}-$ARCH.deb"
- cd ..
- }
- downloadGzip() {
- if [[ ! -e gzip-1.8.tar.xz ]]; then
- echo "Downloading gzip-1.8.tar.xz"
- curl -LO http://mirror.keystealth.org/gnu/gzip/gzip-1.8.tar.xz
- curl -LO http://mirror.keystealth.org/gnu/gzip/gzip-1.8.tar.xz.sig
- checkPGPSig gzip-1.8.tar.xz.sig gzip-1.8.tar.xz
- else
- echo "Using existing gzip"
- fi
- rm -rf gzip-1.8
- tar xJvf gzip-1.8.tar.xz
- }
- buildGzip() {
- downloadGzip
- cd gzip-1.8
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX/ --host=arm-apple-darwin
- make -j8 DESTDIR=$SKEL_PREFIX install
- initDebStructure
- CC=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang CFLAGS="-isysroot $SDK_PATH -I$SDK_PATH/usr/include -I$SKEL_PREFIX/$ROOT_PREFIX/include/ -arch $ARCH" CXXFLAGS=$CFLAGS LDFLAGS="-isysroot $SDK_PATH -L$SKEL_PREFIX/$ROOT_PREFIX/lib/ -arch $ARCH" ./configure --prefix=/$ROOT_PREFIX --host=arm-apple-darwin
- make -j8 DESTDIR=$BUILD_ROOT/gzip-1.8/deb install
- mkdir -p deb/DEBIAN
- echo "Package: $PKG_NAME" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Priority: required" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Section: Archiving" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Installed-Size: 724" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "$MAINTAINER" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Architecture: $PLATFORM_LOWER-$ARCH" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Version: $PKG_VERSION" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Pre-Depends: dpkg (>= 1.14.25-8)" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Depends: grep, sed" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Description: the standard Unix compression algorithm" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- #echo "Name: Diff Utilities" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- echo "Homepage: http://www.gzip.org/" >> "$BUILD_ROOT/$WORKING_DIR/deb/DEBIAN/control"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/cmp"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/diff3"
- codesign "$BUILD_ROOT/$WORKING_DIR/deb/$ROOT_PREFIX/bin/sdiff"
- find "$BUILD_ROOT/$WORKING_DIR/deb/" -type f -name '*.a' -delete
- dpkg -b deb
- mv deb.deb "$BUILD_ROOT/gzip-1.8-1_${PLATFORM_LOWER}-$ARCH.deb"
- createListFile
- cd "$BUILD_ROOT"
- }
- ######################################################################################
- # can download and repackage substrate (mostly, still may need a modified extrainst_ script)
- installSubstrate() {
- if [[ ! -e mobilesubstrate_0.9.6301_iphoneos-arm.deb ]]; then
- curl -LO http://apt.saurik.com/debs/com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- checkSHA256 com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb 86515cb9f6832247dbeae8427b996099dc8759bb1ef1d719c293123f2f531ee1
- #curl -LO http://apt.saurik.com/debs/mobilesubstrate_0.9.6301_iphoneos-arm.deb
- #checkSHA256 mobilesubstrate_0.9.6301_iphoneos-arm.deb 8dc91a066f088632409fecf65613831b8d6802e3b799f2dc87563c3ea2ed06ca
- curl -LO http://nitosoft.com/repo/deb/mobilesubstrate_0.9.6301_appletvos-arm64.deb
- fi
- rm -rf mobilesubstrate
- mkdir mobilesubstrate
- cp mobilesubstrate_0.9.6301_appletvos-arm64.deb mobilesubstrate/
- cp com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb mobilesubstrate/
- cd mobilesubstrate
- WORKING_DIR="mobilesubstrate"
- initDebStructure
- #dpkg-deb -e mobilesubstrate_0.9.6301_iphoneos-arm.deb deb/DEBIAN
- #dpkg-deb -x mobilesubstrate_0.9.6301_iphoneos-arm.deb deb
- #sed -i -- "s|iphoneos-arm|${PLATFORM_LOWER}-$ARCH|" deb/DEBIAN/control
- dpkg-deb -e mobilesubstrate_0.9.6301_appletvos-arm64.deb deb/DEBIAN
- dpkg-deb -x mobilesubstrate_0.9.6301_appletvos-arm64.deb deb
- PKG_NAME="mobilesubstrate"
- PKG_VERSION="0.9.6301"
- createListFile
- #dpkg -b deb
- #mv deb.deb "mobilesubstrate_0.9.6301_${PLATFORM_LOWER}-$ARCH.deb"
- #dpkg-deb -e com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb deb/DEBIAN
- initDebStructure
- dpkg-deb -e com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb deb/DEBIAN
- dpkg-deb -x com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb deb
- sed -i -- "s|iphoneos-arm|${PLATFORM_LOWER}-$ARCH|" deb/DEBIAN/control
- rm -rf "deb/DEBIAN/control--"
- PKG_NAME="com.saurik.substrate.safemode"
- PKG_VERSION="0.9.6001"
- createListFile
- dpkg -b deb
- mv deb.deb "com.saurik.substrate.safemode_0.9.6001_${PLATFORM_LOWER}-$ARCH.deb"
- cp "com.saurik.substrate.safemode_0.9.6001_${PLATFORM_LOWER}-$ARCH.deb" "$BUILD_ROOT/"
- rm ../com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- dpkg-deb -x "com.saurik.substrate.safemode_0.9.6001_${PLATFORM_LOWER}-$ARCH.deb" "$SKEL_PREFIX/"
- dpkg-deb -x "mobilesubstrate_0.9.6301_${PLATFORM_LOWER}-$ARCH.deb" "$SKEL_PREFIX/"
- #dpkg-deb -x com.saurik.substrate.safemode_0.9.6001_iphoneos-arm.deb
- cd "$BUILD_ROOT"
- }
- #main functions
- #main
- #Entry Point
- if [[ "$CLEAN_SKEL" == "true" ]]; then
- echo "Cleaning the slate"
- sudo rm -rf skel extra_pkg
- mkdir -p skel/etc
- mkdir extra_pkg
- fi
- # Ensure our SDK has all the required "extras" installed/setup
- prepSDK
- #exit 0
- #Begin Building
- #DO NOT BUILD THE 11 UTILS IN UNTIL YOU ARE BUILDING EXPLICITLY FOR 11+
- #/bin/bash exists on 9 and 10 and if overwritten without unthether will likely brick.
- if [[ "$BUILD_BASH" == "true" ]]; then
- buildBashAndFriends
- fi
- buildBasicUtils
- buildDPKGAndDependencies
- buildAPTAndDependencies
- #clean out frivolous stuff to slim skel down to a reasonable size
- find "$SKEL_PREFIX" -type f -name .DS_Store -delete
- mkdir -p "$SKEL_PREFIX/private"
- mv "$SKEL_PREFIX/etc" "$SKEL_PREFIX/private/"
- mv "$SKEL_PREFIX/var" "$SKEL_PREFIX/private/"
- processDeb() {
- PKG=$1
- VER=$2
- NAME=$3
- rm -rf deb
- mkdir -p deb/DEBIAN
- dpkg-deb -x "$PKG" deb
- dpkg-deb -e "$PKG" deb/DEBIAN
- PKG_NAME="$NAME"
- PKG_VERSION="$VER"
- createListFile
- dpkg-deb -x "$PKG" "$SKEL_PREFIX"
- }
- if [[ "$NITOTV" == "true" ]]; then
- #installSubstrate
- if [[ -d "nitotv" ]]; then
- rm -rf nitotv
- fi
- mkdir -p nitotv
- SUB_V=0.0.7
- NTV_V=2.3-26
- UIC_V=0.0.2-97
- TWEAK_V=0.0.1-26
- MORPH_V=1.0-1
- SHIM_V=0.0.1-1
- SSH_V=7.6p1-4
- SSH_DEB=openssh_"$SSH_V"_appletvos_arm64.deb
- SHIM_DEB=mobilesubstrate_"$SHIM_V"_appletvos-arm64.deb
- SUB_DEB=com.ex.libsubstitute_"$SUB_V"-coolstar_appletvos-arm64.deb
- NTV_DEB=nitotv_"$NTV_V"_appletvos-arm64.deb
- UIC_DEB=com.nito.uicache_"$UIC_V"_appletvos-arm64.deb
- TSS_DEB=com.nito.tssagent_1.0-1.appletvos-arm64.deb
- TWEAK_DEB=com.nito.tweakinject_"$TWEAK_V"_appletvos-arm64.deb
- MORPH_DEB=com.morpheus.binpack_"$MORPH_V"_appletvos-arm64.deb
- SAFETY_NET=com.nito.safetynet-1.0_appletvos_arm64.deb
- cd nitotv
- curl -LO "https://nitosoft.com/electra/deb/$SUB_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$NTV_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$UIC_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$TSS_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$TWEAK_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$MORPH_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$SAFETY_NET"
- curl -LO "https://nitosoft.com/electra/deb/$SHIM_DEB"
- curl -LO "https://nitosoft.com/electra/deb/$SSH_DEB"
- WORKING_DIR="nitotv"
- processDeb "$SUB_DEB" "$SUB_V" "com.ex.libsubstitute"
- processDeb "$TWEAK_DEB" "$TWEAK_V" "com.nito.tweakinject"
- processDeb "$NTV_DEB" "$NTV_V" "com.nito.nitotv4"
- processDeb "$TSS_DEB" "1.0-1" "com.nito.tssagent"
- processDeb "$UIC_DEB" "$UIC_V" "com.nito.uicache"
- processDeb "$MORPH_DEB" "$MORPH_V" "com.morpheus.binpack"
- processDeb "$SAFETY_NET" "1.0" "com.nito.safetynet"
- processDeb "$SHIM_DEB" "$SHIM_V" "mobilesubstrate"
- processDeb "$SSH_DEB" "$SSH_V" "openssh"
- mv *.deb ..
- fi
- createStatusFile
- #clean out symbolic links that you don't want to overwrite
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/liblzma.dylib"
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.1.dylib"
- unlink "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.dylib"
- rm "$SKEL_PREFIX/$ROOT_PREFIX/lib/libz.1.2.11.dylib"
- # Get rid of the docs
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/docs"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/doc"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/info"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/man"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/man"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/gnupg" #TODO: See if the keys in this folder are needed
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/readline"
- # Get rid of dev stuff
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/include"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/aclocal"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/pkgconfig"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/share/common-lisp"
- # remove all the static and libtool libraries from the bootstrap, they take up a LOT of space
- cd "$SKEL_PREFIX/$ROOT_PREFIX/lib"
- rm *.a
- rm *.la
- rmdir "$SKEL_PREFIX/$ROOT_PREFIX/var"
- #Get rid of non-skel packages which were needed to compile
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/gpg-error-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/libgcrypt-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/lib/pkgconfig"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/curl-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/ncurses6-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/npth-config"
- rm -rf "$SKEL_PREFIX/$ROOT_PREFIX/bin/ntbtls-config"
- # for getting permissions right, try to mimic them as closely as possible to the default ones
- # Still need to do this for debs, but oh well. We just won't use the yet :P
- sudo chown -R root:wheel "$SKEL_PREFIX/$ROOT_PREFIX"
- sudo chown root:admin "$SKEL_PREFIX/private"
- sudo chown -R root:wheel "$SKEL_PREFIX/private/etc"
- sudo chown -R root:wheel "$SKEL_PREFIX/private/var"
- #sudo chmod 6755 "$SKEL_PREFIX/usr/bin/nitoHelper"
- #sudo chmod 6755 "$SKEL_PREFIX/usr/bin/nitoUpdate"
- rm -rf skel.tgz
- cd "$SKEL_PREFIX"
- if [[ "$MOVE_DPKG" == "true" ]]; then
- if [[ ! -d "Library" ]]; then
- sudo mkdir Library
- fi
- sudo mv private/var/lib/dpkg Library/
- pushd private/var/lib/
- sudo ln -s /Library/dpkg .
- popd
- pwd
- fi
- if [[ "$NITOTV" == "true" ]]; then
- sudo chown root:admin "$SKEL_PREFIX/Applications"
- sudo chown -R root:wheel "$SKEL_PREFIX/Library"
- sudo chmod 6755 "$SKEL_PREFIX/usr/libexec/goNito"
- sudo tar cpz -P --exclude .DS_Store -f ../skel.tgz Applications usr private Library
- else
- sudo tar cpz -P --exclude .DS_Store -f ../skel.tgz usr private
- fi
- cd "$BUILD_ROOT"
- #reset trap
- trap - INT TERM EXIT
- ls *.deb
- echo "Done"
|